From 34c2f26b52c205d0460c905bf32acf4626630764 Mon Sep 17 00:00:00 2001 From: lars Date: Fri, 24 Nov 2006 11:03:20 +0000 Subject: [PATCH] debian packaging finished --- debian/control | 8 ++++---- debian/cryptobox.default | 4 +--- debian/cryptobox.docs | 2 -- debian/cryptobox.examples | 1 + debian/cryptobox.init | 10 ++++------ debian/cryptobox.lintian | 1 + debian/cryptobox.manpages | 2 ++ debian/postinst | 4 +++- debian/postrm | 36 ++++++++++++++++++++++++++---------- debian/preinst | 4 ++++ debian/prerm | 4 ++++ debian/rules | 21 +++++++++++++++------ 12 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 debian/cryptobox.examples create mode 100644 debian/cryptobox.lintian create mode 100644 debian/cryptobox.manpages create mode 100644 debian/preinst create mode 100644 debian/prerm diff --git a/debian/control b/debian/control index bf40d96..36aa61a 100644 --- a/debian/control +++ b/debian/control @@ -2,15 +2,15 @@ Source: cryptobox Section: admin Priority: extra Maintainer: Lars Kruse -Build-Depends: debhelper (>= 5.0.37.2), dpatch, python-all-dev (>= 2.4), python-central (>= 0.5.6) -XS-Python-Version: 2.4 +Build-Depends: debhelper (>= 5.0.38), dpatch, python-all-dev (>= 2.4), python-central (>= 0.5.6) +XS-Python-Version: >= 2.4 Standards-Version: 3.7.2 Package: cryptobox Architecture: any -Depends: ${python:Depends}, bash (>=2.0), sed (>=4.0), coreutils, grep (>=2.0), hashalot, cryptsetup (>=20050111), dmsetup, initscripts, e2fsprogs (>= 1.27), adduser, python (>=2.4), python-clearsilver, super, dosfstools, python-cherrypy, python-configobj +Depends: ${python:Depends}, bash (>=2.0), sed (>=4.0), coreutils, grep (>=2.0), cryptsetup (>=20050111), dmsetup, initscripts, e2fsprogs (>= 1.27), adduser, python (>=2.4), python-clearsilver, super, dosfstools, python-cherrypy, python-configobj Suggests: samba, stunnel, openssl -XB-Python-Version: 2.4 +XB-Python-Version: ${python:Versions} Description: Web interface for an encrypting fileserver This web interface allows you to manage the encrypted and plaintext disks of your system. The data is platform independently available diff --git a/debian/cryptobox.default b/debian/cryptobox.default index c802998..556f981 100644 --- a/debian/cryptobox.default +++ b/debian/cryptobox.default @@ -1,8 +1,6 @@ # boot configuration file for the CryptoBox # -# $Id$ -# -# the default setup of the cryptobox is complete inactivity +# the default state of the cryptobox is disabled # set to "0" to enable the startup of the cryptobox - otherwise "1" NO_START=1 diff --git a/debian/cryptobox.docs b/debian/cryptobox.docs index b8d67bd..448d85a 100644 --- a/debian/cryptobox.docs +++ b/debian/cryptobox.docs @@ -2,6 +2,4 @@ README copyright changelog doc/html -LICENSE event-scripts -conf-examples diff --git a/debian/cryptobox.examples b/debian/cryptobox.examples new file mode 100644 index 0000000..c50cf7e --- /dev/null +++ b/debian/cryptobox.examples @@ -0,0 +1 @@ +conf-examples diff --git a/debian/cryptobox.init b/debian/cryptobox.init index 842d7cf..0cf8ff5 100644 --- a/debian/cryptobox.init +++ b/debian/cryptobox.init @@ -59,22 +59,20 @@ case "$1" in log_daemon_msg "Starting $DESC" if start-stop-daemon \ --chuid $RUNAS: --quiet --start \ - --oknodo --user $RUNAS --pidfile "$PIDFILE" \ + --user $RUNAS --pidfile "$PIDFILE" \ --exec /usr/bin/python --startas "$DAEMON" -- $OPTIONS then log_end_msg 0 else log_end_msg 1 - exit 1 fi ;; stop ) log_daemon_msg "Stopping cryptobox webserver" "$DESC" - if start-stop-daemon --oknodo --quiet --stop \ + if start-stop-daemon --quiet --stop \ --pidfile "$PIDFILE" \ --user "$RUNAS" - then rm "$PIDFILE" + then test -e "$PIDFILE" && rm "$PIDFILE" log_end_msg 0 else log_end_msg 1 - exit 1 fi ;; reload | force-reload | restart ) @@ -85,7 +83,7 @@ case "$1" in status ) echo -n "$DESC " if start-stop-daemon --stop --signal 0 --quiet \ - --pidfile "$PIDFILE" -user "$RUNAS" + --pidfile "$PIDFILE" --user "$RUNAS" then echo "running" exit 0 else if [ -e "$PIDFILE" ] diff --git a/debian/cryptobox.lintian b/debian/cryptobox.lintian new file mode 100644 index 0000000..4942d86 --- /dev/null +++ b/debian/cryptobox.lintian @@ -0,0 +1 @@ +cryptobox: package-has-a-duplicate-relation diff --git a/debian/cryptobox.manpages b/debian/cryptobox.manpages new file mode 100644 index 0000000..70d5772 --- /dev/null +++ b/debian/cryptobox.manpages @@ -0,0 +1,2 @@ +man/CryptoBoxWebserver.8 +man/CryptoBoxRootActions.8 diff --git a/debian/postinst b/debian/postinst index 7783a81..42ae618 100644 --- a/debian/postinst +++ b/debian/postinst @@ -6,6 +6,7 @@ PID_DIR=/var/run/cryptobox CRYPTOBOX_USER=cryptobox USER_HOME=/var/cache/cryptobox SUPER_FILE=/etc/super.tab +ADDITIONAL_GROUP=disk # check the current cryptobox user - maybe it was changed if test -r /etc/default/cryptobox @@ -20,7 +21,8 @@ create_user_home() getent passwd "$CRYPTOBOX_USER" 2>/dev/null >/dev/null && return 0 # create cryptobox user echo "Creating new user '$CRYPTOBOX_USER' ..." - adduser --system --group --groups disk --home "$USER_HOME" cryptobox + adduser --system --group --home "$USER_HOME" "$CRYPTOBOX_USER" + adduser "$CRYPTOBOX_USER" "$ADDITIONAL_GROUP" mkdir -p "$USER_HOME/mnt" mkdir -p "$USER_HOME/settings" chown -R ${CRYPTOBOX_USER}: "$USER_HOME" diff --git a/debian/postrm b/debian/postrm index df322d2..fcdb53f 100644 --- a/debian/postrm +++ b/debian/postrm @@ -4,6 +4,8 @@ LOG_FILE=/var/log/cryptobox/cryptobox.log WEBLOG_FILE=/var/log/cryptobox/webserver.log PID_DIR=/var/run/cryptobox SUPER_FILE=/etc/super.tab +MNT_DIR=/var/cache/cryptobox/mnt +SETTINGS_DIR=/var/cache/cryptobox/settings remove_super_lines() { @@ -14,31 +16,45 @@ remove_super_lines() } -remove_log_files() +umount_all() +{ + test -d "$SETTINGS_DIR" && mountpoint -q "$SETTINGS_DIR" && umount "$SETTINGS_DIR" + test -d "$MNT_DIR" && ls "$MNT_DIR" | while read dir + do if test -d "$MNT_DIR/$dir" + then mountpoint -q "$MNT_DIR/$dir" && umount "$MNT_DIR/$dir" + rm -r "$MNT_DIR/$dir" + fi + done +} + + +remove_stuff() { test -e "$LOG_FILE" && rm "$LOG_FILE" - test -e "$LOG_FILE" && rm "$WEBLOG_FILE" -} - - -remove_pid_dir() -{ + test -e "$WEBLOG_FILE" && rm "$WEBLOG_FILE" test -e "$PID_DIR" && rm -r "$PID_DIR" + test -e "$SETTINGS_DIR" && rm -r "$SETTINGS_DIR" } + ################## main ################### +# umount everything that is still active +umount_all + +# remove the user if test "$1" = "purge" && getent passwd cryptobox 2>/dev/null >/dev/null \ && test "$(cd ~cryptobox;pwd)" = /var/cache/cryptobox then echo "Removing user 'cryptobox' ..." userdel -r cryptobox - remove_log_files - remove_pid_dir fi -## always remove the lines from the 'super' configuration file +# always remove the lines from the 'super' configuration file remove_super_lines +# remove obsolete files +test "$1" = "purge" && remove_stuff + #DEBHELPER# # return without error diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..dadbb97 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,4 @@ +#!/bin/sh + +#DEBHELPER# + diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..dadbb97 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,4 @@ +#!/bin/sh + +#DEBHELPER# + diff --git a/debian/rules b/debian/rules index 34f0ab0..44f7fca 100755 --- a/debian/rules +++ b/debian/rules @@ -54,13 +54,20 @@ install: build mv $(DEB_BUILD_DIR)/usr/bin/CryptoBoxWebserver $(DEB_BUILD_DIR)/usr/sbin/ mv $(DEB_BUILD_DIR)/usr/bin/CryptoBoxRootActions $(DEB_BUILD_DIR)/usr/sbin/ # remove tests - rm -rf $(CB_PYDIR)/tests + rm -r $(CB_PYDIR)/tests # remove duplicate documentation files - rm -rf $(CB_PYDIR)/share/doc + rm -r $(CB_PYDIR)/doc # move shared files - mv $(CB_PYDIR)/share $(DEB_BUILD_DIR)/usr/share/cryptobox - $(INSTALL) -d -m 755 $(DEB_BUILD_DIR)/var/log/cryptobox - $(INSTALL) -d -m 755 $(DEB_BUILD_DIR)/var/run/cryptobox + install -d -m 755 $(DEB_BUILD_DIR)/usr/share/cryptobox + mv $(CB_PYDIR)/share/* $(DEB_BUILD_DIR)/usr/share/cryptobox/ + rmdir $(CB_PYDIR)/share + # create log directory + install -d -m 755 $(DEB_BUILD_DIR)/var/log/cryptobox + # create pid directory + install -d -m 755 $(DEB_BUILD_DIR)/var/run/cryptobox + # install lintian override file: for multiple dependency caused by {python:Depends} + install -D -m 644 debian/cryptobox.lintian \ + $(DEB_BUILD_DIR)/usr/share/lintian/overrides/cryptobox # Build architecture-independent files here. @@ -74,10 +81,12 @@ binary-arch: build install dh_installdocs dh_installexamples dh_installlogrotate - dh_installinit dh_installman dh_install dh_pycentral + @# pycentral must be called before installinit - otherwise the DEBHELPER part + @# in the postinst script is filled in the wrong order + dh_installinit dh_compress dh_fixperms dh_installdeb