Add unminimize script for reverting minimization on running system

core-include-dmsetup
Balint Reczey 7 years ago
parent 9dd178a0e5
commit 5e1d0f0ee7

@ -56,6 +56,36 @@ EOF
# Remove docs installed by bootstrap
Chroot chroot dpkg-query -f '${binary:Package}\n' -W | Chroot chroot xargs apt-get install --reinstall
# Add unminimizer script which restores default image behavior
mkdir -p chroot/usr/local/sbin
cat > chroot/usr/local/sbin/unminimize <<'EOF'
#!/bin/sh
set -e
if [ -f /etc/dpkg/dpkg.cfg.d/excludes ] || [ -f /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp ]; then
echo "Re-enabling installation of all documentation in dpkg..."
if [ -f /etc/dpkg/dpkg.cfg.d/excludes ]; then
mv /etc/dpkg/dpkg.cfg.d/excludes /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp
fi
echo "Updating package list and upgrading packages..."
apt-get update
# apt-get upgrade asks for confirmation before upgrading packages to let the user stop here
apt-get upgrade
echo "Restoring system documentation..."
echo "Reinstalling packages with files in /usr/share/man/ ..."
dpkg -S /usr/share/man/ |sed 's|, |\n|g;s|: [^:]*$||' | DEBIAN_FRONTEND=noninteractive xargs apt-get install --reinstall -y
echo "Reinstalling packages with system documentaion in /usr/share/doc/ .."
dpkg --verify | awk '/..5...... \/usr\/share\/doc/ {print $2}' | sed 's|/[^/]*$||' | sort |uniq \
| xargs dpkg -S | sed 's|, |\n|g;s|: [^:]*$||' | uniq | DEBIAN_FRONTEND=noninteractive xargs apt-get install --reinstall -y
if dpkg --verify > /dev/null; then
echo "Documentation has been restored successfully."
rm /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp
fi
fi
EOF
chmod +x chroot/usr/local/sbin/unminimize
fi
Chroot chroot "dpkg-divert --quiet --add \

Loading…
Cancel
Save