From 358357db1e15be923ca1e814816a3f765d1403a2 Mon Sep 17 00:00:00 2001 From: Sahal Ansari Date: Mon, 31 Mar 2014 07:43:37 +0000 Subject: [PATCH 1/3] -z instead of -e for non-files --- debian/dch-generate.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/dch-generate.sh b/debian/dch-generate.sh index 124552c9..f86cbaa4 100755 --- a/debian/dch-generate.sh +++ b/debian/dch-generate.sh @@ -20,10 +20,10 @@ tzone="+09:00" entry="* See: http://www.softether.org/5-download/history" # are you a debian maintainer? -if [ ! -e "$DEBFULLNAME" ]; then +if [ -z "$DEBFULLNAME" ]; then DEBFULLNAME="John Q. Sample" fi -if [ ! -e "$DEBEMAIL" ]; then +if [ -z "$DEBEMAIL" ]; then DEBEMAIL="tamade@example.org" fi @@ -61,6 +61,5 @@ echo echo " ""$entry" echo echo " --"" ""$DEBFULLNAME"" <""$DEBEMAIL""> ""$date" -echo exit 0 From 759e4789f6c8bcf692bcd1485f323236b3b55f93 Mon Sep 17 00:00:00 2001 From: Sahal Ansari Date: Tue, 1 Apr 2014 14:46:02 +0000 Subject: [PATCH 2/3] One can now launch the script from any location, not just debian/ --- debian/dch-generate.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/dch-generate.sh b/debian/dch-generate.sh index f86cbaa4..a9583317 100755 --- a/debian/dch-generate.sh +++ b/debian/dch-generate.sh @@ -9,6 +9,7 @@ # version 2 as published by the Free Software Foundation. # warning: the following file has CRLF line endings (Windows) +# the location of the following file is relative to this script cbuild="../src/CurrentBuild.txt" # required for debian packaging @@ -27,10 +28,12 @@ if [ -z "$DEBEMAIL" ]; then DEBEMAIL="tamade@example.org" fi -# check if ./changelog exists, check if $cbuild exists +# where am i located? in $DIR, of course! +DIR="$( cd "$( dirname "$0" )" && pwd )" +cd "$DIR" +# check if debian/changelog exists, check if $cbuild exists if [ ! -e ./changelog ]; then echo "Am I in debian/? I can't find changelog" - echo "Maybe run: touch debian/changelog ?" exit 1 fi if [ ! -e "$cbuild" ]; then From 0f49c92c31d60a920e6e76a7163edbc960be4cb9 Mon Sep 17 00:00:00 2001 From: Sahal Ansari Date: Tue, 1 Apr 2014 14:52:52 +0000 Subject: [PATCH 3/3] missed a pair of quotation marks --- debian/dch-generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/dch-generate.sh b/debian/dch-generate.sh index a9583317..285ada5f 100755 --- a/debian/dch-generate.sh +++ b/debian/dch-generate.sh @@ -55,7 +55,7 @@ majorversion="$(echo "${cbuildarray[1]}" | awk '{sub(/[0-9]/,"&.",$0);print $0}' # "${cbuildarray[3]}" is split and the second half is converted from # from "131655" to "13:16:55" using GNU awk then it's put back together # (like humpty dumpty) and sent to GNU date for conversion to UTC -time="$(echo ${cbuildarray[3]#*_} | awk '{gsub(/[0-9][0-9]/,"&:",$0);print $0}')" +time="$(echo "${cbuildarray[3]#*_}" | awk '{gsub(/[0-9][0-9]/,"&:",$0);print $0}')" date="$(date -R --date="$(echo "${cbuildarray[3]%_*}"" ""${time%?}""$tzone")")" # print the new debian changelog