From 14eae05c4d91afab0bd404c781b8cd648b27bc4e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 15 Apr 2011 18:32:57 +0200 Subject: initial commit --- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 16 ++++++++++++++++ debian/copyright | 2 ++ debian/install | 1 + debian/postinst | 31 +++++++++++++++++++++++++++++++ debian/prerm | 36 ++++++++++++++++++++++++++++++++++++ debian/rules | 13 +++++++++++++ debian/source/format | 1 + debian/triggers | 1 + vserver-teardown.patch | 33 +++++++++++++++++++++++++++++++++ 11 files changed, 140 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/install create mode 100644 debian/postinst create mode 100644 debian/prerm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/triggers create mode 100644 vserver-teardown.patch diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..98d5c6e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +autopatch-util-vserver (0.1-1) unstable; urgency=low + + * Initial release + + -- Alexander Sulfrian Fri, 15 Apr 2011 17:54:06 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..4314f8a --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: autopatch-util-vserver +Section: unknown +Priority: extra +Maintainer: Alexander Sulfrian +Build-Depends: debhelper (>= 7.0.50~) +Standards-Version: 3.8.4 +Homepage: http://git.animux.de/autopatch-util-vserver.git +Vcs-Git: git://git.animux.de/autopatch-util-vserver.git +Vcs-Browser: http://git.animux.de/autopatch-util-vserver.git + +Package: autopatch-util-vserver +Architecture: any +Depends: util-vserver +Description: This package is a personal patch for util-vserver to add + a teardown script, executed after the destruction of the + vserver namespace. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..b13917c --- /dev/null +++ b/debian/copyright @@ -0,0 +1,2 @@ +Copyright: 2011 Alexander Sulfrian +License: as-is diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..9f0d6f5 --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +vserver-teardown.patch /usr/share/autopatch-util-vserver/ diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..bfc92e3 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,31 @@ +#!/bin/sh +# postinst script for autopatch-util-vserver +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +test "$1" == "configure" -o "$1" == "triggered" && { + mkdir -p /var/lib/autopatch-util-vserver/backup/ + cp -a /usr/sbin/vserver /var/lib/autopatch-util-vserver/backup/vserver + patch -f -p 0 < /usr/share/autopatch-util-vserver/vserver-teardown.patch +} + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..7b190c6 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,36 @@ +#!/bin/sh +# prerm script for autopatch-util-vserver +# +# 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|upgrade|deconfigure|failed-upgrade) + test -r /var/lib/autopatch-util-vserver/backup/vserver && \ + mv /var/lib/autopatch-util-vserver/backup/vserver /usr/sbin/vserver + ;; + + *) + 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/rules b/debian/rules new file mode 100755 index 0000000..b760bee --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/triggers b/debian/triggers new file mode 100644 index 0000000..5147346 --- /dev/null +++ b/debian/triggers @@ -0,0 +1 @@ +interest /usr/sbin/vserver diff --git a/vserver-teardown.patch b/vserver-teardown.patch new file mode 100644 index 0000000..a9ca0d9 --- /dev/null +++ b/vserver-teardown.patch @@ -0,0 +1,33 @@ +--- /usr/sbin/vserver 2011-04-07 16:39:34.000000000 +0200 ++++ /usr/sbin/vserver 2011-04-07 19:50:45.000000000 +0200 +@@ -203,16 +203,27 @@ + test "$cmd" != start -o -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \ + exec $_VNAMESPACE --new -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}" + ++. $__PKGLIBDIR/vserver.functions ++ + # Enter the namespace early so we can test for files inside the guest + test "$cmd" != enter -a "$cmd" != stop || \ + test -n "$OPTION_NONAMESPACE" || isAvoidNamespace "$VSERVER_DIR" || \ +- ! isVserverRunning "$VSERVER_DIR" || \ +- exec $_VNAMESPACE --enter "$VSERVER_DIR" -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}" ++ ! isVserverRunning "$VSERVER_DIR" || { ++ $_VNAMESPACE --enter "$VSERVER_DIR" -- $_VSERVER ----nonamespace "${OPTIONS_ORIG[@]}" ++ result=$? ++ ++ if test "$cmd" == "stop" ; then ++ pushd "$VSERVER_DIR" > /dev/null ++ execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" teardown ++ popd > /dev/null ++ fi ++ ++ exit $result ++ } + + set_init_cwd + cd / + +-. $__PKGLIBDIR/vserver.functions + case "$2" in + (start|stop|delete) + shift 2 -- cgit v1.2.3-1-g7c22