core/systemd/systemd.install
2017-11-10 07:16:50 +00:00

92 lines
2.1 KiB
Bash

#!/bin/bash
sd_booted() {
[[ -d run/systemd/system && ! -L run/systemd/system ]]
}
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
:
}
maybe_reexec() {
if sd_booted; then
systemctl --system daemon-reexec
fi
}
post_common() {
systemd-sysusers
journalctl --update-catalog
}
_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.'
}
_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
}
post_install() {
systemd-machine-id-setup
post_common "$@"
add_journal_acls
# 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
}
# Do not remove this. otherwise next reboot will have mismatched systemd,
# which may make system fail to start some services. Unless we have proper
# hook in pacman (not yet because it's in pacman 5).
update_image() {
if which mkinitcpio >/dev/null 2>&1; then
echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
echo ">>> If you are using non-default kernel, you should update kernel"
echo ">>> manually"
if [ -f etc/mkinitcpio.d/linux-CHAKRA.preset ]; then
mkinitcpio -p linux-CHAKRA
fi
if [ -f etc/mkinitcpio.d/linux-CHAKRA-LTS.preset ]; then
mkinitcpio -p linux-CHAKRA-LTS
fi
fi
}
post_upgrade() {
post_common "$@"
maybe_reexec "$@"
local v upgrades=(216
219
)
for v in "${upgrades[@]}"; do
if [[ $(vercmp "$v" "$2") -eq 1 ]]; then
"_${v//-/_}_changes"
fi
done
update_image
}