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
|
#!/bin/sh
set -e
case ${PIUPARTS_OBJECTS%%=*} in
dpkg)
# skip while creating the tarball
exit 0
;;
esac
# clear out /usr/share/doc
# but keep the directories (and symlinks) as well as the copyright files
cat << EOF > /etc/dpkg/dpkg.cfg.d/piuparts-path-exclude
path-exclude=/usr/share/doc/*/*
path-include=/usr/share/doc/*/copyright
EOF
# switching init systems forth and back will clean out /usr/share/doc
# reinstalling the affected packages beforehand makes the files disappear
# before the snapshot of the reference system is created
CANDIDATES="systemd systemd-sysv sysv-rc"
CANDIDATES=$(dpkg-query -W $CANDIDATES | awk '{ if ($2) { print $1 } }')
if [ -n "$CANDIDATES" ]; then
echo "Reinstalling $(echo $CANDIDATES)..."
# workaround apt bug #770291 - do it one by one, not all at once
for package in $CANDIDATES
do
apt-get -u --reinstall install $package
done
fi
|