preinst is in lxc-utils 3.0.0-0ubuntu2.
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 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 68 69 70 71 72 73 74 75 76 77 78 79 80 | #!/bin/sh
set -e
migrate_auto()
{
echo "Migrating /etc/lxc/auto to lxc.auto.start config flag"
for container in /etc/lxc/auto/*; do
[ "$container" = "/etc/lxc/auto/*" ] && continue
if [ ! -L "$container" ]; then
echo "$container isn't a symlink, skipping."
fi
if [ -d "$container" ] && [ -e "$container/config" ]; then
echo " - Marking $container/config as auto-started"
echo "" >> $container/config
echo "# Added by lxc postinst, migration of autostart flag" >> $container/config
echo "lxc.start.auto = 1" >> $container/config
fi
if [ -f "$container" ]; then
echo " - Marking $container as auto-started"
echo "" >> $container
echo "# Added by lxc postinst, migration of autostart flag" >> $container
echo "lxc.start.auto = 1" >> $container
fi
rm $container
done
# Try to remove /etc/lxc/auto (but ignore failure if non-empty)
rmdir /etc/lxc/auto/ >/dev/null 2>&1 || true
}
case "${1}" in
install|upgrade)
if [ -d /etc/lxc/auto ]; then
migrate_auto
fi
if [ ! -f /etc/lxc/lxc-usernet ]; then
mkdir -p /etc/lxc/
echo "# USERNAME TYPE BRIDGE COUNT" > /etc/lxc/lxc-usernet
fi
# If we have the stock preinstalled /etc/default/lxc-net, then
# remove it so that lxc-net can recreate on startup.
if dpkg --compare-versions "$2" eq "1.1.4-0ubuntu1"; then
if [ -f /etc/default/lxc-net ]; then
sum="$(md5sum /etc/default/lxc-net | awk '{ print $1 }')"
if [ "$sum" = e3f08a54cbdd4ebff86207417f366e6e ]; then
found=0; for f in /sys/class/net/lxcbr0/lower*; do [ -d "$f" ] && found=$(($found+1)); done
if [ $found -eq 0 ]; then
invoke-rc.d lxc-net stop
fi
rm -f /etc/default/lxc-net
fi
else
echo "# written on upgrade from 1.1.4-0ubuntu1." > /etc/default/lxc-net
echo "USE_LXC_BRIDGE=false" >> /etc/default/lxc-net
fi
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument (${1})"
exit 1
;;
esac
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/lxc.conf 2.1.0-0ubuntu1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/lxc-instance.conf 2.1.0-0ubuntu1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/lxc-net.conf 2.1.0-0ubuntu1\~ -- "$@"
# End automatically added section
exit 0
|