Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / lib / dpkg / info / | server ip : 172.67.156.115 your ip : 108.162.241.220 H O M E |
Filename | /var/lib/dpkg/info/dpkg.preinst |
Size | 2.62 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 07-Mar-2014 18:54 |
Last accessed | 07-Jul-2025 03:08 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/bin/sh
# This script can be called in the following ways:
#
# Before the package is installed:
# <new-preinst> install
#
# Before removed package is upgraded:
# <new-preinst> install <old-version>
#
# Before the package is upgraded:
# <new-preinst> upgrade <old-version>
#
#
# If postrm fails during upgrade or fails on failed upgrade:
# <old-preinst> abort-upgrade <new-version>
set -e
# Handle upgrades from pre-conffile dpkg.cfg
upgrade_dpkg_non_conffile()
{
if [ -r /etc/dpkg/dpkg.cfg ]; then
dpkg_cfg_md5="535552ad5ee9145dbc7a34c264df4e59 /etc/dpkg/dpkg.cfg"
if echo "$dpkg_cfg_md5" | md5sum -c >/dev/null 2>&1; then
echo "Removing non-modified dpkg.cfg to be replaced by a conffile ..."
rm -f /etc/dpkg/dpkg.cfg
fi
fi
}
rename_multiarch_conffile()
{
if [ -f /etc/dpkg/dpkg.cfg.d/multiarch ]; then
multiarch_md5="e018c53338191b34f943e2b38e160d1a /etc/dpkg/dpkg.cfg.d/multiarch"
if echo "$multiarch_md5" | md5sum -c >/dev/null 2>&1; then
mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-remove
else
mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-backup
fi
fi
}
kill_bad_alternatives () {
local IFS=""
admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
ALTDIR="$admindir/alternatives"
for alt in $ALTDIR/*; do
if [ ! -f $alt ]; then
# In case it's been removed by the code below, or in case
# it's not a real file
continue
fi
{
read mode || continue
read mainlink || continue
while true; do
read slave || break
if [ "$slave" = "" ]; then
break
fi
if [ -e "$ALTDIR/$slave" ]; then
echo "Removing conflicting master alternative $slave (it is slave of $(basename $alt))..."
rm -f "$ALTDIR/$slave"
fi
read slavelink || break
done
} <$alt
done
}
case "$1" in
install)
;;
upgrade)
# Cleanup bad alternatives that would choke with new
# update-alternatives (see #530633, #531611, #532739, #521760)
if dpkg --compare-versions "$2" lt 1.15.3; then
kill_bad_alternatives
fi
if dpkg --compare-versions "$2" lt 1.16.3; then
rename_multiarch_conffile
fi
case "$2" in
# Upgrade from pre-conffile dpkg.cfg
1.9.21 | 1.10.* )
upgrade_dpkg_non_conffile
;;
esac
;;
abort-upgrade)
;;
*)
echo "$0 called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
exit 0
# This script can be called in the following ways:
#
# Before the package is installed:
# <new-preinst> install
#
# Before removed package is upgraded:
# <new-preinst> install <old-version>
#
# Before the package is upgraded:
# <new-preinst> upgrade <old-version>
#
#
# If postrm fails during upgrade or fails on failed upgrade:
# <old-preinst> abort-upgrade <new-version>
set -e
# Handle upgrades from pre-conffile dpkg.cfg
upgrade_dpkg_non_conffile()
{
if [ -r /etc/dpkg/dpkg.cfg ]; then
dpkg_cfg_md5="535552ad5ee9145dbc7a34c264df4e59 /etc/dpkg/dpkg.cfg"
if echo "$dpkg_cfg_md5" | md5sum -c >/dev/null 2>&1; then
echo "Removing non-modified dpkg.cfg to be replaced by a conffile ..."
rm -f /etc/dpkg/dpkg.cfg
fi
fi
}
rename_multiarch_conffile()
{
if [ -f /etc/dpkg/dpkg.cfg.d/multiarch ]; then
multiarch_md5="e018c53338191b34f943e2b38e160d1a /etc/dpkg/dpkg.cfg.d/multiarch"
if echo "$multiarch_md5" | md5sum -c >/dev/null 2>&1; then
mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-remove
else
mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-backup
fi
fi
}
kill_bad_alternatives () {
local IFS=""
admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
ALTDIR="$admindir/alternatives"
for alt in $ALTDIR/*; do
if [ ! -f $alt ]; then
# In case it's been removed by the code below, or in case
# it's not a real file
continue
fi
{
read mode || continue
read mainlink || continue
while true; do
read slave || break
if [ "$slave" = "" ]; then
break
fi
if [ -e "$ALTDIR/$slave" ]; then
echo "Removing conflicting master alternative $slave (it is slave of $(basename $alt))..."
rm -f "$ALTDIR/$slave"
fi
read slavelink || break
done
} <$alt
done
}
case "$1" in
install)
;;
upgrade)
# Cleanup bad alternatives that would choke with new
# update-alternatives (see #530633, #531611, #532739, #521760)
if dpkg --compare-versions "$2" lt 1.15.3; then
kill_bad_alternatives
fi
if dpkg --compare-versions "$2" lt 1.16.3; then
rename_multiarch_conffile
fi
case "$2" in
# Upgrade from pre-conffile dpkg.cfg
1.9.21 | 1.10.* )
upgrade_dpkg_non_conffile
;;
esac
;;
abort-upgrade)
;;
*)
echo "$0 called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
exit 0