This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 13th, 2012  |  syntax: Bash  |  size: 0.69 KB  |  views: 89  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/sbin/runscript
  2.  
  3. . /etc/init.d/functions.sh
  4.  
  5. dirs=(/dev /dev/pts /dev/shm /tmp /home /var/run /var/lib/dbus)
  6.  
  7. chrootarch=32
  8. #chrootarch=64
  9.  
  10. start() {
  11.     ebegin "Starting Arch${chrootarch} chroot"
  12.     for d in "${dirs[@]}"; do
  13.         mount -o bind $d /opt/arch${chrootarch}$d
  14.     done
  15.     mount -t proc none /opt/arch${chrootarch}/proc
  16.     mount -t sysfs none /opt/arch${chrootarch}/sys
  17.     eend 0
  18. }
  19.  
  20. stop() {
  21.     ebegin "Stopping Arch${chrootarch} chroot"
  22.     for (( i = ${#dirs[@]} - 1; i >= 0; i-- )); do
  23.         umount "/opt/arch${chrootarch}${dirs[i]}"
  24.     done
  25.     umount /opt/arch${chrootarch}/{proc,sys}
  26.     eend 0
  27. }
  28. restart() {
  29.     $0 stop
  30.     sleep 1
  31.     $0 start
  32. }
clone this paste RAW Paste Data