2015-07-09 12:29:57 +08:00
|
|
|
#!/bin/bash
|
2012-09-09 12:17:16 +08:00
|
|
|
|
|
|
|
sd_booted() {
|
2014-08-27 05:16:45 +08:00
|
|
|
[[ -d run/systemd/system && ! -L run/systemd/system ]]
|
2012-09-09 12:17:16 +08:00
|
|
|
}
|
2014-02-27 05:35:16 +08:00
|
|
|
|
|
|
|
add_journal_acls() {
|
|
|
|
# ignore errors, since the filesystem might not support ACLs
|
2015-07-09 12:29:57 +08:00
|
|
|
setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx var/log/journal/ 2>/dev/null
|
2014-02-27 05:35:16 +08:00
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_reexec() {
|
2012-10-28 05:07:32 +08:00
|
|
|
if sd_booted; then
|
|
|
|
systemctl --system daemon-reexec
|
|
|
|
fi
|
2014-02-27 05:35:16 +08:00
|
|
|
}
|
2012-09-09 12:17:16 +08:00
|
|
|
|
2014-02-27 05:35:16 +08:00
|
|
|
post_common() {
|
2014-08-27 05:16:45 +08:00
|
|
|
systemd-sysusers
|
2012-11-22 07:30:08 +08:00
|
|
|
journalctl --update-catalog
|
2014-06-28 23:21:36 +08:00
|
|
|
}
|
|
|
|
|
2014-08-27 05:16:45 +08:00
|
|
|
_216_changes() {
|
|
|
|
# create at least the symlink from /etc/os-release to /usr/lib/os-release
|
|
|
|
systemd-tmpfiles --create etc.conf
|
|
|
|
|
|
|
|
echo ':: Coredumps are handled by systemd by default. Collection behavior can be'
|
|
|
|
echo ' tuned in /etc/systemd/coredump.conf.'
|
|
|
|
}
|
|
|
|
|
2015-07-09 12:29:57 +08:00
|
|
|
_219_changes() {
|
|
|
|
if mkdir -m2755 var/log/journal/remote 2>/dev/null; then
|
|
|
|
chgrp systemd-journal-remote var/log/journal/remote
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! systemctl is-enabled -q remote-fs.target; then
|
|
|
|
systemctl enable -q remote-fs.target
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-02-27 05:35:16 +08:00
|
|
|
post_install() {
|
2015-07-09 12:29:57 +08:00
|
|
|
systemd-machine-id-setup
|
|
|
|
|
2014-02-27 05:35:16 +08:00
|
|
|
post_common "$@"
|
|
|
|
|
|
|
|
add_journal_acls
|
|
|
|
|
2015-07-09 12:29:57 +08:00
|
|
|
# enable some services by default, but don't track them
|
|
|
|
systemctl enable getty@tty1.service remote-fs.target
|
|
|
|
|
|
|
|
# group 'systemd-journal-remote' is created by systemd-sysusers
|
|
|
|
mkdir -m2755 var/log/journal/remote
|
|
|
|
chgrp systemd-journal-remote var/log/journal/remote
|
2012-09-09 12:17:16 +08:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:35:16 +08:00
|
|
|
post_upgrade() {
|
|
|
|
post_common "$@"
|
|
|
|
|
|
|
|
maybe_reexec "$@"
|
|
|
|
|
2016-11-10 06:26:55 +08:00
|
|
|
local v upgrades=(216
|
|
|
|
219
|
|
|
|
)
|
2014-02-27 05:35:16 +08:00
|
|
|
|
2015-07-09 12:29:57 +08:00
|
|
|
for v in "${upgrades[@]}"; do
|
|
|
|
if [[ $(vercmp "$v" "$2") -eq 1 ]]; then
|
|
|
|
"_${v//-/_}_changes"
|
|
|
|
fi
|
|
|
|
done
|
2014-02-27 05:35:16 +08:00
|
|
|
}
|