This file is indexed.

postinst is in systemd 229-4ubuntu4.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#! /bin/sh

set -e

_systemctl() {
    if [ -d /run/systemd/system ]; then
        systemctl "$@"
    fi
}

_update_catalog() {
    journalctl --update-catalog || true
}

# Update Message Catalogs database and reload in response to dpkg triggers
if [ "$1" = "triggered" ]; then
    shift
    for trigger in "$@"; do
        case $trigger in
            /usr/lib/systemd/catalog)
                _update_catalog
                ;;
            /etc/init.d)
                _systemctl daemon-reload || true
                ;;
        esac
    done
    exit 0
fi

# Enable getty and remote-fs.target by default on new installs, and on
# upgrades from old systemd versions (where the symlinks included as deb
# content, and will thus have been removed by dpkg during the upgrade).
if dpkg --compare-versions "$2" lt "214-1"; then
    systemctl enable getty@tty1.service || true
    systemctl enable remote-fs.target || true
fi

# Enable timesyncd by default on new installs installs and upgrades
if dpkg --compare-versions "$2" lt "218-11~"; then
    systemctl enable systemd-timesyncd.service || true
fi

# Do a one-time migration of the local time setting
if dpkg --compare-versions "$2" lt "228-5ubuntu3"; then
    if [ -f /etc/default/rcS ]; then
        . /etc/default/rcS
    fi
    if [ "$UTC" = "no" ] && [ ! -e /etc/adjtime ]; then
        printf "0.0 0 0.0\n0\nLOCAL\n" > /etc/adjtime
    fi
fi

# Do a one-time migration of the TMPTIME setting
if dpkg --compare-versions "$2" lt "204-9"; then
    # Fix up potentially broken tmp.conf, see Debian#738862
    if [ -e /etc/tmpfiles.d/tmp.conf ]; then
        sed -i '/^# Clear \/var\/tmp/d' /etc/tmpfiles.d/tmp.conf
        sed -i 's,^\(d /var/tmp\),#\1,g' /etc/tmpfiles.d/tmp.conf
    fi

    if [ -f /etc/default/rcS ]; then
        . /etc/default/rcS
    fi
    if [ ! -e /etc/tmpfiles.d/tmp.conf ]; then
        case "$TMPTIME" in
            -*|infinite|infinity)
                cat > /etc/tmpfiles.d/tmp.conf <<EOF
# Avoid clearing /tmp by shipping an empty /etc/tmpfiles.d/tmp.conf file
# which overrides /usr/lib/tmpfiles.d/tmp.conf.
# This file was automatically created because of local modifications in
# /etc/default/rcS where TMPTIME was set to infinite.
EOF
                ;;
        esac
    fi
fi

# Do a one-time migration of the RAMTMP setting
if dpkg --compare-versions "$2" lt "204-8"; then
    if [ -f /etc/default/rcS ]; then
        . /etc/default/rcS
    fi
    if [ -f /etc/default/tmpfs ]; then
        . /etc/default/tmpfs
    fi
    if [ "$RAMTMP" = "yes" ]; then
        # systemctl enable will work even when systemd is not the active PID 1.
        if [ ! -e /etc/systemd/system/tmp.mount ]; then
            cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
            systemctl enable tmp.mount || true
        fi
    fi
fi

# Create /etc/machine-id
systemd-machine-id-setup

# Setup system users and groups
addgroup --system systemd-journal

adduser --quiet --system --group --no-create-home --home /run/systemd \
    --gecos "systemd Time Synchronization" systemd-timesync
adduser --quiet --system --group --no-create-home --home /run/systemd/netif \
    --gecos "systemd Network Management" systemd-network
adduser --quiet --system --group --no-create-home --home /run/systemd/resolve \
    --gecos "systemd Resolver" systemd-resolve
adduser --quiet --system --group --no-create-home --home /run/systemd \
    --gecos "systemd Bus Proxy" systemd-bus-proxy

# Initial update of the Message Catalogs database
_update_catalog

