Skip to content

Instantly share code, notes, and snippets.

@duckinator
Created November 24, 2010 18:11
Show Gist options
  • Select an option

  • Save duckinator/714114 to your computer and use it in GitHub Desktop.

Select an option

Save duckinator/714114 to your computer and use it in GitHub Desktop.
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
dirs=(/dev /dev/pts /dev/shm /tmp /home)
case $1 in
start)
stat_busy "Starting Arch32 chroot"
for d in "${dirs[@]}"; do
mount -o bind $d /opt/arch32/$d
done
mount -t proc none /opt/arch32/proc
mount -t sysfs none /opt/arch32/sys
add_daemon arch32
stat_done
;;
stop)
stat_busy "Stopping Arch32 chroot"
for (( i = ${#dirs[@]} - 1; i >= 0; i-- )); do
umount "/opt/arch32${dirs[i]}"
done
umount /opt/arch32/{proc,sys}
rm_daemon arch32
stat_done
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment