[Merge] lp:~rbalint/livecd-rootfs/minimize-unminimize into lp:~vorlon/livecd-rootfs/minimizing
Balint Reczey
balint.reczey at canonical.com
Wed May 10 23:31:06 UTC 2017
I moved the script to /usr/local/sbin for now, but I consider the discussion still open regarding packaging minimize/unminimize instead of the current approach.
Diff comments:
> === modified file 'live-build/auto/build'
> --- live-build/auto/build 2017-05-09 03:15:14 +0000
> +++ live-build/auto/build 2017-05-09 10:23:04 +0000
> @@ -72,6 +72,62 @@
>
> # 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/bin
Hmm, I realized /opt/bin should be handled by sysadmin, too, thus it is not much better than /usr/local/sbin . :-(
> + cat > chroot/usr/local/bin/unminimize <<'EOF'
> +#!/bin/sh
> +
> +set -e
> +
> +TMP=$(mktemp -d)
> +cleanup() {
> + if [ -f $TMP/excludes ]; then
> + echo "Re-enabling installation of all documentation in dpkg failed." 1>&2
> + mv $TMP/excludes /etc/dpkg/dpkg.cfg.d/excludes
> + fi
> + rm -rf "$TMP"
> +}
> +trap cleanup EXIT
> +
> +if [ -f /usr/sbin/update-initramfs.divert-minimize ]; then
> + echo "Re-enabling intiramfs..."
> + rm -f /usr/sbin/update-initramfs
> + dpkg-divert --remove --rename /usr/sbin/update-initramfs
> + update-initramfs -u -k all
> +else
> + echo "Initramfs is already enabled, skipping re-enabling it."
> +fi
> +
> +if [ -f /etc/dpkg/dpkg.cfg.d/excludes ]; then
> + echo "Re-enabling installation of all documentation in dpkg..."
> + mv /etc/dpkg/dpkg.cfg.d/excludes $TMP/excludes
> + echo "Updating package list and upgrading packages..."
> + apt-get update
> + apt-get upgrade
> + echo "Installing missing documentation from packages..."
> + (cd $TMP
> + echo "Downloading packages with files in /usr/share/man/ ..."
> + dpkg -S /usr/share/man/ |sed 's|, |\n|g;s|: [^:]*$||' | xargs apt-get download
> + echo "Downloading packages with missing files 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 | xargs apt-get download
> + mkdir target
> + echo "Extracting packages to temporary location..."
> + for i in *.deb; do dpkg-deb -x $i target/; done
> + echo "Restoring missing documentation on the system ..."
> + cp -rpn target/usr/share/man/* /usr/share/man/
> + cp -rpn target/usr/share/doc/* /usr/share/doc/
> + if dpkg --verify > /dev/null; then
> + echo "Documentation is restored successfully."
> + rm $TMP/excludes
> + fi
> + )
> +else
> + echo "Dpkg already installs documentation, skipping re-enabling it."
> +fi
> +EOF
> + chmod +x chroot/usr/local/bin/unminimize
> fi
>
> Chroot chroot "dpkg-divert --quiet --add \
--
https://code.launchpad.net/~rbalint/livecd-rootfs/minimize-unminimize/+merge/323157
Your team Ubuntu Core Development Team is requested to review the proposed merge of lp:~rbalint/livecd-rootfs/minimize-unminimize into lp:~vorlon/livecd-rootfs/minimizing.
More information about the Ubuntu-reviews
mailing list