summaryrefslogtreecommitdiffstats
path: root/tests/hook-directory
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 /tests/hook-directory
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 'tests/hook-directory')
-rw-r--r--tests/hook-directory49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/hook-directory b/tests/hook-directory
new file mode 100644
index 0000000..c9b22f9
--- /dev/null
+++ b/tests/hook-directory
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -eu
+export LC_ALL=C.UTF-8
+for h in hookA hookB; do
+ mkdir /tmp/$h
+ for s in setup extract essential customize; do
+ cat << SCRIPT > /tmp/$h/${s}00.sh
+#!/bin/sh
+echo $h/${s}00 >> "\$1/$s"
+SCRIPT
+ chmod +x /tmp/$h/${s}00.sh
+ cat << SCRIPT > /tmp/$h/${s}01.sh
+echo $h/${s}01 >> "\$1/$s"
+SCRIPT
+ chmod +x /tmp/$h/${s}01.sh
+ done
+done
+{{ CMD }} --mode=root --variant=apt \
+ --setup-hook='echo cliA/setup >> "$1"/setup' \
+ --extract-hook='echo cliA/extract >> "$1"/extract' \
+ --essential-hook='echo cliA/essential >> "$1"/essential' \
+ --customize-hook='echo cliA/customize >> "$1"/customize' \
+ --hook-dir=/tmp/hookA \
+ --setup-hook='echo cliB/setup >> "$1"/setup' \
+ --extract-hook='echo cliB/extract >> "$1"/extract' \
+ --essential-hook='echo cliB/essential >> "$1"/essential' \
+ --customize-hook='echo cliB/customize >> "$1"/customize' \
+ --hook-dir=/tmp/hookB \
+ --setup-hook='echo cliC/setup >> "$1"/setup' \
+ --extract-hook='echo cliC/extract >> "$1"/extract' \
+ --essential-hook='echo cliC/essential >> "$1"/essential' \
+ --customize-hook='echo cliC/customize >> "$1"/customize' \
+ {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
+printf "cliA/setup\nhookA/setup00\nhookA/setup01\ncliB/setup\nhookB/setup00\nhookB/setup01\ncliC/setup\n" | diff -u - /tmp/debian-chroot/setup
+printf "cliA/extract\nhookA/extract00\nhookA/extract01\ncliB/extract\nhookB/extract00\nhookB/extract01\ncliC/extract\n" | diff -u - /tmp/debian-chroot/extract
+printf "cliA/essential\nhookA/essential00\nhookA/essential01\ncliB/essential\nhookB/essential00\nhookB/essential01\ncliC/essential\n" | diff -u - /tmp/debian-chroot/essential
+printf "cliA/customize\nhookA/customize00\nhookA/customize01\ncliB/customize\nhookB/customize00\nhookB/customize01\ncliC/customize\n" | diff -u - /tmp/debian-chroot/customize
+for s in setup extract essential customize; do
+ rm /tmp/debian-chroot/$s
+done
+tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
+for h in hookA hookB; do
+ for s in setup extract essential customize; do
+ rm /tmp/$h/${s}00.sh
+ rm /tmp/$h/${s}01.sh
+ done
+ rmdir /tmp/$h
+done
+rm -r /tmp/debian-chroot