mirror of
https://git.proxmox.com/git/ifupdown2
synced 2025-08-19 21:06:04 +00:00
67 lines
1.7 KiB
Bash
67 lines
1.7 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
MYNAME="${0##*/}"
|
|
|
|
report() { echo "${MYNAME}: $*" ; }
|
|
report_warn() { report "Warning: $*" >&2 ; }
|
|
report_err() { report "Error: $*" >&2 ; }
|
|
|
|
process_state_file()
|
|
{
|
|
rm -f /run/network/ifstatenew
|
|
}
|
|
|
|
process_udev()
|
|
{
|
|
if [ -e /etc/udev/rules.d/80-networking.rules ]; then
|
|
udevlink=$(readlink /etc/udev/rules.d/80-networking.rules 2>/dev/null || true)
|
|
[ -n "$udevlink" -a "$udevlink" = "/dev/null" ] && rm -f /etc/udev/rules.d/80-networking.rules
|
|
fi
|
|
|
|
if [ -e /etc/udev/rules.d/60-bridge-network-interface.rules ]; then
|
|
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
|
|
fi
|
|
}
|
|
|
|
proxmox_compatibility()
|
|
{
|
|
perl -e '
|
|
my $haspve_common; eval { require PVE::INotify; $haspve_common = 1; };
|
|
exit if !$haspve_common;
|
|
my $config = PVE::INotify::read_file('interfaces', 1);
|
|
my $configdata = $config->{data};
|
|
|
|
PVE::INotify::write_file('interfaces', $configdata);
|
|
|
|
$config = PVE::INotify::read_file('interfaces', 1);
|
|
|
|
if (defined($config->{changes})) {
|
|
#print $config->{changes};
|
|
print "\nnetwork config changes have been detected for ifupdown2 to ifupdown1 switch compatibility.\nSaved in /etc/network/interfaces.new for next reboot\n\n";
|
|
}
|
|
' || true
|
|
}
|
|
|
|
case "$1" in
|
|
purge|remove|abort-install|disappear)
|
|
process_state_file
|
|
process_udev
|
|
proxmox_compatibility
|
|
;;
|
|
|
|
upgrade|failed-upgrade|abort-upgrade|disappear)
|
|
;;
|
|
|
|
*)
|
|
echo "postrm called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|