PKGBUILDs/core/systemd/systemd.install

105 lines
2.3 KiB
Text
Raw Normal View History

2014-07-16 02:33:04 +00:00
#!/bin/bash
sd_booted() {
2014-08-27 06:22:24 +00:00
[[ -d run/systemd/system && ! -L run/systemd/system ]]
2014-07-16 02:33:04 +00:00
}
add_journal_acls() {
# ignore errors, since the filesystem might not support ACLs
setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx var/log/journal/ 2>/dev/null
:
}
post_common() {
2014-08-27 06:22:24 +00:00
systemd-sysusers
2014-07-16 02:33:04 +00:00
journalctl --update-catalog
}
2014-09-03 00:17:53 +00:00
_216_2_changes() {
2014-08-27 06:22:24 +00:00
echo ':: Coredumps are handled by systemd by default. Collection behavior can be'
echo ' tuned in /etc/systemd/coredump.conf.'
}
2015-04-19 14:43:25 +00:00
_219_2_changes() {
if mkdir -m2755 var/log/journal/remote 2>/dev/null; then
chgrp systemd-journal-remote var/log/journal/remote
fi
}
_219_4_changes() {
if ! systemctl is-enabled -q remote-fs.target; then
systemctl enable -q remote-fs.target
fi
}
2016-07-20 13:31:52 +00:00
_230_1_changes() {
echo ':: systemd-bootchart is no longer included with systemd'
}
2017-02-01 00:54:16 +00:00
_232_8_changes() {
# paper over possible effects of CVE-2016-10156
local stamps=(/var/lib/systemd/timers/*.timer)
if [[ -f ${stamps[0]} ]]; then
chmod 0644 "${stamps[@]}"
fi
}
2017-07-06 12:27:58 +00:00
_233_75_3_changes() {
# upstream installs services to /etc, which we remove
# to keep bus activation we re-enable systemd-resolved
if systemctl is-enabled -q systemd-resolved.service; then
2017-07-07 00:21:50 +00:00
systemctl reenable systemd-resolved.service 2>/dev/null
2017-07-06 12:27:58 +00:00
fi
}
2019-04-23 23:53:51 +00:00
_242_1_changes() {
rm -rf /var/lib/systemd/timesync /var/lib/private/systemd/timesync
}
2014-07-16 02:33:04 +00:00
post_install() {
2015-02-17 04:46:29 +00:00
systemd-machine-id-setup
2014-08-27 06:22:24 +00:00
2014-07-16 02:33:04 +00:00
post_common "$@"
add_journal_acls
2015-04-19 14:43:25 +00:00
# enable some services by default, but don't track them
systemctl enable getty@tty1.service remote-fs.target
2014-07-16 02:33:04 +00:00
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"
2015-04-19 14:43:25 +00:00
# group 'systemd-journal-remote' is created by systemd-sysusers
mkdir -m2755 var/log/journal/remote
chgrp systemd-journal-remote var/log/journal/remote
2014-07-16 02:33:04 +00:00
}
post_upgrade() {
post_common "$@"
2016-10-09 21:16:33 +00:00
# don't reexec if the old version is 231-1 or 231-2.
# https://github.com/systemd/systemd/commit/bd64d82c1c
if [[ $1 != 231-[12] ]] && sd_booted; then
systemctl --system daemon-reexec
fi
2014-07-16 02:33:04 +00:00
2016-07-20 13:31:52 +00:00
local v upgrades=(
216-2
219-2
219-4
230-1
2017-02-01 00:54:16 +00:00
232-8
2017-07-06 12:27:58 +00:00
233.75-3
2019-04-23 23:53:51 +00:00
242-1
2016-07-20 13:31:52 +00:00
)
2014-07-16 02:33:04 +00:00
for v in "${upgrades[@]}"; do
if [[ $(vercmp "$v" "$2") -eq 1 ]]; then
2017-07-06 12:27:58 +00:00
"_${v//[.-]/_}_changes"
2014-07-16 02:33:04 +00:00
fi
done
}
# vim:set ts=2 sw=2 et: