I want to create a script that executes the following commands, one after the other. The problem is the chroot command: everything after that command is not copied into the chroot environment as I want it. It is just copied into the normal terminal and executes after I exit from the chroot. Any ideas how to achieve this?

mkdir $HOME/live_boot
sudo debootstrap \
    --arch=amd64 \
    --variant=minbase \
    stretch $HOME/live_boot/chroot \
sudo chroot $HOME/live_boot/chroot
echo "TESTDEBIAN" > /etc/hostname
apt-get update && \
apt-get install -y --no-install-recommends \
    xserver-xorg-input-all xserver-xorg-video-fbdev xorg \
    linux-image-amd64 live-boot nano vim network-manager

chroot accepts passing a command, so I would put the relevant commands into a script an run this script as a chroot argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.