summaryrefslogtreecommitdiffstats
path: root/debian/systemd.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/systemd.postinst')
-rw-r--r--debian/systemd.postinst70
1 files changed, 70 insertions, 0 deletions
diff --git a/debian/systemd.postinst b/debian/systemd.postinst
new file mode 100644
index 0000000..7019651
--- /dev/null
+++ b/debian/systemd.postinst
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+set -e
+
+_systemctl() {
+ if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then
+ systemctl "$@"
+ fi
+}
+
+_update_catalog() {
+ journalctl ${DPKG_ROOT:+--root="$DPKG_ROOT"} --update-catalog || true
+}
+
+_update_binfmt() {
+ _systemctl restart systemd-binfmt.service || true
+}
+
+# Update Message Catalogs database and binfmt registrations in response to dpkg triggers
+if [ "$1" = "triggered" ]; then
+ shift
+ for trigger in $@; do
+ case $trigger in
+ /usr/lib/systemd/catalog)
+ _update_catalog
+ ;;
+ /usr/lib/binfmt.d)
+ _update_binfmt
+ ;;
+ esac
+ done
+ exit 0
+fi
+
+# Enable getty, remote-fs.target and systemd-pstore by default on new installs
+if [ -z "$2" ]; then
+ systemctl ${DPKG_ROOT:+--root="$DPKG_ROOT"} enable getty@tty1.service || true
+ systemctl ${DPKG_ROOT:+--root="$DPKG_ROOT"} enable remote-fs.target || true
+ systemctl ${DPKG_ROOT:+--root="$DPKG_ROOT"} enable systemd-pstore.service || true
+fi
+
+# Create /etc/machine-id
+systemd-machine-id-setup ${DPKG_ROOT:+--root="$DPKG_ROOT"}
+
+# Enable persistent journal, in auto-mode, by default on new installs
+if [ -z "$2" ]; then
+ mkdir -p "$DPKG_ROOT/var/log/journal"
+fi
+
+# Initial update of the Message Catalogs database
+_update_catalog
+
+# Move the old locale file into /etc. Symlinks will be created by tmpfiles.d later
+if [ -f /etc/default/locale ] && [ ! -L /etc/default/locale ] && [ ! -f /etc/locale.conf ]; then
+ mv /etc/default/locale /etc/locale.conf
+fi
+
+#DEBHELPER#
+
+if [ -n "$2" ]; then
+ _systemctl daemon-reexec || true
+ # Re-exec user instances so that running user managers are updated too.
+ # SIGRTMIN+25 -> reexec. Note that this is asynchronous, but we can't use
+ # D-Bus as dbus-user-session is not guaranteed to be available.
+ _systemctl kill --kill-whom='main' --signal='SIGRTMIN+25' 'user@*.service' || true
+ # do not restart logind
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919509
+ _systemctl try-restart systemd-networkd.service || true
+ _systemctl try-restart systemd-journald.service || true
+fi