mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-17 00:31:40 +00:00
Compare commits
2 Commits
1eac481159
...
f6f719c11e
| Author | SHA1 | Date | |
|---|---|---|---|
| f6f719c11e | |||
| 1b7d46781e |
46
Archive/snapshot.sh
Executable file
46
Archive/snapshot.sh
Executable file
@ -0,0 +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
|
||||||
|
|
||||||
|
# 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