summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:04:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:04:12 +0000
commit184e81741dd97773953241571cd059e5cadea9aa (patch)
treed3990b8bc6d54cb2e0dd625fedb39219fa883149 /hooks
parentAdding debian version 1.4.3-6. (diff)
downloadmmdebstrap-184e81741dd97773953241571cd059e5cadea9aa.tar.xz
mmdebstrap-184e81741dd97773953241571cd059e5cadea9aa.zip
Merging upstream version 1.5.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/copy-host-apt-sources-and-preferences/setup00.sh9
-rwxr-xr-xhooks/file-mirror-automount/setup00.sh2
-rwxr-xr-xhooks/maybe-merged-usr/essential00.sh4
-rwxr-xr-xhooks/maybe-merged-usr/extract00.sh20
-rwxr-xr-xhooks/maybe-merged-usr/setup00.sh20
5 files changed, 44 insertions, 11 deletions
diff --git a/hooks/copy-host-apt-sources-and-preferences/setup00.sh b/hooks/copy-host-apt-sources-and-preferences/setup00.sh
index 07caa78..9aafd78 100755
--- a/hooks/copy-host-apt-sources-and-preferences/setup00.sh
+++ b/hooks/copy-host-apt-sources-and-preferences/setup00.sh
@@ -1,4 +1,13 @@
#!/bin/sh
+#
+# This script makes sure that the apt sources.list and preferences from outside
+# the chroot also exist inside the chroot by *appending* them to any existing
+# files. If you do not want to keep the original content, add another setup
+# hook before this one which cleans up the files you don't want to keep.
+#
+# If instead of copying sources.list verbatim you want to mangle its contents,
+# consider using python-apt for that. An example can be found in the Debian
+# packaging of mmdebstrap in ./debian/tests/sourcesfilter
set -eu
diff --git a/hooks/file-mirror-automount/setup00.sh b/hooks/file-mirror-automount/setup00.sh
index 61f60f2..6ccbdaf 100755
--- a/hooks/file-mirror-automount/setup00.sh
+++ b/hooks/file-mirror-automount/setup00.sh
@@ -15,7 +15,7 @@ env APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get indextargets --no-release-info -
| while read -r path; do
mkdir -p "$rootdir/run/mmdebstrap"
if [ ! -d "/$path" ]; then
- echo "/$path is not an existing directory" >&2
+ echo "W: /$path is not an existing directory" >&2
continue
fi
case $MMDEBSTRAP_MODE in
diff --git a/hooks/maybe-merged-usr/essential00.sh b/hooks/maybe-merged-usr/essential00.sh
index a23f2f7..656057e 100755
--- a/hooks/maybe-merged-usr/essential00.sh
+++ b/hooks/maybe-merged-usr/essential00.sh
@@ -15,6 +15,10 @@ case "$ver" in
echo "usr-is-merged package from src:usrmerge installed -- not running merged-usr essential hook" >&2
exit 0
;;
+ 'not-installed ')
+ echo "usr-is-merged was not installed in a previous hook -- not running merged-usr essential hook" >&2
+ exit 0
+ ;;
*)
echo "unexpected situation for package usr-is-merged: $ver" >&2
exit 1
diff --git a/hooks/maybe-merged-usr/extract00.sh b/hooks/maybe-merged-usr/extract00.sh
index dc88450..00bb037 100755
--- a/hooks/maybe-merged-usr/extract00.sh
+++ b/hooks/maybe-merged-usr/extract00.sh
@@ -4,12 +4,22 @@ set -eu
env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get update --error-on=any
-# if the usr-is-merged package cannot be installed with apt, do nothing
-if ! env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
- echo "no package called usr-is-merged found -- not running merged-usr extract hook" >&2
- exit 0
+if env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
+ # if apt-cache exited successfully, then usr-is-merged exists either as
+ # a real or virtual package
+ if env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged 2>/dev/null | grep -q "Package: usr-is-merged"; then
+ echo "usr-is-merged found -- running merged-usr extract hook" >&2
+ else
+ # The usr-is-merged must be virtual, so assume that nothing
+ # has to be done. This is the case with Debian Trixie or later
+ # or with Ubuntu Lunar or later
+ echo "usr-is-merged found but not real -- not running merged-usr extract hook" >&2
+ exit 0
+ fi
else
- echo "package usr-is-merged found -- running merged-usr extract hook" >&2
+ # if the usr-is-merged package cannot be installed with apt, do nothing
+ echo "no package providing usr-is-merged found -- not running merged-usr extract hook" >&2
+ exit 0
fi
# resolve the script path using several methods in order:
diff --git a/hooks/maybe-merged-usr/setup00.sh b/hooks/maybe-merged-usr/setup00.sh
index a6bd712..6568af2 100755
--- a/hooks/maybe-merged-usr/setup00.sh
+++ b/hooks/maybe-merged-usr/setup00.sh
@@ -4,12 +4,22 @@ set -eu
env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-get update --error-on=any
-# if the usr-is-merged package cannot be installed with apt, do nothing
-if ! env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
- echo "no package called usr-is-merged found -- not running merged-usr setup hook" >&2
- exit 0
+if env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged > /dev/null 2>&1; then
+ # if apt-cache exited successfully, then usr-is-merged exists either as
+ # a real or virtual package
+ if env --chdir="$1" APT_CONFIG="$MMDEBSTRAP_APT_CONFIG" apt-cache show --no-all-versions usr-is-merged 2>/dev/null | grep -q "Package: usr-is-merged"; then
+ echo "usr-is-merged found -- running merged-usr setup hook" >&2
+ else
+ # The usr-is-merged must be virtual, so assume that nothing
+ # has to be done. This is the case with Debian Trixie or later
+ # or with Ubuntu Lunar or later
+ echo "usr-is-merged found but not real -- not running merged-usr setup hook" >&2
+ exit 0
+ fi
else
- echo "package usr-is-merged found -- running merged-usr setup hook" >&2
+ # if the usr-is-merged package cannot be installed with apt, do nothing
+ echo "no package providing usr-is-merged found -- not running merged-usr setup hook" >&2
+ exit 0
fi
# resolve the script path using several methods in order: