summaryrefslogtreecommitdiffstats
path: root/hooks/eatmydata/customize.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:14:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:14:39 +0000
commitee17e45964b786b48b455959dfe68715971893fb (patch)
tree118f40aa65dc838499053413b05adfd00f839c62 /hooks/eatmydata/customize.sh
parentInitial commit. (diff)
downloadmmdebstrap-ee17e45964b786b48b455959dfe68715971893fb.tar.xz
mmdebstrap-ee17e45964b786b48b455959dfe68715971893fb.zip
Adding upstream version 1.4.3.upstream/1.4.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'hooks/eatmydata/customize.sh')
-rwxr-xr-xhooks/eatmydata/customize.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/hooks/eatmydata/customize.sh b/hooks/eatmydata/customize.sh
new file mode 100755
index 0000000..c675848
--- /dev/null
+++ b/hooks/eatmydata/customize.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -eu
+
+if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then
+ set -x
+fi
+
+rootdir="$1"
+
+if [ -e "$rootdir/var/lib/dpkg/arch" ]; then
+ chrootarch=$(head -1 "$rootdir/var/lib/dpkg/arch")
+else
+ chrootarch=$(dpkg --print-architecture)
+fi
+libdir="/usr/lib/$(dpkg-architecture -a "$chrootarch" -q DEB_HOST_MULTIARCH)"
+
+# if eatmydata was actually installed properly, then we are not removing
+# anything here
+if ! chroot "$rootdir" dpkg-query --show eatmydata; then
+ rm "$rootdir/usr/bin/eatmydata"
+fi
+if ! chroot "$rootdir" dpkg-query --show libeatmydata1; then
+ rm "$rootdir$libdir"/libeatmydata.so*
+fi
+
+rm "$rootdir/usr/bin/dpkg"
+chroot "$rootdir" dpkg-divert --local --rename --remove /usr/bin/dpkg
+
+sync