summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-24 06:37:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-11-18 08:09:13 +0000
commit8c4f82ba965285cac6268aa5616fe4130c27eee4 (patch)
treee2ba0f7e30bb34b373afe5f4dec4206b187c1e77
parentAdding conflicts against resolvconf in progress-linux-base. (diff)
downloadprogress-linux-metapackages-8c4f82ba965285cac6268aa5616fe4130c27eee4.tar.xz
progress-linux-metapackages-8c4f82ba965285cac6268aa5616fe4130c27eee4.zip
Diverting shutdown commands in progress-linux-container package.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--debian/control6
-rwxr-xr-xdebian/local/shutdown13
-rw-r--r--debian/local/shutdown.txt6
-rwxr-xr-xdebian/progress-linux-container.postrm30
-rwxr-xr-xdebian/progress-linux-container.preinst32
-rwxr-xr-xdebian/rules18
6 files changed, 104 insertions, 1 deletions
diff --git a/debian/control b/debian/control
index f9e8758..9ce0fa5 100644
--- a/debian/control
+++ b/debian/control
@@ -76,6 +76,10 @@ Depends:
dbus,
policykit-1,
systemd-sysv,
+Conflicts:
+ molly-guard,
+Replaces:
+ molly-guard,
Enhances:
progress-linux,
progress-linux-base-system,
@@ -283,7 +287,7 @@ Depends:
# Other
localepurge,
logrotate,
- molly-guard,
+ molly-guard | progress-linux-container,
postfix,
Enhances:
progress-linux,
diff --git a/debian/local/shutdown b/debian/local/shutdown
new file mode 100755
index 0000000..16ee5ed
--- /dev/null
+++ b/debian/local/shutdown
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+echo "${0}: disabled in systemd-nspawn container"
+
+if [ -e /etc/open-infrastructure/container/shutdown.txt ]
+then
+ cat /etc/open-infrastructure/container/shutdown.txt
+elif [ -e /usr/share/open-infrastructure/container/shutdown.txt ]
+then
+ cat /usr/share/open-infrastructure/container/shutdown.txt
+fi
+
+exit 1
diff --git a/debian/local/shutdown.txt b/debian/local/shutdown.txt
new file mode 100644
index 0000000..b082bf0
--- /dev/null
+++ b/debian/local/shutdown.txt
@@ -0,0 +1,6 @@
+
+Linux container share the kernel of the host system they are running on,
+there is no need to reboot just the container.
+
+However, please contact your system administrator to reboot this
+container from the host system.
diff --git a/debian/progress-linux-container.postrm b/debian/progress-linux-container.postrm
new file mode 100755
index 0000000..e927124
--- /dev/null
+++ b/debian/progress-linux-container.postrm
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+ remove)
+ for FILE in halt poweroff reboot shutdown coldreboot
+ do
+ dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /sbin/${FILE}
+ done
+
+ for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
+ do
+ dpkg-divert --package progress-linux-container --quiet --remove --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /usr/sbin/${FILE}
+ done
+ ;;
+
+ purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/progress-linux-container.preinst b/debian/progress-linux-container.preinst
new file mode 100755
index 0000000..a6a563a
--- /dev/null
+++ b/debian/progress-linux-container.preinst
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+ install)
+ mkdir -p /lib/open-infrastructure/container/divert
+
+ for FILE in halt poweroff reboot shutdown coldreboot
+ do
+ dpkg-divert --package progress-linux-container --quiet --add --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /sbin/${FILE}
+ done
+
+ for FILE in pm-hibernate pm-suspend pm-suspend-hybrid
+ do
+ dpkg-divert --package progress-linux-container --quiet --add --rename --divert /lib/open-infrastructure/container/divert/${FILE}.orig /usr/sbin/${FILE}
+ done
+ ;;
+
+ abort-upgrade|upgrade)
+
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
index 55e8663..180be56 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,11 +1,29 @@
#!/usr/bin/make -f
+SHELL := sh -e
+
%:
dh ${@}
override_dh_auto_install:
dh_auto_install -- DESTDIR=$(CURDIR)/debian/progress-linux-base-system
+ # shutdown
+ mkdir -p debian/progress-linux-container/sbin
+ for FILE in halt poweroff reboot shutdown coldreboot; \
+ do \
+ cp debian/local/shutdown debian/progress-linux-container/sbin/$${FILE}; \
+ done
+
+ mkdir -p debian/progress-linux-container/usr/sbin
+ for FILE in pm-hibernate pm-suspend pm-suspend-hybrid; \
+ do \
+ cp debian/local/shutdown debian/progress-linux-container/usr/sbin/$${FILE}; \
+ done
+
+ mkdir -p debian/progress-linux-container/usr/share/open-infrastructure/container
+ cp debian/local/shutdown.txt debian/progress-linux-container/usr/share/open-infrastructure/container
+
# removing useless files
rm -f debian/tmp/usr/share/doc/*/CHANGELOG.txt
rm -f debian/tmp/usr/share/doc/*/LICENSE.txt