From 62549d8bde584228799cfc302ff6f67523c50481 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 6 Jan 2009 11:12:29 +0000 Subject: Fix rapid-client deb generation and removal: * Re-add /var/lib/rapid-tunneling . Add a placeholder file to keep it. * Fix user generation in postinst to not try again. * Delete user's home directory and remove user on purge. git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@6555 283159da-0705-0410-b60c-f2062b4bb6ad --- .placeholder | 1 + Makefile | 4 +++- debian/TODO.Debian | 3 +++ debian/prerm | 44 ----------------------------------------- debian/rapid-tunneling.install | 2 +- debian/rapid-tunneling.postinst | 4 +++- debian/rapid-tunneling.postrm | 16 +++++++++++++++ rapid-tunneling.spec | 3 ++- 8 files changed, 29 insertions(+), 48 deletions(-) create mode 100644 .placeholder delete mode 100644 debian/prerm create mode 100644 debian/rapid-tunneling.postrm diff --git a/.placeholder b/.placeholder new file mode 100644 index 0000000..6b9b8d7 --- /dev/null +++ b/.placeholder @@ -0,0 +1 @@ +An empty directory is not possible with .deb packages diff --git a/Makefile b/Makefile index 988aa0b..5d0e520 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SPEC = rapid-tunneling.spec SCRIPTS = rapid-tunneling rapid-tunneling-status rtadm rt-from-remote CONFIGS = rtadm.config sshd_support_config support_env INIT_D = sshd_support -SOURCES = Makefile $(SPEC) $(SCRIPTS) $(CONFIGS) $(INIT_D) +SOURCES = Makefile $(SPEC) $(SCRIPTS) $(CONFIGS) $(INIT_D) .placeholder SBINDIR = /usr/sbin BINDIR = /usr/share/rapid-tunneling/bin @@ -51,6 +51,8 @@ install: install -m 644 rtadm.config $(DESTDIR)/etc/rapid-tunneling/rtadm install -m 755 -d $(DESTDIR)/etc/ssh install -m 644 sshd_support_config $(DESTDIR)/etc/ssh/ + install -m 755 -d $(DESTDIR)/var/lib/rapid-tunneling + install -m 644 .placeholder $(DESTDIR)/var/lib/rapid-tunneling/ .PHONY: clean dummy dummy: diff --git a/debian/TODO.Debian b/debian/TODO.Debian index ed0dcc2..5453396 100644 --- a/debian/TODO.Debian +++ b/debian/TODO.Debian @@ -3,3 +3,6 @@ not. If we do, we must use the current useradd command. If we don't: use adduser. The web interface only assumes that there's such a user. + + +* Do we delete users on purge? diff --git a/debian/prerm b/debian/prerm deleted file mode 100644 index 1ac9c16..0000000 --- a/debian/prerm +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# prerm script for rapid-tunneling -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - remove) - userdel -r rapid-tunneling || : - ;; - - upgrade) - ;; - - failed-upgrade) - ;; - - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 - - diff --git a/debian/rapid-tunneling.install b/debian/rapid-tunneling.install index ca4453e..100fe09 100644 --- a/debian/rapid-tunneling.install +++ b/debian/rapid-tunneling.install @@ -1,3 +1,3 @@ usr/sbin/rapid-tunneling usr/sbin/rapid-tunneling-status - +var/lib/rapid-tunneling diff --git a/debian/rapid-tunneling.postinst b/debian/rapid-tunneling.postinst index 5fdc023..bebf14f 100644 --- a/debian/rapid-tunneling.postinst +++ b/debian/rapid-tunneling.postinst @@ -21,7 +21,9 @@ set -e case "$1" in configure) # add a user with uid=gid=0 - useradd -d /var/lib/rapid-tunneling/home -m -u 0 -g 0 -o rapid-tunneling 2>/dev/null || true + if ! getent passwd rapid-tunneling >/dev/null ; then + useradd -d /var/lib/rapid-tunneling/home -m -u 0 -g 0 -o rapid-tunneling + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/rapid-tunneling.postrm b/debian/rapid-tunneling.postrm new file mode 100644 index 0000000..89276e5 --- /dev/null +++ b/debian/rapid-tunneling.postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +case "$1" in + purge) + userdel -r rapid-tunneling || : + rm -rf /var/lib/rapid-tunneling/home + ;; +esac + +#DEBHELPER# + +exit 0 + + diff --git a/rapid-tunneling.spec b/rapid-tunneling.spec index 8009508..7e342ce 100644 --- a/rapid-tunneling.spec +++ b/rapid-tunneling.spec @@ -71,10 +71,11 @@ fi %defattr(-, root, root, 0755) %config(noreplace) /etc/rapid-tunneling/rtadm %config(noreplace) /etc/ssh/sshd_support_config +%config /etc/init.d/sshd_support %{_datadir}/rapid-tunneling/support_env %{_datadir}/rapid-tunneling/bin/rtadm %{_datadir}/rapid-tunneling/bin/rt-from-remote -/etc/init.d/sshd_support +/var/lib/rapid-tunneling %changelog * Sun Dec 14 2008 Alex Landau 1.0-1 -- cgit v1.2.3