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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
#!/bin/sh -e
[ "$1" = configure ] || exit 0
oldcatdir=/var/catman
catdir=/var/cache/man
maybesetuid='man mandb'
conffile=/etc/manpath.config
. /usr/share/debconf/confmodule
db_version 2.0
db_get man-db/install-setuid
# Sorry about this, but #98224 is right - statoverrides don't work as
# cleanly as I'd hoped here. I'm going to have to carry around some cruft
# for a while.
for x in $maybesetuid; do
if dpkg --compare-versions "$2" eq 2.3.18-4 && \
[ "`dpkg-statoverride --list /usr/lib/man-db/$x`" = \
"man root 4755 /usr/lib/man-db/$x" ]; then
dpkg-statoverride --remove /usr/lib/man-db/$x
fi
done
if [ "$RET" = true ]; then
# man and mandb are to be installed setuid man.
owner=man:root
mode=4755
else
# man and mandb are not to be installed setuid.
owner=root:root
mode=0755
fi
for x in $maybesetuid; do
# No statoverrides available or none exist for us ...
if [ ! -x /usr/sbin/dpkg-statoverride ] || \
! dpkg-statoverride --list /usr/lib/man-db/$x >/dev/null; then
chown $owner /usr/lib/man-db/$x
chmod $mode /usr/lib/man-db/$x
fi
ln -sf ../lib/man-db/$x /usr/bin/$x
done
if [ -e /etc/cron.daily/man.moved-by-preinst ]; then
rm /etc/cron.daily/man.moved-by-preinst
fi
if [ -e /etc/cron.weekly/catman.moved-by-preinst ]; then
rm /etc/cron.weekly/catman.moved-by-preinst
fi
if dpkg --compare-versions "$2" lt 2.3.18; then
# /usr/local/man now mapped to /var/cache/man/oldlocal
if [ -d $catdir/local ] && [ ! -d $catdir/oldlocal ]; then
mv -f $catdir/local $catdir/oldlocal
fi
fi
if [ -d $catdir ]; then
# Catdirs sometimes used to be created with the wrong permissions.
if dpkg --compare-versions "$2" lt 2.3.20-4; then
chown -R man /var/cache/man
fi
else
# Old packages removed catpages on upgrade. The preinst hack should have
# avoided this, but let's be sure.
install -d -o man -g root -m 02755 $catdir
fi
build_db=0
if dpkg --compare-versions "$2" lt 2.3.16 || \
([ ! -f $catdir/index.db ] && [ ! -f $catdir/index.bt ]); then
# If the build-database question was never asked, this is probably a
# fresh install, or maybe we're reconfiguring. The default is to build
# the database.
db_fget man-db/build-database seen
if [ "$RET" = false ]; then
build_db=1
else
# This should probably only fire when upgrading from less than
# 2.3.16, but it doesn't really matter.
db_get man-db/build-database
if [ "$RET" = true ]; then
build_db=1
fi
fi
elif dpkg --compare-versions "$2" lt 2.4.2-1; then
# Clean up old btree databases from before 2.4.2-1. They're useless now.
find /var/cache/man -name index.bt -print0 | xargs -0r rm -f
db_get man-db/rebuild-database
if [ "$RET" = true ]; then
build_db=1
fi
fi
if [ $build_db -eq 1 ]; then
frontend=`echo "$DEBIAN_FRONTEND" | tr '[:upper:]' '[:lower:]'`
if [ "$frontend" = noninteractive ]; then
# Run in the foreground. In this case, chances are we're being run
# from debootstrap, which will have problems if mandb runs
# backgrounded for too long (bug #100616).
# start-stop-daemon isn't available when running from debootstrap.
echo "Building database of manual pages ..." >&2
perl -e '@pwd = getpwnam("man"); $( = $) = $pwd[3]; $< = $> = $pwd[2];
exec "/usr/bin/mandb", "-cq"' || true
else
echo "Building database of manual pages in the background." >&2
# --pidfile /dev/null so it always starts; mandb isn't really a
# daemon, but we want to start it like one.
start-stop-daemon --start --pidfile /dev/null --background \
--startas /usr/bin/mandb --oknodo --chuid man \
-- --create --quiet
fi
fi
#DEBHELPER#
# The upgrade is complete, so no more concern about this question being
# asked twice. Clean up the flag.
db_fset man-db/rebuild-database seen_in_2.4.2-1_upgrade false
db_stop
exit 0
|