preinst is in vzctl 4.9.4-5.
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #! /bin/sh
# preinst script for vzctl
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
velayoutsecurityfix() {
# It is possible to enforce it in case of upgrade from 4.9.4-1
local UPDATE="$1"
# Upgrade to ensure the security of the system
local TMPCFG=$(mktemp)
#cat $TMPCFG
for CF in $(find /etc/vz/conf/ -maxdepth 1 -type f -name "*.conf") ; do
VEID=$(basename "$CF" | sed 's/\.conf$//;')
if ! grep VE_PRIVATE $CF > $TMPCFG ; then
if ! grep VE_PRIVATE /etc/vz/vz.conf > $TMPCFG ; then
echo "#Missing VE_PRIVATE assuming default" > $TMPCFG
echo 'VE_PRIVATE=/vz/private/$VEID' >> $TMPCFG
fi
fi
local CFUPDATE="$UPDATE"
if ! grep VE_LAYOUT "$CF" > /dev/null ; then
CFUPDATE=yes
elif [ "$UPDATE" = "yes" ] ; then
echo "Correction of regression problem in $CF."
sed -i '/VE_LAYOUT/d;' $CF
fi
if [ "$CFUPDATE" = "yes" ] ; then
VE_PRIVATE=""
. $TMPCFG
local X=""
if [ -d "${VE_PRIVATE}/proc" ] ; then
X=simfs
elif [ -e "${VE_PRIVATE}/root.hdd/DiskDescriptor.xml" ] ; then
X=ploop
fi
if [ "$X" != "" ] ; then
echo "Securing CT configuration file $CF by adding VE_LAYOUT=$X"
echo "" >> $CF
echo "# Upgrade `date`: Securing CT config by adding VE_LAYOUT=$X" >> $CF
echo "VE_LAYOUT=$X" >> $CF
fi
fi
done
rm -f $TMPCFG
}
case "$1" in
install)
if [ "$2" = "4.9.4-1" ] ; then
velayoutsecurityfix "yes"
elif [ "$2" != "" ] ; then
velayoutsecurityfix ""
fi
;;
upgrade)
# Upgrade path, vz cron file no longer needed as vzeventd exist
# instead.
# From lenny
if [ -e /etc/cron.d/vz ] ; then
mv /etc/cron.d/vz /etc/cron.d/vz,disabled
fi
# Upgrade path for (etch version) cron files.
if [ -e /etc/cron.d/vpsnetclean ] ; then
mv /etc/cron.d/vpsnetclean /etc/cron.d/vpsnetclean,disabled
fi
if [ -e /etc/cron.d/vpsreboot ] ; then
mv /etc/cron.d/vpsreboot /etc/cron.d/vpsreboot,disabled
fi
# VE layout security fix
if [ "$2" = "4.9.4-1" ] ; then
velayoutsecurityfix "yes"
else
velayoutsecurityfix ""
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|