From c7cb603f86b4d4fb6567e3faa15b916a306f7004 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Apr 2012 00:01:35 +0000 Subject: Tue Apr 3 00:01:35 UTC 2012 --- testing/systemd/systemd.install | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 testing/systemd/systemd.install (limited to 'testing/systemd/systemd.install') diff --git a/testing/systemd/systemd.install b/testing/systemd/systemd.install new file mode 100644 index 000000000..822108c0f --- /dev/null +++ b/testing/systemd/systemd.install @@ -0,0 +1,54 @@ +#!/bin/sh + +checkgroups() { + if ! getent group lock >/dev/null; then + groupadd -g 54 lock + fi +} + +sd_booted() { + [ -e sys/fs/cgroup/systemd ] +} + +post_install() { + checkgroups + + if [ ! -f etc/machine-id ]; then + systemd-machine-id-setup + fi + + echo "systemd has been installed to /bin/systemd. Please ensure you append" + echo "init=/bin/systemd to your kernel command line in your bootloader." +} + +post_upgrade() { + checkgroups + + if [ ! -f etc/machine-id ]; then + systemd-machine-id-setup + fi + + if sd_booted; then + systemctl daemon-reload + systemctl daemon-reexec + fi + + newpkgver=${1%-*} + oldpkgver=${2%-*} + + # catch v31 need for restarting systemd-logind.service + if [ "$newpkgver" -ge 31 ] && [ "$oldpkgver" -lt 31 ]; then + # but only if systemd is running + if sd_booted; then + systemctl try-restart systemd-logind.service + fi + fi +} + +post_remove() { + if getent group lock >/dev/null; then + groupdel lock + fi +} + +# vim:set ts=2 sw=2 et: -- cgit v1.2.3-54-g00ecf