Skip to content

Commit

Permalink
mkdemo.sh: setup overlayfs demo
Browse files Browse the repository at this point in the history
Signed-off-by: Amir Goldstein <[email protected]>
  • Loading branch information
amir73il committed Mar 8, 2017
1 parent dc0686a commit 0b30203
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions scripts/mkdemo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
#
# mkdemo.sh - setup overlayfs snapshots demo
#

DEMO=/demo
# re-packed zip from http://opengameart.org/sites/default/files/Playing%20Cards.zip
CARDS_TARBALL=~/Downloads/PlayingCards.tgz
CARDS=$DEMO/PlayingCards
MDIRS=$DEMO/1Mdirs
SECRET=Passwords.txt
USER=amir
GROUP=amir
# mkdirs tool from https://github.com/amir73il/fsnotify-utils/tree/master/src/test
MKDIRS=~/bin/mkdirs

setup_demo()
{
mount $DEMO
cd $DEMO || exit 1
}

cleanup_cards()
{
ovlsnapshot umount $CARDS 2>/dev/null
rm -rf $CARDS
}

setup_cards()
{
tar xvfz $CARDS_TARBALL
chown -R $USER:$GROUP $CARDS
}

cleanup_1mdirs()
{
ovlsnapshot umount $MDIRS 2>/dev/null
rm -rf $MDIRS/@ $MDIRS/1/2/3/4/* $MDIRS/a/m/i/r/* $MDIRS/1/9/7/3/*
}

setup_1mdirs()
{
if [ ! -d $MDIRS ]; then
mkdir $MDIRS
$MKDIRS $MDIRS 3
fi
chown $USER:$GROUP $MDIRS
echo 12345 > $MDIRS/$SECRET
chown $USER:$GROUP $MDIRS/$SECRET
}

setup_demo
cleanup_cards
setup_cards
cleanup_1mdirs
setup_1mdirs

0 comments on commit 0b30203

Please sign in to comment.