Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement clean_chroot, #267

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions chroot-script
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
# shellcheck disable=SC2317 # shellcheck has trouble understanding the code flow in this file

# error_handler {{{
error_handler() {
last_exit_code="$?"
last_bash_command="$BASH_COMMAND"
echo "Unexpected non-zero exit code $last_exit_code in ${BASH_SOURCE[*]} at line ${BASH_LINENO[*]} detected!
last bash command: $last_bash_command"
exit 1
}

set -e
set -E
set -o pipefail
Expand Down Expand Up @@ -260,7 +268,7 @@
debconf-set-selections < /etc/debootstrap/debconf-selections
}

if [ "$PACKAGES" = 'yes' ] ; then

Check warning on line 271 in chroot-script

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Possible misspelling: PACKAGES may not be assigned. Did you mean KPACKAGE? [SC2153](https://github.com/koalaman/shellcheck/wiki/SC2153) Raw Output: ./chroot-script:271:9:info:Possible misspelling: PACKAGES may not be assigned. Did you mean KPACKAGE? [SC2153](https://github.com/koalaman/shellcheck/wiki/SC2153)
PACKAGES_FILE="/etc/debootstrap/packages"

if [ "$ARCH" = 'arm64' ]; then
Expand Down
98 changes: 66 additions & 32 deletions grml-debootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
set -E
set -o pipefail
trap "error_handler" ERR
export -f "error_handler"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is removing the export of the error_handler from grml-debootstrap and addition of it to chroot script related to the environment cleanup, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you mentioned this in a comment as I just noticed:

If we use env -i then we can no longer export shell functions. So export -f "error_handler" had to be removed.

We should squash all the relevant commits into one single commit and provide that useful information you collected into the commit message :)

Do you want me to give this a try or would you prefer to try on your own?

# }}}

# variables {{{
Expand Down Expand Up @@ -81,11 +80,6 @@
[ -n "$VMSIZE" ] || VMSIZE="2G"
[ -n "$GRUB_INSTALL" ] || GRUB_INSTALL='yes'

# inside the chroot system locales might not be available, so use minimum:
export LANG=C
export LC_ALL=C
export LANGUAGE=C

# make sure interactive mode is only executed when
# using an empty configuration file or option --interactive
INTERACTIVE=''
Expand Down Expand Up @@ -298,16 +292,16 @@
# make sure nothing is left inside chroot so we can unmount it
for service in ssh mdadm ; do
if [ -x "${MNTPOINT}/etc/init.d/${service}" ] ; then
chroot "$MNTPOINT" "/etc/init.d/${service}" stop
clean_chroot "$MNTPOINT" "/etc/init.d/${service}" stop
fi
done

[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1 || true
[ -x "$MNTPOINT"/bin/umount ] && clean_chroot "$MNTPOINT" umount -a >/dev/null 2>&1 || true

Check warning on line 299 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Note that A && B || C is not if-then-else. C may run when A is true. [SC2015](https://github.com/koalaman/shellcheck/wiki/SC2015) Raw Output: ./grml-debootstrap:299:37:info:Note that A && B || C is not if-then-else. C may run when A is true. [SC2015](https://github.com/koalaman/shellcheck/wiki/SC2015)

# ugly, but make sure we really don't leave anything (/proc /proc and
# /dev /dev are intended, trying to work around timing issues, see #657023)
for ARG in /run/udev /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do
[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true
[ -x "$MNTPOINT"/bin/umount ] && clean_chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true

Check warning on line 304 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Note that A && B || C is not if-then-else. C may run when A is true. [SC2015](https://github.com/koalaman/shellcheck/wiki/SC2015) Raw Output: ./grml-debootstrap:304:39:info:Note that A && B || C is not if-then-else. C may run when A is true. [SC2015](https://github.com/koalaman/shellcheck/wiki/SC2015)
umount "$MNTPOINT"/$ARG >/dev/null 2>&1 || true
done

Expand Down Expand Up @@ -821,7 +815,7 @@
prompt_for_release()
{
[ -n "$RELEASE" ] && DEFAULT_RELEASE="$RELEASE" || DEFAULT_RELEASE='bullseye'
RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \

Check warning on line 818 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:818:61:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 818 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:818:- RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \ grml-debootstrap:818:+ RELEASE="$(dialog --stdout --title "${PN}" --default-item "$DEFAULT_RELEASE" --menu \
"Please enter the Debian release you would like to use for installation:" \
0 50 8 \
buster Debian/10 \
Expand Down Expand Up @@ -873,7 +867,7 @@
{
[ -n "$ISO" ] && DEFAULT_MIRROR='local' || DEFAULT_MIRROR='net'

CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \

Check warning on line 870 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:870:64:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 870 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:870:- CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \ grml-debootstrap:870:+ CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item "$DEFAULT_MIRROR" \
--menu "Where do you want to install from?" 0 0 0 \
net "install via network (downloading from mirror)" \
local "install from local directory/mirror"
Expand All @@ -883,13 +877,13 @@
[ -n "$MIRROR" ] || MIRROR='http://deb.debian.org/debian'
MIRROR="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter Debian mirror you would like to use for installing packages." \
0 0 $MIRROR)" || bailout

Check warning on line 880 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:880:20:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 880 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:880:- 0 0 $MIRROR)" || bailout grml-debootstrap:880:+ 0 0 "$MIRROR")" || bailout

else # CHOOSE_MIRROR == local
[ -n "$ISO" ] || ISO='/mnt/mirror'
ISO="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter directory name you would like to use for installing packages." \
0 0 $ISO)" || bailout

Check warning on line 886 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:886:20:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 886 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:886:- 0 0 $ISO)" || bailout grml-debootstrap:886:+ 0 0 "$ISO")" || bailout
fi
}
# }}}
Expand Down Expand Up @@ -1592,16 +1586,16 @@
if [ -n "$ARM_EFI_TARGET" ]; then
einfo "Installing Grub as bootloader into EFI."

chroot "${MNTPOINT}" grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck --no-nvram --removable
clean_chroot "${MNTPOINT}" grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck --no-nvram --removable
# Has chroot-script installed GRUB to MBR using grub-install (successfully), already?
# chroot-script skips installation for unset ${GRUB}
elif [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v | grep -Fq GRUB; then
einfo "Installing Grub as bootloader."

if ! chroot "${MNTPOINT}" dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then
if ! clean_chroot "${MNTPOINT}" dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-pc package not present yet, installing it therefore."
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-pc
clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-pc
fi

mkdir -p "${MNTPOINT}/boot/grub"
Expand All @@ -1616,48 +1610,48 @@
mkdir -p "${MNTPOINT}"/boot/efi
mount -t vfat "${EFI_TARGET}" "${MNTPOINT}"/boot/efi

if ! chroot "${MNTPOINT}" dpkg --list shim-signed 2>/dev/null | grep -q '^ii' ; then
if ! clean_chroot "${MNTPOINT}" dpkg --list shim-signed 2>/dev/null | grep -q '^ii' ; then
echo "Notice: shim-signed package not present yet, installing it therefore."
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y --no-install-recommends install $DPKG_OPTIONS shim-signed
clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS shim-signed
fi

if [ "$(dpkg --print-architecture)" = "arm64" ]; then
if ! chroot "${MNTPOINT}" dpkg --list grub-efi-arm64-signed 2>/dev/null | grep -q '^ii' ; then
if ! clean_chroot "${MNTPOINT}" dpkg --list grub-efi-arm64-signed 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-efi-arm64-signed package not present yet, installing it therefore."
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-arm64-bin grub-efi-arm64-signed
clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-arm64-bin grub-efi-arm64-signed
fi
chroot "$MNTPOINT" grub-install --target=arm64-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
clean_chroot "$MNTPOINT" grub-install --target=arm64-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
elif [ "$(dpkg --print-architecture)" = "i386" ]; then
if ! chroot "${MNTPOINT}" dpkg --list grub-efi-ia32-signed 2>/dev/null | grep -q '^ii' ; then
if ! clean_chroot "${MNTPOINT}" dpkg --list grub-efi-ia32-signed 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-efi-ia32-signed package not present yet, installing it therefore."
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-ia32-bin grub-efi-ia32-signed
clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-ia32-bin grub-efi-ia32-signed
fi
chroot "$MNTPOINT" grub-install --target=i386-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
chroot "$MNTPOINT" grub-install --target=i386-pc "/dev/$LOOP_DISK"
clean_chroot "$MNTPOINT" grub-install --target=i386-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
clean_chroot "$MNTPOINT" grub-install --target=i386-pc "/dev/$LOOP_DISK"
else
if ! chroot "${MNTPOINT}" dpkg --list grub-efi-amd64-signed 2>/dev/null | grep -q '^ii' ; then
if ! clean_chroot "${MNTPOINT}" dpkg --list grub-efi-amd64-signed 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-efi-amd64-signed package not present yet, installing it therefore."
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-amd64-bin grub-efi-amd64-signed
clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS grub-efi-amd64-bin grub-efi-amd64-signed
fi
chroot "$MNTPOINT" grub-install --target=x86_64-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
chroot "$MNTPOINT" grub-install --target=i386-pc "/dev/$LOOP_DISK"
clean_chroot "$MNTPOINT" grub-install --target=x86_64-efi --efi-directory=/boot/efi --uefi-secure-boot --removable "/dev/$LOOP_DISK"
clean_chroot "$MNTPOINT" grub-install --target=i386-pc "/dev/$LOOP_DISK"
fi
else
dd if="${MNTPOINT}/usr/lib/grub/i386-pc/boot.img" of="${ORIG_TARGET}" conv=notrunc bs=440 count=1
case "${_opt_filesystem}" in
f2fs)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos f2fs
clean_chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos f2fs
;;
xfs)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos xfs
clean_chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos xfs
;;
# NOTE - we might need to distinguish between further filesystems
*)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2
clean_chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2
;;
esac

