bundles/apt: fix logging for upgrade-and-reboot

This commit is contained in:
Franzi 2021-01-23 11:32:35 +01:00
parent 51101fc615
commit c41ee0f806
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -3,17 +3,15 @@
# With systemd, we can force logging to the journal. This is better than # With systemd, we can force logging to the journal. This is better than
# spamming the world with cron mails. You can then view these logs using # spamming the world with cron mails. You can then view these logs using
# "journalctl -rat upgrade-and-reboot". # "journalctl -rat upgrade-and-reboot".
if [[ "$1" != '-w' ]] if which logger >/dev/null 2>&1
then then
if which systemd-cat >/dev/null 2>&1 # Dump stdout to logger, which will then put everything into the
then # journal.
if [[ "$1" != "is-logging" ]] exec 1> >(logger -t upgrade-and-reboot -p user.info)
then
exec systemd-cat -t upgrade-and-reboot "$0" is-logging "$@" # Make stdout and stderr the same. We don't care about the
else # distinction anyway.
shift exec 2>&1
fi
fi
fi fi
statusfile="/var/tmp/unattended_upgrades.status" statusfile="/var/tmp/unattended_upgrades.status"