cryptonas/cryptobox.conf.d/scripts/chroot-start.sh

24 lines
486 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
TMPDIRS="var/run tmp root dev var/log"
TMPROOT="/opt/dfsruntime/runtimemnt"
for a in $TMPDIRS
do mkdir -p "$TMPROOT/$a"
done
[ ! -e /dev/null ] && mknod "/dev/null" c 1 3 && chmod 666 "/dev/null"
[ ! -e /dev/urandom ] && mknod "/dev/urandom" c 1 9 && chmod 444 "/dev/urandom"
[ ! -e /dev/console ] && mknod "/dev/console" c 1 5 && chmod 660 "/dev/console"
[ ! -e /proc/mounts ] && mount -t proc proc /proc
bash
umount proc
rm -r "$TMPROOT"
mkdir "$TMPROOT"