From 5e1d0f0ee78086abd6076eb747d7acf64d20b83b Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Thu, 28 Sep 2017 09:38:23 -0400 Subject: [PATCH] Add unminimize script for reverting minimization on running system --- live-build/auto/build | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index a1a6b81f..4342721d 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -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 \