3 # The script ensures that all commands succeed unless an error occurred. If it
4 # does though, the shell terminates the script and our exit handler runs.
5 trap 'tput bel || :; echo Failed! >&2' EXIT
7 # Ask the user a yes/no question. This function does not require the user to
8 # press ENTER after making a selection.
13 trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
14 stty -echo iuclc -icanon 2>/dev/null
15 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
17 " 0a") if [ -n "$1" ]; then
18 [ $1 -eq 0 ] && echo "Y" || echo "N"
28 "") echo "Aborted" >&2
31 *) # The user pressed an unrecognized key. As we are not echoing
32 # any incorrect user input, alert the user by ringing the bell.
33 (tput bel) 2>/dev/null || :
39 # Build Debian package and create all the files that are needed by the
40 # distribution maintainer.
44 # Try to build the package. If things fail, let the exit handler remove all
46 trap 'rm -rf "${prj}-${ver}" "${prj}_${ver}"*' EXIT
48 # Clean up any old temporary files
49 rm -rf "${prj}-${ver}" "${prj}_${ver}"*
51 # Extract the distribution source archive
52 tar zfx "${prj}-${ver}.tar.gz"
54 # We want to ship the "debian" directory with the source archive that
55 # users download directly from the project web site. This allows them to
56 # easily build their own Debian package by following the instructions in
58 # But when preparing our package for direct integration with Debian-based
59 # distributions, we have to instead remove the "debian" directory, as the
60 # distribution prefers that third-party projects are not built "natively".
61 mv "${prj}-${ver}/debian" "${prj}_${ver}_debian"
62 tar zfc "${prj}_${ver}.orig.tar.gz" "${prj}-${ver}"
63 mv "${prj}_${ver}_debian" "${prj}-${ver}/debian"
65 # Reset compatibility level
66 echo 7 >"${prj}-${ver}/debian/compat"
68 # Build Debian packages.
70 fakeroot dpkg-buildpackage -sa -us -uc || :)
74 # Revert any changes that might be pending in distributions/debian/*
75 local revert="$(svn st |
76 grep distributions/debian |
80 if [ -n "${revert}" ]; then
85 # Create distributions/debian if it does not exist yet.
86 mkdir -p distributions/debian
87 for i in distributions distributions/debian; do
88 if [ -z "$(svn st "${i}" 2>/dev/null | grep -v '^[?]')" ]; then
89 svn add --depth=empty "${i}"
93 # If this version of files already exists in the distribution directory,
94 # we are not yet ready to cut a new release. Just clean up and exit.
95 for i in "${prj}_${ver}"[-.]*.*; do
96 [ -r "distributions/debian/${i}" ] && {
97 rm $(ls "${prj}_${ver}"[-.]* | egrep -v '_*.changes|_*.deb')
102 # Move new Debian files into release area.
103 mv $(ls "${prj}_${ver}"[-.]* | egrep -v '_*.changes|_*.deb') \
104 distributions/debian/
105 svn add distributions/debian/"${prj}_${ver}"[-.]*.*
107 # Let the caller know that we added new packages.
111 # Quick sanity check that we are running from the correct directory
114 # Make sure there are no stale files
117 # Determine Subversion revision number, project name, and public version
120 rev=$(($(svn info | sed -e 's/^Revision: \(.*\)/\1/;t1;d;:1;q')+1))
121 prj="$(sed -e 's/^AC_INIT(\([^,]*\),.*/\1/;t1;d;:1;q' configure.ac)"
122 ver="$(sed -e 's/^AC_INIT([^,]*, *\([^,]*\),.*/\1/;t1;d;:1;q' configure.ac)"
125 # Update "configure.ac" with the next Subversion revision number. This
126 # information will trickle down into various source files where it becomes
127 # part of the user-visible version information.
128 sed -i -e 's/^\(VCS_REVISION=\).*/\1'"${rev}"'/' configure.ac
129 touch shellinabox/vt100.jspp shellinabox/shell_in_a_box.jspp
131 # If the manual page has been changed, make sure that the time stamp will be
133 if [ -n "$(svn st shellinabox/shellinaboxd.man.in 2>/dev/null |
135 sed -i -e 's/^\([.]TH .*\)"[^"]*"/\1"'"$(date +'%b %d, %Y')"'"/
136 s/2008-2[01][0-9][0-9]/2008-'"$(date +'%Y')"'/g' \
137 shellinabox/shellinaboxd.man.in
140 # Always update the year in the user visible copyright statement(s)
141 for i in shellinabox/shell_in_a_box.jspp \
142 shellinabox/vt100.jspp \
145 sed -i -e 's/\(2[01][0-9][0-9]-\)2[01][0-9][0-9]/\1'"$(date +'%Y')"'/g' "$i"
148 # If a source file has changed, make sure to update the year in the copyright
149 # statement for that particular file.
150 svn st | egrep '^[MA]' | awk '{ print $2 }' |
151 egrep '^(shellinabox|libhttp|demo)/' |
152 egrep '[.](html|h|c|css|jspp)$' |
154 sed -i -e 's/\(2[01][0-9][0-9]-\)2[01][0-9][0-9]/\1'"$(date +'%Y')"'/g' "$f"
157 # For now, Ubuntu/Hardy is still quite popular. We want to make it easy for
158 # our users to build Debian packages from source. So, make sure we lock the
159 # compatibility level at 6. Once we no longer care about maintaining strict
160 # backwards compatibility, we can lift this restriction.
161 echo 6 >debian/compat
163 # Build all the sources, create the distribution tar archive, and run some
164 # basic sanity checks.
167 # Build Debian package and create all the files that are needed by the
168 # distribution maintainer.
172 NOTICE: New version released. Please do not forget to notify distributions"
175 egrep -v ' configure$| aclocal.m4$|distributions|^[?]' |
176 sed -e 's/^[^ ]* *//') | less
177 echo -n 'Commit these changes (Y/n): '