Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@serialhex
Created April 3, 2011 03:22
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 serialhex/900151 to your computer and use it in GitHub Desktop.
Save serialhex/900151 to your computer and use it in GitHub Desktop.
trying to chroot into a gentoo system on my computer...
source /root/.bashrc
echo "doing cool gentoo-ish things..."
/usr/sbin/env-update
source /etc/profile
#!/bin/bash
if [[ `whoami` != root ]]; then
echo "this script must be run as root, so sudo, yo!"
exit
fi
echo "getting path to chroot..."
rootchange=`find /usr/*bin -name chroot`
echo $rootchange
echo "getting host info to keep internets working..."
cp -L /etc/resolv.conf /gentoo/etc/
echo "mounting wonky filesystems to keep everything sane..."
mount -t proc none /gentoo/proc
mount --rbind /dev /gentoo/dev
echo "getting into system..."
env -i HOME=$HOME TERM=$TERM $rootchange /gentoo /bin/bash --rcfile /root/.bash_chroot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment