Advertisement
barjac

mychroot

May 21st, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #!/bin/bash
  2. # mychroot
  3. [[ ${#1} > 0 ]] && [[ -e /dev/$1 ]] && [[ $UID = 0 ]] ||\
  4. { echo "Usage (as root)  - mychroot sdxy"; exit 1; }
  5. mount /dev/$1 /mnt/
  6. mps=(dev proc sys)
  7. for i in ${mps[@]}; do
  8. mount --bind /$i/ /mnt/$i/
  9. done
  10. chroot /mnt/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement