mirror of https://github.com/dirtbags/moth.git
18 lines
361 B
Bash
Executable File
18 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
|
|
|