3 # increments the build version number.
5 mkdir -p "$TEMPORARIES_DIR"
8 if [ ! -z "$BUILD_PARAMETER_FILE" ]; then
9 # define our version of the build parameter file. this should be set
10 # beforehand so we override the default parameter file for clam.
11 PARAMETER_FILE="$BUILD_PARAMETER_FILE"
13 if [ -z "$PARAMETER_FILE" ]; then
14 # last ditch attempt to get one that will work.
15 PARAMETER_FILE="$FEISTY_MEOW_DIR/build.ini"
18 chmod u+w "$PARAMETER_FILE"
20 new_buildini="$(mktemp "$TEMPORARIES_DIR/buildini.XXXXXX")"
21 # whack the file just in case.
23 echo -n "" >"$new_buildini"
25 # pick a weird separator that we hope never to see.
35 while read line_found; do
36 if [ $? != 0 ]; then break; fi
37 #echo line found is $line_found
38 if [ ! -z "$skip_line" ]; then
39 # we were told to skip this line to fix win32.
44 # these checks don't care about whether we've seen other stuff yet.
45 if [ -z "$major_string" ]; then
46 if [ ! -z "$(echo $line_found | sed -n -e 's/^ *major *=.*$/yep/p')" ]; then
47 major_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' )
50 if [ -z "$minor_string" ]; then
51 if [ ! -z "$(echo $line_found | sed -n -e 's/^ *minor *=.*$/yep/p')" ]; then
52 minor_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' )
56 # we process the revision string line specially.
57 if [ -z "$found_version" ]; then
58 if [ "$line_found" == "#[version]" ]; then
59 # repair our special escape that makes this a valid ini file and
60 # gnu make include file.
61 echo -e "#\\\\\n[version]" >>"$new_buildini"
64 elif [ "$line_found" == "#" ]; then
65 # retarded win32 case.
66 echo -e "#\\\\\n[version]" >>"$new_buildini"
71 elif [ -z "$revision_string" ]; then
72 if [ ! -z "$(echo $line_found | sed -n -e 's/^ *revision *=.*$/yep/p')" ]; then
73 revision_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' )
74 #echo second part is $revision_string
75 revision_string=$(expr $revision_string + 1)
76 echo "revision=$revision_string" >>"$new_buildini"
77 # don't print the line normally also.
82 # send the line with no special processing.
83 echo "$line_found" >>"$new_buildini"
85 done <"$PARAMETER_FILE"
87 # if we created something with contents, let's use it.
88 if [ -s "$new_buildini" ]; then
89 cp "$new_buildini" "$PARAMETER_FILE"
92 echo "New build version is: $major_string.$minor_string.$revision_string"
94 # don't leave the temporary version files floating around.