Ubuntu Pastebin

Paste from jdstrand at Fri, 25 Mar 2016 14:18:52 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
set -e

if [ -z "$1" ]; then
    echo "`basename $0` <dir>"
    exit 1
fi
dir="$1"

if [ ! -d "$dir" ]; then
    echo "'$dir' is not a directory"
    exit 1
fi

tmp=`mktemp -d`
overlay="$tmp/overlay"
work="$tmp/work"
mkdir "$overlay" "$work"

# This does not handle directories with spaces in the names
cmd="sudo mount -t overlayfs -o lowerdir=$dir,upperdir=$overlay,workdir=$work overlayfs $dir"
echo "$cmd"
$cmd

echo "You may now write to '$dir'"
Download as text