mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added conversion to subvolume...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1b7d46781e
commit
f6f719c11e
@ -1,21 +1,46 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# XXX need:
|
||||
# - protocol to restore stuff -- simply copy???
|
||||
# - protocol to fully delete something -- i.e. delete snapshots???
|
||||
# - a way to list deleted files
|
||||
# - a way to list available file versions
|
||||
# - a way to restore specicifc file(s)
|
||||
# - a way to maintain a set number of snapshots...
|
||||
#
|
||||
|
||||
# check if on btrfs filesystem...
|
||||
# XXX also check if btrfs command is available...
|
||||
if ! btrfs filesystem usage . > /dev/null ; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# create ./media...
|
||||
if ! [ -e ./media ] ; then
|
||||
btrfs subvolume create ./media
|
||||
# XXX build tree -- ImageGrid
|
||||
fi
|
||||
if ! [ -e ./.snapshots ] ; then
|
||||
mkdir ./.snapshots
|
||||
fi
|
||||
|
||||
#DATE=`date +%Y%m%d-%H%M%S`
|
||||
# convert ./media to a subvolume...
|
||||
elif [ "$(stat --format=%i ./media)" == 256 ] ; then
|
||||
btrfs subvolume create ./media_subvolume
|
||||
#mv ./media/{,.}* ./media_subvolume/
|
||||
cp --archive --one-file-system --reflink=always \
|
||||
./media/{,.}* \
|
||||
./media_subvolume/
|
||||
mv ./media{,.bak}
|
||||
mv ./media{_subvolume,}
|
||||
fi
|
||||
mkdir -p ./.snapshots
|
||||
|
||||
|
||||
# XXX should this be more human readable???
|
||||
# ...a date + number maybe???
|
||||
SNAPSHOT=$((
|
||||
$( ls .snapshots \
|
||||
| sort -n \
|
||||
| tail -n 1 ) \
|
||||
+ 1 ))
|
||||
|
||||
|
||||
btrfs subvolume snapshot -r ./media .snapshots/${SNAPSHOT}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user