Merge pull request #314 from a-detiste/master

debian: preserve user options on upgrade
This commit is contained in:
Luka Krajger 2015-05-28 19:39:24 +02:00
commit 21c8d8e0b7
5 changed files with 46 additions and 2 deletions

1
debian/changelog vendored
View file

@ -6,6 +6,7 @@ shellinabox (2.15-1) UNRELEASED; urgency=medium
* move lintian exception in d/shellinabox.lintian
* change urls to new GitHub repos
* Closing release coordination metabug (Closes: #785181)
* keep user preferences on upgrade (Closes: #786441)
-- Alexandre Detiste <alexandre.detiste@gmail.com> Tue, 12 May 2015 14:06:55 +0200

3
debian/rules vendored
View file

@ -20,12 +20,11 @@ ENABLED=debian/shellinabox/etc/shellinabox/options-enabled
override_dh_install:
dh_install
install -D -m644 shellinabox/black-on-white.css "$(AVAILABLE)/00+Black on White.css"
install -D -m644 shellinabox/white-on-black.css "$(AVAILABLE)/00_White on Black.css"
install -D -m644 shellinabox/white-on-black.css "$(AVAILABLE)/00_White On Black.css"
install -D -m644 shellinabox/color.css "$(AVAILABLE)/01+Color Terminal.css"
install -D -m644 shellinabox/monochrome.css "$(AVAILABLE)/01_Monochrome.css"
install -D -m644 debian/README.available "$(AVAILABLE)/README"
install -D -m644 debian/README.enabled "$(ENABLED)/README"
cd "$(ENABLED)" && ln -s ../options-available/*.css .
# info duplicated in debian/copyright
# and /usr/share/common-licenses/GPL-2

View file

@ -29,6 +29,16 @@ case "$1" in
# can write the certificate even when the daemon has given-up
# root privileges.
# chown shellinabox:shellinabox /var/lib/shellinabox
# new install, enable all options
if [ -z "$2" ]; then
(cd /etc/shellinabox/options-enabled; ln -s ../options-available/*.css .)
# upgrade from <= v2.14, re-enable saved options
elif [ -d /etc/shellinabox/options-enabled-save ]; then
mv /etc/shellinabox/options-enabled-save/*.css /etc/shellinabox/options-enabled
rm -r /etc/shellinabox/options-enabled-save
fi
# future upgrades: no-op
;;
abort-upgrade|abort-remove|abort-deconfigure)

View file

@ -33,6 +33,7 @@ case "$1" in
deluser --quiet --system shellinabox > /dev/null || true
delgroup --quiet --system shellinabox > /dev/null || true
[ ! -d "$d" ] || rmdir "$d" || true # deluser can't do this for /var
rm -rf "/etc/shellinabox/options-enabled"
exit 0
;;
esac

33
debian/shellinabox.preinst vendored Normal file
View file

@ -0,0 +1,33 @@
#!/bin/sh
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#DEBHELPER#
case "$1" in
upgrade)
# save old configuration
test -d /etc/shellinabox/options-enabled || exit 0
ls /etc/shellinabox/options-enabled/*.css > /dev/null 2>&1 || exit 0
if dpkg --compare-versions "$2" le "2.14-1"; then
mkdir -p /etc/shellinabox/options-enabled-save
cp -a /etc/shellinabox/options-enabled/*.css /etc/shellinabox/options-enabled-save
fi
;;
install|abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac