Fixed a bug in the build number Bash script where it would decement meta build numbers when they are zero.
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#ifndef KERNEL_VERSION_NUMBER
|
#ifndef KERNEL_VERSION_NUMBER
|
||||||
#define KERNEL_VERSION_NUMBER "1.4.10-47"
|
#define KERNEL_VERSION_NUMBER "1.4.10-40"
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONSOLE_VERSION_NUMBER
|
#ifndef CONSOLE_VERSION_NUMBER
|
||||||
#define CONSOLE_VERSION_NUMBER "0.4.5-48"
|
#define CONSOLE_VERSION_NUMBER "0.4.5-0"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,13 +7,7 @@ patch_level=0
|
|||||||
#And there is a fourth additional label for the build metadata.
|
#And there is a fourth additional label for the build metadata.
|
||||||
#These labels are for pre-release and build metadata.
|
#These labels are for pre-release and build metadata.
|
||||||
meta=0
|
meta=0
|
||||||
|
|
||||||
folder=$(dirname "$1")
|
|
||||||
parent_folder=$(basename "$folder")
|
|
||||||
#Capitalize the folder name so it matches the format in the C #define files.
|
|
||||||
parent_folder=${parent_folder^^}
|
|
||||||
|
|
||||||
define_count=0
|
|
||||||
file_contents=""
|
file_contents=""
|
||||||
#Looping code from
|
#Looping code from
|
||||||
#https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
|
#https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
|
||||||
@@ -25,16 +19,11 @@ while IFS=' ' read -ra line; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
#Lob off the quotes surrounding the version number.
|
#Lob off the quotes surrounding the version number.
|
||||||
#version_number="${line[2]:1:-1}"
|
#After lobbing off the quotes, replace all instances of '-' with a period.
|
||||||
version_number=($(echo ${line[2]:1:-1} | tr "-" "."))
|
version_number=($(echo ${line[2]:1:-1} | tr "-" "."))
|
||||||
#The symbol name that #define was setting (i.e. KERNEL_VERSION_NUMBER).
|
#The symbol name that #define was setting (i.e. KERNEL_VERSION_NUMBER).
|
||||||
symbol=${line[1]}
|
symbol=${line[1]}
|
||||||
|
#Read in the version number and split it on all periods.
|
||||||
for i in "${my_array[@]}"
|
|
||||||
do
|
|
||||||
echo $i
|
|
||||||
done
|
|
||||||
|
|
||||||
IFS='.' read -a chunks <<<$version_number
|
IFS='.' read -a chunks <<<$version_number
|
||||||
|
|
||||||
version_part_counter=0
|
version_part_counter=0
|
||||||
@@ -58,11 +47,16 @@ while IFS=' ' read -ra line; do
|
|||||||
#number, otherwise we decrement.
|
#number, otherwise we decrement.
|
||||||
if [ "$2" == "" ]
|
if [ "$2" == "" ]
|
||||||
then
|
then
|
||||||
|
echo "Incrementing meta build number."
|
||||||
meta=$(($i + 1))
|
meta=$(($i + 1))
|
||||||
else
|
else
|
||||||
if [ $meta > 0 ]
|
if [ "$i" -gt 0 ]
|
||||||
then
|
then
|
||||||
|
echo "Decrementing meta build number."
|
||||||
meta=$(($i - 1))
|
meta=$(($i - 1))
|
||||||
|
else
|
||||||
|
echo "Meta build number already zero, nothing to be done."
|
||||||
|
meta=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -72,13 +66,8 @@ while IFS=' ' read -ra line; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
ver="$major.$minor.$patch_level-$meta"
|
ver="$major.$minor.$patch_level-$meta"
|
||||||
tmp="#ifndef ${symbol}\n#define ${symbol} \"$ver\"\n#endif\n"
|
|
||||||
|
|
||||||
file_contents="$file_contents$tmp"
|
file_contents="$file_contents#ifndef ${symbol}\n#define ${symbol} \"$ver\"\n#endif\n"
|
||||||
|
|
||||||
define_count=$(($define_count + 1))
|
|
||||||
done < "$1"
|
done < "$1"
|
||||||
|
|
||||||
printf "$file_contents"
|
|
||||||
echo "$1"
|
|
||||||
printf "$file_contents" > "$1"
|
printf "$file_contents" > "$1"
|
||||||
|
|||||||
Reference in New Issue
Block a user