Skip to content

Instantly share code, notes, and snippets.

@ngnguyen1
Created September 2, 2019 14:39
Show Gist options
  • Save ngnguyen1/e03f313fa9c3f3db590fe8b35feb5953 to your computer and use it in GitHub Desktop.
Save ngnguyen1/e03f313fa9c3f3db590fe8b35feb5953 to your computer and use it in GitHub Desktop.
#!/sbin/openrc-run
depend() {
need localmount
need bootmisc
}
start() {
ebegin "Mounting chroot directories"
mount -o rbind /dev /mnt/mychroot/dev > /dev/null &
mount -t proc none /mnt/mychroot/proc > /dev/null &
mount -o bind /sys /mnt/mychroot/sys > /dev/null &
mount -o bind /tmp /mnt/mychroot/tmp > /dev/null &
eend $? "An error occurred while mounting chroot directories"
}
stop() {
ebegin "Unmounting chroot directories"
umount -f /mnt/mychroot/dev > /dev/null &
umount -f /mnt/mychroot/proc > /dev/null &
umount -f /mnt/mychroot/sys > /dev/null &
umount -f /mnt/mychroot/tmp > /dev/null &
eend $? "An error occurred while unmounting chroot directories"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment