diff options
author | Britney Fransen <brfransen@gmail.com> | 2015-08-07 18:56:23 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2015-08-07 18:56:23 (GMT) |
commit | bc3c70f5ecf22018224f20ed9add8799de133194 (patch) | |
tree | 561dc933c84577b4aeebf5ed7ef9725e6a43dc40 /abs/core/systemd/systemd.install | |
parent | 7e9d5ed1e5eeefe36fed0522dc993e76d29587c8 (diff) | |
download | linhes_pkgbuild-bc3c70f5ecf22018224f20ed9add8799de133194.zip linhes_pkgbuild-bc3c70f5ecf22018224f20ed9add8799de133194.tar.gz linhes_pkgbuild-bc3c70f5ecf22018224f20ed9add8799de133194.tar.bz2 |
systemd: update to 224
Diffstat (limited to 'abs/core/systemd/systemd.install')
-rw-r--r-- | abs/core/systemd/systemd.install | 225 |
1 files changed, 155 insertions, 70 deletions
diff --git a/abs/core/systemd/systemd.install b/abs/core/systemd/systemd.install index 1e79585..b0a3e1f 100644 --- a/abs/core/systemd/systemd.install +++ b/abs/core/systemd/systemd.install @@ -1,7 +1,7 @@ -#!/bin/sh +#!/bin/bash sd_booted() { - [ -e sys/fs/cgroup/systemd ] + [[ -d run/systemd/system && ! -L run/systemd/system ]] } add_privs() { @@ -11,110 +11,195 @@ add_privs() { fi } -post_common() { - systemd-machine-id-setup - - add_privs usr/bin/systemd-detect-virt 'cap_dac_override,cap_sys_ptrace+ep' +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 + : +} - udevadm hwdb --update - journalctl --update-catalog +maybe_reexec() { + # don't reexec on 209-1 upgrade due to large infrastructural changes. + if [[ $(vercmp 209-1 "$2") -eq 1 ]]; then + echo ':: systemd has not been reexecuted. It is recommended that you' + echo ' reboot at your earliest convenience.' + return + fi if sd_booted; then systemctl --system daemon-reexec fi } -mask_net_naming() { - if [ ! -e etc/udev/rules.d/80-net-name-slot.rules ]; then - printf >etc/udev/rules.d/80-net-name-slot.rules '# %s\n' \ - "This file masks persistent renaming rules for network devices. If you" \ - "delete this file, /usr/lib/udev/rules.d/80-net-name-slot.rules may" \ - "rename network devices according to ID_NET_NAME_{ONBOARD,SLOT,PATH}" \ - "properties of your network devices, with priority in that order. See" \ - "the output of 'udevadm test-builtin net_id /sys/class/net/\$interface'" \ - "for details on what that new name might be." \ - "" \ - "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames" - fi +_dir_empty() { + set -- "$1"/* + [[ ! -e $1 && ! -L $1 ]] } -_208_changes() { - chown root:systemd-journal var/log/journal - chmod 2755 var/log/journal +post_common() { + systemd-sysusers + udevadm hwdb --update + journalctl --update-catalog +} - if [ -e var/lib/backlight ] && [ ! -e var/lib/systemd/backlight ]; then +_204_1_changes() { + printf '==> The /bin/systemd symlink has been removed. Any references in your\n' + printf ' bootloader (or elsewhere) must be updated to /usr/lib/systemd/systemd.\n' +} + +_205_1_changes() { + printf '==> systemd 205 restructures the cgroup hierarchy and changes internal\n' + printf ' protocols. You should reboot at your earliest convenience.\n' +} + +_206_1_changes() { + printf '==> The "timestamp" hook for mkinitcpio no longer exists. If you used\n' + printf ' this hook, you must remove it from /etc/mkinitcpio.conf. A "systemd"\n' + printf ' hook has been added which provides this functionality, and more.\n' +} + +_208_1_changes() { + if [[ -e var/lib/backlight && ! -e var/lib/systemd/backlight ]]; then mv -T var/lib/backlight var/lib/systemd/backlight fi - if [ -e var/lib/random-seed ] && [ ! -e var/lib/systemd/random-seed ]; then + if [[ -e var/lib/random-seed && ! -e var/lib/systemd/random-seed ]]; then mv -T var/lib/random-seed var/lib/systemd/random-seed fi } -post_install() { - post_common +_208_8_changes() { + add_journal_acls +} - # enable getty@tty1 by default, but don't track the file - systemctl enable getty@tty1.service +_209_1_changes() { + # attempt to preserve existing behavior - 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" + local old_rule=etc/udev/rules.d/80-net-name-slot.rules + local new_rule=etc/udev/rules.d/80-net-setup-link.rules + + echo ":: Network device naming is now controlled by udev's net_setup_link" + echo " builtin. Refer to the systemd.link manpage for a full description." + + # not clear what action we can take here, so don't do anything + [[ -e $new_rule ]] && return 0 + + # rename the old rule to the new one so that we preserve the user's + # existing option. + if [[ -e $old_rule ]]; then + printf ':: Renaming %s to %s in order\n' "${old_rule##*/}" "${new_rule##*/}" + printf ' to preserve existing network naming behavior.\n' + mv -v "$old_rule" "$new_rule" + else + echo ':: No changes have been made to your network naming configuration.' + echo ' Interfaces should continue to maintain the same names.' + fi } -post_upgrade() { - post_common - - # getty@tty1.service is no longer enabled by default, but we don't want to break - # existing setups. - if [ "$(vercmp 183 "$2")" -eq 1 ]; then - # systemctl seems to be whiny on sysvinit. this will succeed unless something - # horrific happens, so just mask the error. - systemctl -q enable getty@tty1.service || true +_210_1_changes() { + if sd_booted; then + # If /etc/systemd/network is non-empty, then this is a 209 user who used + # networkd. Re-enable it for them. + if ! _dir_empty etc/systemd/network; then + systemctl enable systemd-networkd + fi fi +} - if [ "$(vercmp 194-4 "$2")" -eq 1 ]; then - printf '==> journald now writes to /var/log/journal by default. This can be\n' - printf ' controlled with the Storage setting in /etc/systemd/journald.conf\n' +_213_4_changes() { + if sd_booted; then + # if /etc/resolv.conf is a symlink, just assume that it was being managed + # by systemd-networkd, and re-enable systemd-resolved. + if [[ -L etc/resolv.conf ]]; then + systemctl enable systemd-resolved + fi fi +} + +_214_2_changes() { + # /run/systemd/network/resolv.conf -> /run/systemd/resolve/resolv.conf + if [[ etc/resolv.conf -ef run/systemd/network/resolv.conf ]]; then + ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf - # logind's protocol changed. kindly restart the daemon to avoid locking - # out further logins. - if [ "$(vercmp 195 "$2")" -eq 1 ]; then if sd_booted; then - systemctl restart systemd-logind.service + if [[ ! -d run/systemd/resolve ]]; then + mkdir run/systemd/resolve + fi + + if [[ -f run/systemd/network/resolv.conf ]]; then + mv run/systemd/{network,resolve}/resolv.conf + fi fi fi - if [ "$(vercmp 196-1 "$2")" -eq 1 ]; then - printf '==> The legacy configuration options are no longer supported in rc.conf,\n' - printf ' convert your rc.conf to the new configuration formats.\n' - fi + echo ':: coredumps are no longer sent to the journal by default. To re-enable:' + echo ' echo >/etc/sysctl.d/50-coredump.conf \' + echo ' "kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e"' +} - if [ "$(vercmp 197-1 "$2")" -eq 1 ]; then - mask_net_naming - printf '==> Persistent net naming rules have been shipped as disabled.\n' - printf ' See /etc/udev/rules.d/80-net-name-slot.rules for more detail\n' - fi +_215_2_changes() { + # create at least the symlink from /etc/os-release to /usr/lib/os-release + systemd-tmpfiles --create etc.conf +} - if [ "$(vercmp 204-1 "$2")" -eq 1 ]; then - printf '==> The /bin/systemd symlink has been removed. Any references in your\n' - printf ' bootloader (or elsewhere) must be updated to /usr/lib/systemd/systemd.\n' - fi +_216_2_changes() { + echo ':: Coredumps are handled by systemd by default. Collection behavior can be' + echo ' tuned in /etc/systemd/coredump.conf.' +} - if [ "$(vercmp 205-1 "$2")" -eq 1 ]; then - printf '==> systemd 205 restructures the cgroup hierarchy and changes internal\n' - printf ' protocols. You should reboot at your earliest convenience.\n' +_219_2_changes() { + if mkdir -m2755 var/log/journal/remote 2>/dev/null; then + chgrp systemd-journal-remote var/log/journal/remote fi +} - if [ "$(vercmp 206-1 "$2")" -eq 1 ]; then - printf '==> The "timestamp" hook for mkinitcpio no longer exists. If you used\n' - printf ' this hook, you must remove it from /etc/mkinitcpio.conf. A "systemd"\n' - printf ' hook has been added which provides this functionality, and more.\n' +_219_4_changes() { + if ! systemctl is-enabled -q remote-fs.target; then + systemctl enable -q remote-fs.target fi +} - if [ "$(vercmp 208-1 "$2")" -eq 1 ]; then - _208_changes - 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 + + 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 "$@" + + maybe_reexec "$@" + + local v upgrades=(204-1 + 205-1 + 206-1 + 208-1 + 208-8 + 209-1 + 210-1 + 213-4 + 214-2 + 215-2 + 216-2 + 219-2 + 219-4) + + for v in "${upgrades[@]}"; do + if [[ $(vercmp "$v" "$2") -eq 1 ]]; then + "_${v//-/_}_changes" + fi + done } # vim:set ts=2 sw=2 et: |