Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dch-generate.sh « debian - github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 285ada5f019aa6ef2583be9fbbdb928a5de2c88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# use: ./debian/dch-generate.sh > ./debian/changelog
# desc: quick and dirty (emphasis on dirty) debian changelog generator for SoftEtherVPN
#
# Copyright (c) 2014 Sahal Ansari (github@sahal.info)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# 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
package="softether-vpn"
status="UNRELEASED"
# timezone in +hh:mm from UTC (+9 UTC)
tzone="+09:00"
# static changelog entry
entry="* See: http://www.softether.org/5-download/history"

# are you a debian maintainer?
if [ -z "$DEBFULLNAME" ]; then
	DEBFULLNAME="John Q. Sample"
fi
if [ -z "$DEBEMAIL" ]; then
	DEBEMAIL="tamade@example.org"
fi

# 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"
	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

# 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"

# "${cbuildarray[1]}" is converted from "406" to "4.06" using GNU awk
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}')"
date="$(date -R --date="$(echo "${cbuildarray[3]%_*}"" ""${time%?}""$tzone")")"

# print the new debian changelog
echo "$package"" (""$majorversion"".""${cbuildarray[0]}""-""${cbuildarray[2]}"") ""$status""; urgency=low"
echo
echo "  ""$entry"
echo
echo " --"" ""$DEBFULLNAME"" <""$DEBEMAIL"">  ""$date"

exit 0