Expand All @@ -1680,8 +1674,8 @@
fi

einfo "Updating grub configuration file."
chroot "${MNTPOINT}" update-grub
chroot "${MNTPOINT}" sync
clean_chroot "${MNTPOINT}" update-grub
clean_chroot "${MNTPOINT}" sync

case "$RELEASE" in
jessie)
Expand Down Expand Up @@ -1759,6 +1753,46 @@
}
# }}}

# clean_chroot {{{
clean_chroot() {
# inside the chroot system locales might not be available, so use minimum:
local -a env_vars=(
"LANG=C"
"LC_ALL=C"
"LANGUAGE=C"
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
)

# List of additional environment variables to include if set
local -a additional_vars=("http_proxy" "https_proxy" "ALL_PROXY")

# Loop through the additional environment variables and add them if set
for var in "${additional_vars[@]}"; do
if [[ -n "${!var}" ]]; then
env_vars+=("$var=${!var}")
fi
done

# Capture additional environment variables passed as arguments.
for var in "$@"; do
if [[ "$var" == *=* ]]; then
env_vars+=("$var")
else
break
fi
done

# First argument is the chroot directory.
local chroot_dir="$1"

# Remaining arguments are for the command to be executed in the chroot environment.
local chroot_command=("${@:2}")

# Run chroot, then env -i with the specified environment variables inside the chroot
chroot "$chroot_dir" /usr/bin/env -i "${env_vars[@]}" "${chroot_command[@]}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we even don't need to hardcode the /usr/bin/env full path?

}
# }}}

