Sanity checks, another tmpfs

This commit is contained in:
Zach Dykstra 2020-02-18 00:12:16 -06:00
parent b584217033
commit 0307f08196
1 changed files with 16 additions and 7 deletions

View File

@ -1,10 +1,19 @@
#!/bin/bash
BASE="$( mktemp -d /tmp/zfs.XXXX )"
fs="$( zfs list -H -o name ${1} )"
mkdir /mnt
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -B /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts
if [ "$fs" != "${1}" ]; then
echo "Filesystem $1 doesn't exist"
exit
fi
mount -o zfsutil -t zfs "${1}" /mnt
chroot /mnt
mount -o zfsutil -t zfs "${1}" "${BASE}"
mount -t proc proc "${BASE}/proc"
mount -t sysfs sys "${BASE}/sys"
mount -B /dev "${BASE}/dev"
mount -B /tmp "${BASE}/var/tmp"
mount -t devpts pts "${BASE}/dev/pts"
chroot "${BASE}" /bin/bash
umount "${1}"