/lib/systemd/debian-enable-units is in systemd 44-11+deb7u4.
This file is owned by root:root, with mode 0o755.
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 | #!/bin/sh
static_blacklist=/usr/share/systemd/unit.blacklist
enabled_units=/var/lib/systemd/enabled-units
statedir=/var/lib/systemd
unitdir=/lib/systemd/system
# If systemd is not running, schedule a run on next boot
if ! [ -e /sys/fs/cgroup/systemd ] ; then
touch $statedir/run-debian-enable-units
exit 0
else
rm -f $statedir/run-debian-enable-units
fi
# Get all installed service and socket unit files
installed=$(mktemp)
find $unitdir -type f \( -name "*.socket" -o -name "*.service" \) -printf "%f\n" | sort -u > $installed
# Generate a blacklist from previously enabled units and
# static ones, like the one in systemd itself while ignoring comments
blacklist=$(mktemp)
cat $static_blacklist $enabled_units 2>/dev/null | sed '/^#.*/d' | sort -u > $blacklist
# Skip blacklisted entries
while read unit ; do
sed -i "/$unit/d" $installed
done < $blacklist
# Get entries which need to be enabled
needs_enable=$(mktemp)
while read unit ; do
if systemctl is-enabled "$unit" 2> /dev/null | grep -q "disabled"; then
echo "$unit" >> $needs_enable
fi
done < $installed
# Enable entries and record their state
while read unit ; do
echo "systemctl: enabling $unit"
systemctl enable "$unit" 2>&1 | awk '{print $4}' | sed s/\'//g > "$statedir/${unit}.symlinks"
echo "$unit" >> $enabled_units
done < $needs_enable
# Cleanup phase
# Find deleted units and remove their symlinks
if [ -f $enabled_units ] ; then
while read unit ; do
if ! [ -f "$unitdir/$unit" ] ; then
echo "systemctl: disabling $unit"
while read symlink ; do
rm -f "$symlink"
done < "$statedir/${unit}.symlinks"
rm -f "$statedir/${unit}.symlinks"
sed -i "/$unit/d" $enabled_units
fi
done < $enabled_units
fi
rm -f $installed
rm -f $blacklist
rm -f $needs_enable
|