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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#! /bin/sh
# Script to create a .deb package from the current cvs sources.
usage ()
{
cat <<EOF
usage: $0 [options]
options:
-d /path/to/mttroot
Build package from local directory /path/to/mttroot instead of sourceforge CVS.
-k
Keep temporary directory after package creation
-l changelog text
Write changelog text to changelog file
Note: this must be the last option given.
-v #.#
Use version #.# instead of the date to label the .deb
EOF
}
error ()
{
echo $0: error: ${1:-"unknown error"} - aborting.
exit 1
}
# should be root for some of these commands
if [ ! `whoami` = "root" ]; then
echo root password required
exec su -p -c "$0 $*"
error "root authorisation failed"
fi
# default switches
default_sources="sourceforge"
default_logtext="snapshot from ${default_sources}."
default_version=`date --iso-8601 | sed 's/\-/./g'`
sources=${default_sources}
logtext=${default_logtext}
version="4.91."${default_version}
keeptmp="remove"
# look for command line arguments
while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
-d) # package directory instead of cvs sources
# should be the path to the mttroot directory
sources=$2
if [ ! "`basename ${sources}`" = "mttroot" ]; then
error "directory ${sources} is not location of mttroot"
fi
if [ "${logtext}" = "${default_logtext}" ]; then
logtext="snapshot from local sources (${sources})"
fi
echo "Using source directory: ${sources}"
shift ;;
-h)
usage
exit 0 ;;
-k) # keep temporary directory
keeptmp="keep" ;;
-l) # specify changelog text
shift
logtext="$*"
echo "Using changelog text: ${logtext}"
shift ;;
-v) # specify version
version=$2
echo "Using version number: ${version}"
shift ;;
*)
usage
error "unknown option $1" ;;
esac
|
|
>
>
|
|
>
>
|
>
>
>
>
|
>
>
>
|
>
|
>
|
>
>
>
>
|
|
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#! /bin/sh
# Script to create a .deb package from the current cvs sources.
usage ()
{
cat <<EOF
usage: $0 [options]
options:
-dir /path/to/mttroot
Build package from local directory /path/to/mttroot instead of sourceforge CVS.
-email email@address
email address of packager
-keep
Keep temporary directory after package creation
-log changelog text
Write changelog text to changelog file
Note: this must be the last option given.
-name name
name of packager
-version #.#
Use version #.# instead of the date to label the .deb
EOF
}
error ()
{
echo $0: error: ${1:-"unknown error"} - aborting.
exit 1
}
# should be root for some of these commands
if [ ! `whoami` = "root" ]; then
echo root password required
exec su -p -c "$0 $*"
error "root authorisation failed"
fi
# use -email and -name to change
DEBFULLNAME=${DEBFULLNAME:-"Geraint Paul Bevan"}
DEBEMAIL=${DEBEMAIL:-"geraint@users.sourceforge.net"}
# default switches
default_sources="sourceforge"
default_logtext="snapshot from ${default_sources}."
default_version=`date --iso-8601 | sed 's/\-/./g'`
sources=${default_sources}
logtext=${default_logtext}
version="4.91."${default_version}
keeptmp="remove"
# look for command line arguments
while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
-dir) # package directory instead of cvs sources
# should be the path to the mttroot directory
sources=$2
if [ ! "`basename ${sources}`" = "mttroot" ]; then
error "directory ${sources} is not location of mttroot"
fi
if [ "${logtext}" = "${default_logtext}" ]; then
logtext="snapshot from local sources (${sources})"
fi
echo "Using source directory: ${sources}"
shift ;;
-email) # email address of packager
DEBEMAIL=$2
echo "Using email address ${DEBEMAIL}"
shift ;;
-h | -help | --help)
usage
exit 0 ;;
-keep) # keep temporary directory
echo "Keeping temporary files"
keeptmp="keep" ;;
-log) # specify changelog text
shift
logtext="$*"
echo "Using changelog text: ${logtext}"
shift ;;
-name) # name of packager
DEBFULLNAME=$2
echo "Using name ${DEBFULLNAME}"
shift ;;
-version) # specify version
version=$2
echo "Using version number: ${version}"
shift ;;
*)
usage
error "unknown option $1" ;;
esac
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# create .deb
echo "$0: information: a \"Could not find diffs\" error in the next few lines is probably harmless"
uupdate -u mtt-${version}.tar.gz
cd ../mtt-${version}/debian
dch -v ${version} ${logtext}
cd ..
dpkg-buildpackage -rfakeroot
cd ..
# clean up
cp mtt*.deb ${topdir}/
cd ${topdir}
if [ "${keeptmp}" = "remove" ]; then
rm -r ${tmpdir}
else
echo Keeping temporary directory: ${tmpdir}
fi
exit 0
|
|
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# create .deb
echo "$0: information: a \"Could not find diffs\" error in the next few lines is probably harmless"
uupdate -u mtt-${version}.tar.gz
cd ../mtt-${version}/debian
dch -v ${version} ${logtext}
cd ..
dpkg-buildpackage -rfakeroot -k${DEBEMAIL}
cd ..
# clean up
cp mtt*.deb ${topdir}/
cd ${topdir}
if [ "${keeptmp}" = "remove" ]; then
rm -r ${tmpdir}
else
echo Keeping temporary directory: ${tmpdir}
fi
exit 0
|