#!/bin/bash . /etc/rc.conf . /etc/rc.d/functions dirs=(/dev /dev/pts /tmp /home /media/data) case $1 in start) stat_busy "Starting Arch32 chroot" [[ ! -f /opt/arch32/.arch32 ]] && mount LABEL="arch32" /opt/arch32 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} [[ -f /opt/arch32/.arch32 ]] && umount /opt/arch32 rm_daemon arch32 stat_done ;; restart) $0 stop sleep 1 $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac exit 0