#!/bin/shset -e#DEBHELPER## remove dpkg-statoverride on upgradeif [ "$1" = "configure" ] && dpkg-statoverride --list /usr/lib/cockpit/cockpit-session >/dev/null; thendpkg-statoverride --remove /usr/lib/cockpit/cockpit-sessionchmod 755 /usr/lib/cockpit/cockpit-sessionchgrp root /usr/lib/cockpit/cockpit-sessionfi# restart cockpit.service on package upgrades, if it's already runningif [ -d /run/systemd/system ] && [ -n "$2" ]; thendeb-systemd-invoke try-restart cockpit.service >/dev/null || truefi# update AppArmor profileif [ "$1" = "configure" ] && [ -e /etc/apparmor.d/cockpit-desktop ] && aa-enabled --quiet 2>/dev/null; thenapparmor_parser -r -T -W /etc/apparmor.d/cockpit-desktop || truefi# set up dynamic motd/issue symlinks on first-time install or upgrades from < 244 (which moved them out of the .deb)if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt 244; thenmkdir -p /etc/motd.d /etc/issue.dln -s ../../run/cockpit/issue /etc/motd.d/cockpitln -s ../../run/cockpit/issue /etc/issue.d/cockpit.issueprintf "# List of users which are not allowed to login to Cockpit\nroot\n" > /etc/cockpit/disallowed-userschmod 644 /etc/cockpit/disallowed-usersfi# adjust motd/issue links to the changed target if they still existif [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl 331; thenif [ "$(readlink /etc/motd.d/cockpit 2>/dev/null)" = "../../run/cockpit/motd" ]; thenln -sfn ../../run/cockpit/issue /etc/motd.d/cockpitfiif [ "$(readlink /etc/issue.d/cockpit.issue 2>/dev/null)" = "../../run/cockpit/motd" ]; thenln -sfn ../../run/cockpit/issue /etc/issue.d/cockpit.issuefifi