# prepare chroot via chroot-script {{{
preparechroot() {
einfo "Preparing chroot system"
Expand Down Expand Up @@ -1816,12 +1850,12 @@
[ -n "$TUNE2FS" ] && echo "TUNE2FS='${TUNE2FS//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES"
[ -n "$VMSIZE" ] && echo "VMSIZE='${VMSIZE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES"

cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script

Check warning on line 1853 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:1853:6:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 1853 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:1853:- cp $VERBOSE "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script grml-debootstrap:1853:+ cp "$VERBOSE" "${CONFFILES}"/chroot-script "${MNTPOINT}"/bin/chroot-script
chmod 755 "${MNTPOINT}"/bin/chroot-script
[ -d "$MNTPOINT"/etc/debootstrap/ ] || mkdir "$MNTPOINT"/etc/debootstrap/

# make sure we have our files for later use via chroot-script
cp $VERBOSE "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/

Check warning on line 1858 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:1858:6:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 1858 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:1858:- cp $VERBOSE "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/ grml-debootstrap:1858:+ cp "$VERBOSE" "${CONFFILES}/config" "${MNTPOINT}"/etc/debootstrap/
# make sure we adjust the configuration variables accordingly:
sed -i "s#RELEASE=.*#RELEASE=\"$RELEASE\"#" "${MNTPOINT}"/etc/debootstrap/config
sed -i "s#TARGET=.*#TARGET=\"$TARGET\"#" "${MNTPOINT}"/etc/debootstrap/config
Expand All @@ -1840,20 +1874,20 @@
PACKAGES_FILE="packages-arm64"
fi

cp $VERBOSE "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \

Check warning on line 1877 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./grml-debootstrap:1877:8:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 1877 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:1877:- cp $VERBOSE "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \ grml-debootstrap:1877:+ cp "$VERBOSE" "${_opt_packages:-$CONFFILES/$PACKAGES_FILE}" \
"${MNTPOINT}/etc/debootstrap/${PACKAGES_FILE}"
fi

# debconf preseeding:
_opt_debconf=${_opt_debconf:-$CONFFILES/debconf-selections}
[ -f "${_opt_debconf}" ] && [ "$DEBCONF" = 'yes' ] && \
cp $VERBOSE "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections

Check failure on line 1884 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:1884:- cp $VERBOSE "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections grml-debootstrap:1884:+ cp "$VERBOSE" "${_opt_debconf}" "${MNTPOINT}"/etc/debootstrap/debconf-selections

# copy scripts that should be executed inside the chroot:
_opt_chroot_scripts=${_opt_chroot_scripts:-$CONFFILES/chroot-scripts/}
[ -d "$_opt_chroot_scripts" ] && [ "$CHROOT_SCRIPTS" = 'yes' ] && {
mkdir -p "${MNTPOINT}"/etc/debootstrap/chroot-scripts
cp -a $VERBOSE "${_opt_chroot_scripts}"/* "${MNTPOINT}"/etc/debootstrap/chroot-scripts/

Check failure on line 1890 in grml-debootstrap

View workflow job for this annotation

GitHub Actions / shellcheck grml-debootstrap

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: grml-debootstrap:1890:- cp -a $VERBOSE "${_opt_chroot_scripts}"/* "${MNTPOINT}"/etc/debootstrap/chroot-scripts/ grml-debootstrap:1890:+ cp -a "$VERBOSE" "${_opt_chroot_scripts}"/* "${MNTPOINT}"/etc/debootstrap/chroot-scripts/
}

# notice: do NOT use $CHROOT_VARIABLES inside chroot but statically file instead!
Expand Down Expand Up @@ -2052,9 +2086,9 @@
mount -t devtmpfs udev "${MNTPOINT}"/dev
mount -t devpts devpts "${MNTPOINT}"/dev/pts
if [ "$DEBUG" = "true" ] ; then
chroot "$MNTPOINT" /bin/bash -x /bin/chroot-script
clean_chroot "$MNTPOINT" /bin/bash -x /bin/chroot-script
else
chroot "$MNTPOINT" /bin/chroot-script
clean_chroot "$MNTPOINT" /bin/chroot-script
fi
try_umount 3 "$MNTPOINT"/dev/pts
try_umount 3 "$MNTPOINT"/dev
Expand Down