windvn/path/wdvn-chroot

23 lines
335 B
Plaintext
Raw Normal View History

2022-08-10 00:00:49 +00:00
#!/bin/bash
2022-08-17 05:13:04 +00:00
trap ctrl_c INT
function ctrl_c() {
wdvn-chroot-end "$1"
exit 1
}
2022-08-10 00:00:49 +00:00
(
set -e
mount -o bind "/dev" "$1/dev"
mount -o bind "/dev/pts" "$1/dev/pts"
2022-08-10 16:33:48 +00:00
mount -o bind "/sys" "$1/sys"
2022-08-10 00:00:49 +00:00
mount -t proc none "$1/proc"
chroot "$1" ${@:2}
)
if [ $? != 0 ]; then
wdvn-chroot-end "$1"
exit 1
fi
wdvn-chroot-end "$1"