Commit 47d23416 authored by Michael Biebl's avatar Michael Biebl
Browse files

Remove the dpkg-triggered debian-enable-units script

This was a temporary workaround for wheezy. Packages should use dh-systemd
now to properly integrate service files with systemd.
Remove the state files on upgrades.
parent 1fb48b31
......@@ -47,6 +47,9 @@ systemd (204-1) UNRELEASED; urgency=low
reduced features/dependencies.
* Create a few compat symlinks for the udev package, most notably
/sbin/udevadm and /sbin/udevd.
* Remove the dpkg-triggered debian-enable-units script. This was a temporary
workaround for wheezy. Packages should use dh-systemd now to properly
integrate service files with systemd.
-- Michael Biebl <biebl@debian.org> Wed, 17 Jul 2013 16:57:58 +0200
......
#!/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 a package is installed using init-system-helpers, do nothing.
# We don't want to interfere in such a case
if [ -x /usr/bin/deb-systemd-helper ] ; then
exit 0
fi
# If systemd is not running, schedule a run on next boot
if ! [ -d /run/systemd/system ] ; 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
[Unit]
Description=Automatically Enable Systemd Units
ConditionPathExists=/var/lib/systemd/run-debian-enable-units
DefaultDependencies=no
Wants=sysinit.target
After=sysinit.target
[Service]
ExecStart=/lib/systemd/debian-enable-units
Type=oneshot
RemainAfterExit=true
......@@ -83,11 +83,8 @@ override_dh_install:
debian/systemd/usr/lib/tmpfiles.d/
install --mode=644 debian/debian-fixup.service debian/ifup@.service \
debian/units/run-lock.mount debian/units/run-user.mount \
debian/debian-enable-units.service \
debian/systemd/lib/systemd/system/
install --mode=644 debian/unit.blacklist \
debian/systemd/usr/share/systemd/
install --mode=755 debian/debian-fixup debian/debian-enable-units \
install --mode=755 debian/debian-fixup \
debian/systemd/lib/systemd/
# remove duplicates
# files shipped by systemd-sysv / sysvinit
......
......@@ -8,14 +8,11 @@ _systemctl() {
fi
}
if [ "$1" = triggered ]; then
/lib/systemd/debian-enable-units
exit 0
fi
# Run the script after the initial installation or once on upgrades
if [ -z "$2" ] || dpkg --compare-versions "$2" lt "44-9"; then
/lib/systemd/debian-enable-units
# Cleanup state files from the auto-enabler which we used in wheezy
if dpkg --compare-versions "$2" lt "204-1"; then
rm -f /var/lib/systemd/enabled-units
rm -f /var/lib/systemd/run-debian-enable-units
rm -f /var/lib/systemd/*.symlinks
fi
if [ -n "$2" ]; then
......
#! /bin/sh
set -e
# Clean up the mess we created
statedir=/var/lib/systemd
if [ "$1" = "purge" ] && [ -d $statedir ]; then
find $statedir -name "*.symlinks" | while read file ; do
while read symlink ; do
rm -f "$symlink"
done < "$file"
rm -f "$file"
done
rm -f $statedir/enabled-units
rm -f $statedir/run-debian-enable-units
rmdir --ignore-fail-on-non-empty $statedir
fi
#DEBHELPER#
interest /lib/systemd/system
# systemd internal services and sockets
console-shell.service
debian-fixup.service
emergency.service
fsck-root.service
fsck@.service
getty@.service
halt.service
ifup@.service
kexec.service
poweroff.service
quotacheck.service
quotaon.service
reboot.service
remount-rootfs.service
rescue.service
serial-getty@.service
systemd-ask-password-console.service
systemd-ask-password-wall.service
systemd-binfmt.service
systemd-hostnamed.service
systemd-initctl.service
systemd-journald.service
systemd-localed.service
systemd-logind.service
systemd-modules-load.service
systemd-random-seed-load.service
systemd-random-seed-save.service
systemd-readahead-collect.service
systemd-readahead-done.service
systemd-readahead-replay.service
systemd-remount-api-vfs.service
systemd-shutdownd.service
systemd-sysctl.service
systemd-timedated.service
systemd-tmpfiles-clean.service
systemd-tmpfiles-setup.service
systemd-update-utmp-runlevel.service
systemd-update-utmp-shutdown.service
systemd-user-sessions.service
systemd-vconsole-setup.service
user@.service
systemd-journald.socket
syslog.socket
systemd-shutdownd.socket
systemd-initctl.socket
# udev-settle should only be enabled when needed
udev-settle.service
# this delays the boot process so should only be enabled as needed
NetworkManager-wait-online.service
# thinkfan is disabled by default since it can damage the hardware
# if not configured correctly
thinkfan.service
# pyroman is disabled by default as it needs explicit configuration
pyroman.service
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment