core/systemd/systemd.install

51 lines
942 B
Plaintext
Raw Normal View History

2012-02-17 03:28:16 +08:00
#!/bin/sh
2011-06-17 20:40:10 +08:00
checkgroups() {
2012-02-17 03:28:16 +08:00
if ! getent group lock >/dev/null; then
groupadd -g 54 lock
fi
}
sd_booted() {
[ -e sys/fs/cgroups/systemd ]
2011-06-17 20:40:10 +08:00
}
post_install() {
checkgroups
2012-02-17 03:28:16 +08:00
if [ ! -f etc/machine-id ]; then
systemd-machine-id-setup
fi
2011-06-17 20:40:10 +08:00
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
2012-02-17 03:28:16 +08:00
if [ ! -f etc/machine-id ]; then
systemd-machine-id-setup
fi
if sd_booted; then
systemctl daemon-reexec >/dev/null
fi
newpkgver=${1%-*}
oldpkgver=${2%-*}
2011-06-17 20:40:10 +08:00
2012-02-17 03:28:16 +08:00
# 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
2011-06-17 20:40:10 +08:00
}
post_remove() {
2012-02-17 03:28:16 +08:00
if getent group lock >/dev/null; then
groupdel lock
fi
2011-06-17 20:40:10 +08:00
}