mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown2: fixup maintainer scripts
Ticket: CM-5764 Reviewed By: TBA Testing Done: of course none ;) Will update when I have some time to test fupdown2's postinst and postrm scripts do not conform to Debian's policy for maintainer scripts [1]. Specific non-conformance follows: * fixed maintainer scripts so they only use /bin/sh as other shells are non-essential packages and may not exist on the system * fixed maintainer scripts so only actions specified by $1 are performed per run of the script * fixed maintainer scripts to only support specific values for $1, and will otherwise exit with error * included at the bottom of the postrm script the "#DEBHELPER#" tag as during package building debianhelper will inject extra code at this location [1] https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html (cherry picked from commit 2289fe4e90a0134fcb07fe7e2e838de755d73e68)
This commit is contained in:
68
debian/python-ifupdown2.postrm
vendored
68
debian/python-ifupdown2.postrm
vendored
@@ -1,20 +1,57 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# postrm script for ifupdown2
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
rm -f /sbin/ifup /sbin/ifdown /sbin/ifquery
|
||||
# summary of how this script can be called:
|
||||
# * <postrm> `remove'
|
||||
# * <postrm> `purge'
|
||||
# * <old-postrm> `upgrade' <new-version>
|
||||
# * <new-postrm> `failed-upgrade' <old-version>
|
||||
# * <new-postrm> `abort-install'
|
||||
# * <new-postrm> `abort-install' <old-version>
|
||||
# * <new-postrm> `abort-upgrade' <old-version>
|
||||
# * <disappearer's-postrm> `disappear' <overwriter>
|
||||
# <overwriter-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
postrm_remove()
|
||||
{
|
||||
rm -f /sbin/ifup /sbin/ifdown /sbin/ifquery
|
||||
update-rc.d networking remove >/dev/null
|
||||
}
|
||||
|
||||
# Note: We don't remove /etc/network/interfaces
|
||||
postrm_purge()
|
||||
{
|
||||
rm -f /var/tmp/network/ifstatenew
|
||||
if [ -L /etc/network/run ] ; then
|
||||
rm -f /etc/network/run
|
||||
elif [ -d /etc/network/run ] ; then
|
||||
rmdir --ignore-fail-on-non-empty /etc/network/run
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
purge)
|
||||
# Note: We don't remove /etc/network/interfaces
|
||||
rm -f /var/tmp/network/ifstatenew
|
||||
purge)
|
||||
postrm_purge
|
||||
;;
|
||||
|
||||
if [ -L /etc/network/run ] ; then
|
||||
rm -f /etc/network/run
|
||||
elif [ -d /etc/network/run ] ; then
|
||||
rmdir --ignore-fail-on-non-empty /etc/network/run
|
||||
fi
|
||||
;;
|
||||
remove)
|
||||
postrm_remove
|
||||
;;
|
||||
|
||||
|
||||
upgrade|disappear|failed-upgrade|abort-install|abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
udevlink=$(readlink /etc/udev/rules.d/80-networking.rules 2>/dev/null || true)
|
||||
@@ -22,6 +59,9 @@ udevlink=$(readlink /etc/udev/rules.d/80-networking.rules 2>/dev/null || true)
|
||||
udevlink=$(readlink /etc/udev/rules.d/60-bridge-network-interface.rules 2>/dev/null || true)
|
||||
[ -n "$udevlink" -a "$udevlink" == "/dev/null" ] && rm -f /etc/udev/rules.d/60-bridge-network-interface.rules
|
||||
|
||||
if [ "$1" = "purge" ] ; then
|
||||
update-rc.d networking remove >/dev/null
|
||||
fi
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user