mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Merge pull request #42 from sahal/master
This version is more logical and less ugly
This commit is contained in:
commit
19ca16ef2b
67
debian/dch-generate.sh
vendored
67
debian/dch-generate.sh
vendored
@ -8,56 +8,59 @@
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
|
||||
# note: the following file has CRLF line endings (Windows)
|
||||
# warning: the following file has CRLF line endings (Windows)
|
||||
cbuild="../src/CurrentBuild.txt"
|
||||
|
||||
# required for debian packaging
|
||||
package="softether-vpn"
|
||||
status="UNRELEASED"
|
||||
# timezone in +hh:mm from GMT
|
||||
# assuming the orij. author is in Japan: +9 GMT
|
||||
# timezone in +hh:mm from UTC (+9 UTC)
|
||||
tzone="+09:00"
|
||||
# builder name, builder email
|
||||
builder="John Q. Sample"
|
||||
email="tamade@example.org"
|
||||
# static changelog entry
|
||||
entry="* See: http://www.softether.org/5-download/history"
|
||||
|
||||
# are you a debian maintainer?
|
||||
if [ ! -e "$DEBFULLNAME" ]; then
|
||||
DEBFULLNAME="John Q. Sample"
|
||||
fi
|
||||
if [ ! -e "$DEBEMAIL" ]; then
|
||||
DEBEMAIL="tamade@example.org"
|
||||
fi
|
||||
|
||||
# check if ./changelog exists, check if $cbuild exists
|
||||
if [ ! -e ./changelog ]; then
|
||||
/bin/echo -ne "Are you in debian/? I can't find: ./changelog\n"
|
||||
echo "Am I in debian/? I can't find changelog"
|
||||
echo "Maybe run: touch debian/changelog ?"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "$cbuild" ]; then
|
||||
echo "This doesn't look like the SoftEtherVPN source tree. I can't find ""$cbuild"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e $cbuild ]; then
|
||||
/bin/echo -ne "This doesn't look like the SoftEtherVPN source tree. I can't find: src/CurrentBuild.txt\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# parse version and date -- formatted in RFC 2822 format -- from ../src/CurrentBuild.txt
|
||||
while IFS=$'\ ' read -r line_data; do
|
||||
cbuildarray[i]=$(echo "${line_data}"| sed -e s/\\r// -e s/.*\ //)
|
||||
# version and date info from $cbuild are put into array ${cbuildarray[@]}
|
||||
# build "${cbuildarray[0]}", major version "${cbuildarray[1]}",
|
||||
# release type "${cbuildarray[2]}", and date "${cbuildarray[3]}"
|
||||
while IFS=$'\r\n' read -r line_data; do
|
||||
cbuildarray[i]="${line_data##*[A-Z]\ }"
|
||||
((++i))
|
||||
done < $cbuild
|
||||
done < "$cbuild"
|
||||
|
||||
#buildnumber="${cbuildarray[0]}"
|
||||
#majorversion="${cbuildarray[1]}"
|
||||
#releasetype="${cbuildarray[2]}"
|
||||
#unparseddate="${cbuildarray[3]}"
|
||||
# "${cbuildarray[1]}" is converted from "406" to "4.06" using GNU awk
|
||||
majorversion="$(echo "${cbuildarray[1]}" | awk '{sub(/[0-9]/,"&.",$0);print $0}')"
|
||||
|
||||
# "${cbuildarray[1]}" needs to be converted
|
||||
# from "406" to "4.06"
|
||||
# this is really ugly and requires GNU awk (afaik)
|
||||
version="$(echo "$(echo "${cbuildarray[1]}" | awk '{sub(/[0-9]/,"&.",$0);print $0}' )"".""${cbuildarray[0]}""-""${cbuildarray[2]}")"
|
||||
|
||||
# "${cbuildarray[3]}" \needs\ to be converted
|
||||
# from "20140321_131655" to "20140321 13:16:55+0900"
|
||||
# this is really really ugly and requires GNU date and GNU awk (afaik)
|
||||
convertformat="$(echo "$(echo "${cbuildarray[3]}" | sed s/_.*//)"" ""$(echo "${cbuildarray[3]}" | sed s/.*_// | awk '{gsub(/[0-9][0-9]/,"&:",$0);print $0}' | sed s/\:$//)")"
|
||||
# now we send $convertformat and $tzone to `date` and have it automagically reformat it for us
|
||||
date="$(date -R --date="$(echo "$convertformat""$tzone")")"
|
||||
# "${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}')"
|
||||
date="$(date -R --date="$(echo "${cbuildarray[3]%_*}"" ""${time%?}""$tzone")")"
|
||||
|
||||
# print the new debian changelog
|
||||
/bin/echo -ne "$package ($version) $status; urgency=low\n\n $entry\n\n -- $builder <$email> $date\n"
|
||||
echo "$package"" (""$majorversion"".""${cbuildarray[0]}""-""${cbuildarray[2]}"") ""$status""; urgency=low"
|
||||
echo
|
||||
echo " ""$entry"
|
||||
echo
|
||||
echo " --"" ""$DEBFULLNAME"" <""$DEBEMAIL""> ""$date"
|
||||
echo
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user