PKGBUILDs/core/systemd/systemd.install
2024-10-09 10:35:12 +00:00

66 lines
1.6 KiB
Bash

#!/bin/bash
sd_booted() {
[[ -d run/systemd/system && ! -L run/systemd/system ]]
}
post_common() {
systemd-sysusers
journalctl --update-catalog
if ! grep -qe '^/usr/bin/systemd-home-fallback-shell$' etc/shells; then
echo '/usr/bin/systemd-home-fallback-shell' >> etc/shells
fi
}
post_install() {
systemd-machine-id-setup
post_common "$@"
# enable some services by default, but don't track them
systemctl enable \
getty@tty1.service \
remote-fs.target \
systemd-userdbd.socket
echo ":: Append 'init=/usr/lib/systemd/systemd' to your kernel command line in your"
echo " bootloader to replace sysvinit with systemd, or install systemd-sysvcompat"
# group 'systemd-journal-remote' is created by systemd-sysusers
mkdir -m2755 var/log/journal/remote
chgrp systemd-journal-remote var/log/journal/remote
}
post_upgrade() {
post_common "$@"
if sd_booted; then
systemctl --system daemon-reexec
systemctl kill --kill-whom='main' --signal='SIGRTMIN+25' 'user@*.service'
fi
# show for feature release: 255 -> 256 -> 257 -> ...
if [ $(vercmp "${1%%[!0-9]*}" "${2%%[!0-9]*}") -ne 0 ]; then
cat <<-EOM
:: This is a systemd feature update. You may want to have a look at
NEWS for what changed, or if you observe unexpected behavior:
/usr/share/doc/systemd/NEWS
EOM
fi
local v upgrades=(
)
for v in "${upgrades[@]}"; do
if [[ $(vercmp "$v" "$2") -eq 1 ]]; then
"_${v//[.-]/_}_changes"
fi
done
}
post_remove() {
sed -i -r '/^\/usr\/bin\/systemd-home-fallback-shell$/d' etc/shells
}
# vim:set ts=2 sw=2 et: