Skip to content

Instantly share code, notes, and snippets.

@foursixnine
Last active November 7, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foursixnine/e376e6ea76b40ac1f2c2e6be7b8e7f5e to your computer and use it in GitHub Desktop.
Save foursixnine/e376e6ea76b40ac1f2c2e6be7b8e7f5e to your computer and use it in GitHub Desktop.
# https://github.com/foursixnine/systeminstaller/blob/master/bootstrap-os.sh
# you could run all of this in a shell script
BOOTSTRAP_ROOTFS=/tmp/rootfs
mkdir ${BOOTSTRAP_ROOTFS}
mount -t ext3 -o noatime /dev/your/device ${BOOTSTRAP_ROOTFS}
mount -t proc proc ${BOOTSTRAP_ROOTFS}/proc/
mount -t sysfs sys ${BOOTSTRAP_ROOTFS}/sys/
mount -o bind /dev ${BOOTSTRAP_ROOTFS}/dev/
#Make sure that apt installs what we really need instead of what it thinks
tee ${BOOTSTRAP_ROOTFS}/resolv.conf <<_EOF_
nameserver 1.1.1.1
_EOF_
# this can run in a different shell, make sure you export your variables :)
export BOOTSTRAP_ROOTFS=/tmp/rootfs
LC_ALL=C chroot ${BOOTSTRAP_ROOTFS} /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment