preinst is in ifupdown2 1.0~git20170314-1.
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 | #!/bin/sh
MYNAME="${0##*/}"
report() { echo "${MYNAME}: $*" ; }
report_err() { report "Error: $*" >&2 ; exit 1; }
preinst_divert()
{
diversions=$(LC_ALL=C.UTF-8 dpkg-divert --list | grep "$1" | grep -v 'ifupdown2$' | wc -l 2> /dev/null)
if [ "$diversions" -gt 0 ];
then
report_err "existing diversion for $1"
else
dpkg-divert --add --package ifupdown2 --rename --divert "$1.disabled" "$1"
fi
}
set -e
case "$1" in
install|upgrade)
for filename in ifup ifdown ifquery ifreload
do
preinst_divert "/sbin/$filename"
preinst_divert "/usr/share/bash-completion/completions/$filename"
preinst_divert "/etc/bash_completion.d/$filename"
preinst_divert "/usr/share/man/man8/$filename.8.gz"
done
preinst_divert "/usr/share/man/man5/interfaces.5.gz"
;;
esac
dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ifup" 1.1 -- $@
|