1
0
Fork 0
mirror of https://github.com/dirtbags/moth.git synced 2025-01-06 12:00:34 -07:00
moth/sh4pwn/skeleton/sbin/mkrw
2011-10-11 15:38:34 -06:00

17 lines
361 B
Bash
Executable file

#! /bin/sh -e
if ! [ -d "$1" ]; then
echo "usage: $0 DIRECTORY"
echo
echo "Makes DIRECTORY a read/write tmpfs mount with the same"
echo "contents."
exit 1
fi
fsname=$(basename $1)
mkdir /tmp/$fsname
mount -t tmpfs $fsname /tmp/$fsname
(cd $1 && tar cf - .) | (cd /tmp/$fsname && tar xf -)
mount -o move /tmp/$fsname $1
rmdir /tmp/$fsname