randalltux

drachroot.sh

Mar 13th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/sh
  2. # Enter the DracOS chroot Environment
  3.  
  4. # Checking root
  5. if [ "$(id -u)" != 0 ]; then
  6.     echo "ERROR! Run this script with root user!"
  7.     exit 1
  8. fi
  9.  
  10. export dracos=/mnt/dracos
  11. mount /dev/sda2 $dracos
  12. mount --bind /dev $dracos/dev
  13. mount -t devpts devpts $dracos/dev/pts
  14. mount -t tmpfs shm $dracos/dev/shm
  15. mount -t proc proc $dracos/proc
  16. mount -t sysfs sysfs $dracos/sys
  17. chroot "$dracos" /usr/bin/env -i \
  18.     HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
  19.     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin \
  20.     /bin/bash --login
Advertisement
Add Comment
Please, Sign In to add comment