Hello,
I ran into this issue last year making a derivative (BunsenLabs) live
iso with live-build, and patched live-installer (53) to honour
/cdrom/live/filesystem.packages-remove and enable the functionality
described in Live-Manual 8.2.7 [1]
Just for reference, here's what we did:
1) I added finish-install.d/14copy-pkg-lists, which runs just before
15cdrom-detect, and copies
/cdrom/live/filesystem.packages-{remove,install} to
/var/cache/live-installer/ (arbitary choice of directory).
2) finish-install.d/60remove-live-packages now looks at
/var/cache/live-installer/filesystem.packages-remove for packages to remove.
3) Awk seems not to be available to the d-i hook scripts. I got "not
found" errors when trying to use the existing code in
60remove-live-packages, and likewise in a TTY shell during installation.
No other d-i hooks invoke awk.
I did note, however, that live-installer's postinst script calls it on
line 153 with no apparent ill-effects. (Maybe when install_live_system
() is called the cdrom has already been unmounted, so the absence
of/cdrom/live/filesystem.packages-install masks the unsupported awk?)
Anyway, to separate the first word on a line is a trivial task that can
be done by 'read', which I substituted thus (now adding the forgotten
read -r option):
# Remove packages as specified in specific package removal list
for list in /var/cache/live-installer/filesystem.packages-remove; do
if [ -e $list ]; then
while read -r package otherstuff; do
if [ -f /target/var/lib/dpkg/info/${package}.list ];
then
packages="$packages $package"
do_initrd=true
fi
done < "$list"
fi
done
4) Instead of purging packages individually I collected them all into a
list for a single run of
in-target apt-get --yes purge
NOTE) Users of live-build might want to add a binary hook script to make
sure that any live-only packages that have been provided as local .deb
files get added to filesystem.packages-remove. Otherwise they are left
off because local debs are installed in the first run of
chroot_install-packages.
FWIW I'm attaching the patch on live-installer 53.
[1]
https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#429
--
John
Description: Remove packages in /cdrom/live/filesystem.packages-remove.
Packages listed in /cdrom/live/filesystem.packages-remove
will be uninstalled at the finish-install phase of debian-installer.
Intended to enable correct functionality of Live-Manual 8.2.7,
raised and partly patched in Debian bug #655198.
Author: John Crawley <j...@bunsenlabs.org>
Last-Update: 2018-03-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+Warning: This udeb package is for building debian-installer images only.
+Do not install it on a normal Debian system.
+
+This is a patched version of live-installer-54
+to make live-build's package.list.chroot_{install,live} syntax work.
+
+Packages listed in /cdrom/live/filesystem.packages-remove
+will be uninstalled at the finish-install phase of debian-installer.
+
+A binary hook needs to be added to live-build's config/hooks/normal
+to ensure that local debs are also added to filesystem.packages-remove
+if they are in *.list.chroot_live
--- /dev/null
+++ b/finish-install.d/14copy-pkg-lists
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+# Copy package install/remove lists from cdrom before it's unmounted.
+
+lists='/cdrom/live/filesystem.packages-remove
/cdrom/live/filesystem.packages-install'
+cachedir='/var/cache/live-installer'
+
+for list in $lists
+do
+ if [ -e "$list" ]
+ then
+ mkdir -p "$cachedir"
+ cp "$list" "$cachedir"
+ fi
+done
--- a/finish-install.d/60remove-live-packages
+++ b/finish-install.d/60remove-live-packages
@@ -1,20 +1,18 @@
#!/bin/sh -e
do_manual_removal=true
+packages=
# Remove packages as specified in specific package removal list
-for list in /cdrom/live/filesystem.packages-remove; do
+for list in /var/cache/live-installer/filesystem.packages-remove; do
if [ -e $list ]; then
- do_manual_removal=
+ while read package otherstuff; do
+ if [ -f /target/var/lib/dpkg/info/${package}.list ];
then
+ packages="$packages $package"
do_initrd=true
- for package in $(awk '{ print $1 }' $list); do
- if [ -f /target/var/lib/dpkg/info/$package.list ]; then
- packages="$packages $package"
fi
- done
-
- in-target apt-get --yes purge $packages
+ done < "$list"
fi
done
@@ -25,12 +23,16 @@ done
if [ $do_manual_removal ]; then
for package in live-boot live-boot-initramfs-tools live-config
live-config-runit live-config-systemd live-config-sysvinit live-config-upstart
debian-installer-launcher casper; do
if [ -f /target/var/lib/dpkg/info/$package.list ]; then
- in-target apt-get --yes purge $package
+ packages="$packages $package"
do_initrd=true
fi
done
fi
+if [ -n "$packages" ]; then
+ in-target apt-get --yes purge $packages
+fi
+
if [ $do_initrd ]; then
in-target update-initramfs -k all -u
fi
--- a/debian/rules
+++ b/debian/rules
@@ -11,3 +11,8 @@ override_dh_auto_configure:
override_dh_builddeb:
dh_builddeb -- -Zxz -z9
+
+override_dh_clean:
+ dh_clean
+ chmod +x finish-install.d/14copy-pkg-lists
+