diff options
Diffstat (limited to 'community/systemd/systemd.install')
-rw-r--r-- | community/systemd/systemd.install | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/community/systemd/systemd.install b/community/systemd/systemd.install index 7ec58682a..34f902276 100644 --- a/community/systemd/systemd.install +++ b/community/systemd/systemd.install @@ -1,13 +1,21 @@ #!/bin/sh checkgroups() { - getent group lock >/dev/null || groupadd -g 54 lock + if usr/bin/getent group lock >/dev/null; then + usr/sbin/groupadd -g 54 lock + fi +} + +sd_booted() { + [ -e sys/fs/cgroups/systemd ] } post_install() { checkgroups - [ -f /etc/machine-id ] || systemd-machine-id-setup + if [ -f etc/machine-id ]; then + bin/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." @@ -16,16 +24,28 @@ post_install() { post_upgrade() { checkgroups - [ -f /etc/machine-id ] || systemd-machine-id-setup - systemctl daemon-reexec >/dev/null || : -} + if [ -f etc/machine-id ]; then + bin/systemd-machine-id-setup + fi + + if sd_booted; then + bin/systemctl daemon-reexec >/dev/null + fi + + newpkgver=${1%-*} + oldpkgver=${2%-*} -pre_remove() { - rm -f /etc/systemd/system/default.target + # 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 + bin/systemctl try-restart systemd-logind.service + fi + fi } post_remove() { - getent group lock >/dev/null && groupdel lock + usr/bin/getent group lock >/dev/null && usr/sbin/groupdel lock } # vim:set ts=2 sw=2 et: |