Skip to content
Newer
Older
100644 47 lines (43 sloc) 1.76 KB
b23a808 @pbatard [internal] added script to change version and set version to 1.0.1
authored
1 #!/bin/sh
2 # Changes the version number
3 # !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!
4
5 type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; }
6
7 if [ ! -n "$1" ]; then
8 echo "you must provide a version number (eg. 1.0.2)"
9 exit 1
10 else
11 MAJOR=`echo $1 | sed "s/\(.*\)[.].*[.].*/\1/"`
12 MINOR=`echo $1 | sed "s/.*[.]\(.*\)[.].*/\1/"`
13 MICRO=`echo $1 | sed "s/.*[.].*[.]\(.*\)/\1/"`
14 fi
15 case $MAJOR in *[!0-9]*)
16 echo "$MAJOR is not a number"
17 exit 1
18 esac
19 case $MINOR in *[!0-9]*)
20 echo "$MINOR is not a number"
21 exit 1
22 esac
23 case $MICRO in *[!0-9]*)
24 echo "$MICRO is not a number"
25 exit 1
26 esac
27 echo "changing version to $MAJOR.$MINOR.$MICRO"
28 sed -e "s/^AC_INIT(\[\([^ ]*\)\], \[[^ ]*\]\(.*\)/AC_INIT([\1], [$MAJOR.$MINOR.$MICRO]\2/" configure.ac > configure.ac~
29 mv configure.ac~ configure.ac
30 cat > cmd.sed <<\_EOF
31 s/^[ \t]*FILEVERSION[ \t]*.*,.*,.*,\(.*\)/ FILEVERSION @@MAJOR@@,@@MINOR@@,@@MICRO@@,\1/
32 s/^[ \t]*PRODUCTVERSION[ \t]*.*,.*,.*,\(.*\)/ PRODUCTVERSION @@MAJOR@@,@@MINOR@@,@@MICRO@@,\1/
33 s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*".*\..*\..*\.\(.*\)"/\1VALUE "FileVersion", "@@MAJOR@@.@@MINOR@@.@@MICRO@@.\2"/
34 s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*".*\..*\..*\.\(.*\)"/\1VALUE "ProductVersion", "@@MAJOR@@.@@MINOR@@.@@MICRO@@.\2"/
35 s/^\(.*\)"Rufus v\(.*\)\.\(.*\)"\(.*\)/\1"Rufus v@@MAJOR@@.@@MINOR@@.@@MICRO@@.\3"\4/
36 s/^\(.*\)"Version \(.*\) (\(.*\)"\(.*\)/\1"Version @@MAJOR@@.@@MINOR@@.@@MICRO@@ (\3"\4/
37 _EOF
38
39 # First run sed to substitute our variable in the sed command file
40 sed -e "s/@@MAJOR@@/$MAJOR/g" -e "s/@@MINOR@@/$MINOR/g" -e "s/@@MICRO@@/$MICRO/g" cmd.sed > cmd.sed~
41 mv cmd.sed~ cmd.sed
071cf84 @pbatard [mingw] update autotools script following path change
authored
42 sed -f cmd.sed src/rufus.rc > src/rufus.rc~
43 sed 's/$/\r/' src/rufus.rc~ > src/rufus.rc
44 rm src/rufus.rc~
b23a808 @pbatard [internal] added script to change version and set version to 1.0.1
authored
45 rm cmd.sed
d1f4130 @pbatard [misc] increment version to rufus-next
authored
46 source autogen.sh
Something went wrong with that request. Please try again.