2022-05-25 14:02:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
export LC_ALL=C.UTF-8
|
|
|
|
cat << 'SCRIPT' > /tmp/script.sh
|
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
echo "MMDEBSTRAP_APT_CONFIG $MMDEBSTRAP_APT_CONFIG"
|
|
|
|
echo "$MMDEBSTRAP_HOOK" >> /tmp/hooks
|
|
|
|
[ "$MMDEBSTRAP_MODE" = "root" ]
|
|
|
|
echo test-content $MMDEBSTRAP_HOOK > test
|
2023-10-23 08:41:46 +00:00
|
|
|
{{ CMD }} --hook-helper "$1" "$MMDEBSTRAP_MODE" "$MMDEBSTRAP_HOOK" '' 1 upload test /test <&$MMDEBSTRAP_HOOKSOCK >&$MMDEBSTRAP_HOOKSOCK
|
2022-05-25 14:02:09 +00:00
|
|
|
rm test
|
|
|
|
echo "content inside chroot:"
|
|
|
|
cat "$1/test"
|
|
|
|
[ "test-content $MMDEBSTRAP_HOOK" = "$(cat "$1/test")" ]
|
2023-10-23 08:41:46 +00:00
|
|
|
{{ CMD }} --hook-helper "$1" "$MMDEBSTRAP_MODE" "$MMDEBSTRAP_HOOK" '' 1 download /test test <&$MMDEBSTRAP_HOOKSOCK >&$MMDEBSTRAP_HOOKSOCK
|
2022-05-25 14:02:09 +00:00
|
|
|
echo "content outside chroot:"
|
|
|
|
cat test
|
|
|
|
[ "test-content $MMDEBSTRAP_HOOK" = "$(cat test)" ]
|
|
|
|
rm test
|
|
|
|
SCRIPT
|
|
|
|
chmod +x /tmp/script.sh
|
|
|
|
{{ CMD }} --mode=root --variant=apt \
|
|
|
|
--setup-hook=/tmp/script.sh \
|
|
|
|
--extract-hook=/tmp/script.sh \
|
|
|
|
--essential-hook=/tmp/script.sh \
|
|
|
|
--customize-hook=/tmp/script.sh \
|
|
|
|
{{ DIST }} /tmp/debian-chroot {{ MIRROR }}
|
|
|
|
printf "setup\nextract\nessential\ncustomize\n" | diff -u - /tmp/hooks
|
|
|
|
rm /tmp/script.sh /tmp/hooks
|
|
|
|
rm -r /tmp/debian-chroot
|