Check for -h option first.
## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
##
## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
##
+version=
+start=
+patch=
+push=
+while getopts "v:s:p:hr" option
+do
+ case $option in
+ h)
+ printf '%s\n%s\n%s\n%s\n%s\n' "-v <a.b> release major.minor e.g 1.9" "-s <c> start hash e.g. 728172681 (optional)" "-p <d> release patch version e.g. 2 for 1.6.2" "-r push to repo." "-h help"
+ exit 0
+ ;;
+ v) version="$OPTARG" ;;
+ s) start="$OPTARG" ;;
+ p) patch="$OPTARG" ;;
+ r) push=true ;;
+ *) exit 1 ;;
+ esac
+done
+
if [ ! -d .git ]
then
printf '%s\n' "Directory .git does not exist"
if [ ! -d .git ]
then
printf '%s\n' "Directory .git does not exist"
-version=
-start=
-patch=
-push=
-while getopts "v:s:p:hr" option; do
- case $option in
- h)
- printf '%s\n%s\n%s\n%s\n%s\n' "-v <a.b> release major.minor e.g 1.9" "-s <c> start hash e.g. 728172681 (optional)" "-p <d> release patch version e.g. 2 for 1.6.2" "-r push to repo." "-h help"
- exit 0
- ;;
- v) version="$OPTARG" ;;
- s) start="$OPTARG" ;;
- p) patch="$OPTARG" ;;
- r) push=true ;;
- *) exit 1 ;;
- esac
-done
-
-if [ "$start" ] && [ "$patch" ]
+if [ -n "$start" ] && [ -n "$patch" ]
then
printf '%s\n' "Cannot have start-hash and patch number together"
exit 1
then
printf '%s\n' "Cannot have start-hash and patch number together"
exit 1
then
if ! git branch master --contains "$start" > /dev/null 2>&1
then
then
if ! git branch master --contains "$start" > /dev/null 2>&1
then
then
if ! git rev-parse "v$version" > /dev/null 2>&1
then
then
if ! git rev-parse "v$version" > /dev/null 2>&1
then
- if ! [ "$patch" -ge 0 ] 2>/dev/null
+ if ! [ "$patch" -ge 0 ] 2> /dev/null
then
printf '%s\n' "Patch $patch is not an integer"
exit 1
then
printf '%s\n' "Patch $patch is not an integer"
exit 1
then
revision="$version"
else
revision="$version.$patch"
fi
then
revision="$version"
else
revision="$version.$patch"
fi
then
if [ -z "$start" ]
then
then
if [ -z "$start" ]
then
git checkout -b stable/"$version" "$start"
fi
git checkout -b stable/"$version" "$start"
fi
then
git push git@geeqie.org:geeqie stable/"$version"
fi
then
git push git@geeqie.org:geeqie stable/"$version"
fi
git add doc/docbook/CommandLineOptions.xml
git commit --message="Preparing for release v$revision"
git add doc/docbook/CommandLineOptions.xml
git commit --message="Preparing for release v$revision"
then
git push git@geeqie.org:geeqie
fi
git tag --sign "v$revision" --message="Release v$revision"
then
git push git@geeqie.org:geeqie
fi
git tag --sign "v$revision" --message="Release v$revision"
then
git push git@geeqie.org:geeqie "v$revision"
fi
then
git push git@geeqie.org:geeqie "v$revision"
fi
# shellcheck disable=SC2140
tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
# shellcheck disable=SC2140
tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
-gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
+gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
git add doc/docbook/CommandLineOptions.xml
git commit --message="Release v$revision files"
git add doc/docbook/CommandLineOptions.xml
git commit --message="Release v$revision files"
then
git push git@geeqie.org:geeqie
fi
then
git push git@geeqie.org:geeqie
fi