# Make systemd-detect-virt utility usable for non-root users
setcap cap_dac_override,cap_sys_ptrace=ep /usr/bin/systemd-detect-virt || true

# Re-run systemctl enable for any service that was enabled when preinst was run.
if dpkg --compare-versions "$2" ge "204" && [ -e /run/systemd/was-enabled ]; then
    while read UNIT ; do
        # 220-6 stopped shipping tmp.mount, transition it on machines which had
        # it enabled
        if [ "$UNIT" = tmp.mount ] && dpkg --compare-versions "$2" lt-nl "220-6~"; then
            if [ ! -e /etc/systemd/system/tmp.mount ]; then
                echo "moving enabled tmp.mount to /etc/systemd/system/..."
                cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
                # clean up the symlink, to have it re-created below
                systemctl disable $UNIT
            fi
        fi
        systemctl enable $UNIT || true
    done </run/systemd/was-enabled || true
fi

if [ -n "$2" ]; then
    _systemctl daemon-reexec || true
    # don't restart logind; this can be done again once this gets implemented:
    # https://github.com/systemd/systemd/issues/1163
    _systemctl try-restart systemd-networkd.service || true
    _systemctl try-restart systemd-resolved.service || true
    _systemctl try-restart systemd-timesyncd.service || true
fi

# Cleanup hwclock-save.service, which was shipped in jessie.
if dpkg --compare-versions "$2" lt-nl "228-5~"; then
   for t in reboot halt poweroff ; do
       rm -f /etc/systemd/system/${t}.target.wants/hwclock-save.service
       rmdir --ignore-fail-on-non-empty /etc/systemd/system/${t}.target.wants 2> /dev/null || true
   done
fi

# start systemd-networkd-resolvconf-update.path on first install/upgrade if
# required
if _systemctl is-active --quiet resolvconf; then
    _systemctl start systemd-networkd-resolvconf-update.path || true
fi

# migrate mountall specific fstab options to standard util-linux "nofail" option
if dpkg --compare-versions "$2" lt "221-1" && [ -w /etc/fstab ]; then
    if awk '{ gsub(/^nobootwait/, "nofail", $4); gsub(/,nobootwait/, ",nofail", $4); gsub(/^optional/, "nofail", $4); gsub(/,optional/, ",nofail", $4); print }' /etc/fstab > /etc/fstab.new; then
        if cmp --quiet /etc/fstab /etc/fstab.new; then
            rm /etc/fstab.new  # nothing to migrate
        else
            echo "Replacing obsolete mountall options in /etc/fstab... (backup in /etc/fstab.mountall)"
            mv /etc/fstab /etc/fstab.mountall
            mv /etc/fstab.new /etc/fstab
        fi
    else
        echo "WARNING! Could not create /etc/fstab.new for migrating obsolete mountall options" >&2
    fi
fi

# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
	# In case this system is running systemd, we need to ensure that all
	# necessary tmpfiles (if any) are created before starting.
	if [ -d /run/systemd/system ] ; then
		systemd-tmpfiles --create /usr/lib/tmpfiles.d/debian.conf /usr/lib/tmpfiles.d/home.conf /usr/lib/tmpfiles.d/journal-nocow.conf /usr/lib/tmpfiles.d/legacy.conf /usr/lib/tmpfiles.d/systemd-nologin.conf /usr/lib/tmpfiles.d/systemd.conf /usr/lib/tmpfiles.d/tmp.conf /usr/lib/tmpfiles.d/var.conf /usr/lib/tmpfiles.d/x11.conf >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/bash_completion.d/systemctl-bash-completion.sh 204-1~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/bash_completion.d/systemd-bash-completion.sh 204-1~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/systemd/systemd-logind.conf /etc/systemd/logind.conf 204-1~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/systemd/systemd-journald.conf /etc/systemd/journald.conf 204-1~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/dbus-1/system.d/org.freedesktop.machine1.conf 228-5~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/X11/xinit/xinitrc.d/50-systemd-user.sh 228-3~ -- "$@"
# End automatically added section