#!/bin/bash set -eux [ "$(id -u)" = "0" ] trap "echo FAIL" ERR # order doesn't matter packages=(rsyslog busybox-syslogd) # packages=(busybox-syslogd rsyslog) # sid behavior: # Removed "/etc/systemd/system/syslog.service". # mantic/bookworm behavior: # Failed to preset unit, file "/etc/systemd/system/syslog.service" already # exists and is a symlink to "/lib/systemd/system/rsyslog.service". # /usr/bin/deb-systemd-helper: error: systemctl preset failed on # busybox-syslogd.service: No such file or directory first=${packages[0]} second=${packages[1]} apt -y purge "${packages[@]}" apt -y install $first apt -y remove $first apt -y install $second ls -al /etc/systemd/system/syslog.service systemctl is-active syslog echo PASS