|
| 1 | +#!/bin/sh -e |
| 2 | + |
1 | 3 | #****************************************************************************** |
2 | | -# Copyright (c) 2019 IBM Corporation and others. |
| 4 | +# Copyright (c) 2019, 2025 IBM Corporation and others. |
3 | 5 | # |
4 | 6 | # This program and the accompanying materials |
5 | 7 | # are made available under the terms of the Eclipse Public License 2.0 |
|
12 | 14 | # IBM Corporation - initial API and implementation |
13 | 15 | #****************************************************************************** |
14 | 16 |
|
15 | | -#!/bin/sh |
16 | | - |
17 | 17 | if [ "x$1" == "x" ] || [ "x$2" == "x" ]; then |
18 | 18 | echo "Usage error: Pass release version and simrel release name as arguments" |
19 | 19 | echo "For example: ./applyTemplate.sh 4.13 2019-09" |
20 | 20 | exit 1 |
21 | 21 | fi |
| 22 | +eclipseVersion=$1 |
| 23 | +simRelVersion=$2 |
22 | 24 |
|
23 | | -cd .. |
24 | | -echo "In parent directory of scripts `pwd`" |
| 25 | +cd $(dirname $(readlink -f "$0"))/../../news |
| 26 | +echo "In news directory: $(pwd)" |
25 | 27 |
|
26 | | -echo "Checking if directory $1 already exists" |
27 | | -if [ -d $1 ] |
28 | | -then |
29 | | - echo "Error: Directory $1 already exists. Exiting..." |
| 28 | +echo "Checking if directory ${eclipseVersion} already exists" |
| 29 | +if [ -d ${eclipseVersion} ]; then |
| 30 | + echo "Error: Directory ${eclipseVersion} already exists. Exiting..." |
30 | 31 | exit 1 |
31 | 32 | fi |
32 | 33 |
|
33 | | -echo "Applying template for $1" |
34 | | -cp -R '4.x-template' $1 |
35 | | - |
36 | | -echo "Created directory and entering $1" |
37 | | -cd $1 |
38 | | - |
39 | | -echo "Replacing 4.x with $1 to files in `pwd`" |
| 34 | +echo "Applying template for ${eclipseVersion}" |
| 35 | +cp -R '4.x-template' ${eclipseVersion} |
40 | 36 |
|
41 | | -sed -i'.bak' -e "s/4\.x/$1/g" index.html |
42 | | -sed -i'.bak' -e "s/4\.x/$1/g" jdt.html |
43 | | -sed -i'.bak' -e "s/4\.x/$1/g" pde.html |
44 | | -sed -i'.bak' -e "s/4\.x/$1/g" platform.html |
45 | | -sed -i'.bak' -e "s/4\.x/$1/g" platform_isv.html |
| 37 | +echo "Created directory and entering ${eclipseVersion}" |
| 38 | +cd ${eclipseVersion} |
46 | 39 |
|
47 | | -echo "Replacing YYYY-MM with $2 in index.html" |
48 | | -sed -i'.bak' -e "s/YYYY-MM/$2/g" index.html |
| 40 | +echo "Replacing 4.x with ${eclipseVersion} and YYYY-MM with ${simRelVersion} to files in $(pwd)" |
49 | 41 |
|
50 | | -echo "Deleting backup files" |
51 | | -rm *.html.bak |
| 42 | +for file in *.md; do |
| 43 | + if [ -f "$file" ]; then |
| 44 | + sed -i --expression "s|4\.x|${eclipseVersion}|g" $file |
| 45 | + sed -i --expression "s|YYYY-MM|${simRelVersion}|g" $file |
| 46 | + fi |
| 47 | +done |
0 commit comments