mirror of
https://github.com/flynx/ImageGrid.git
synced 2026-10-03 12:51:32 +00:00
Compare commits
No commits in common. "9fe6678b9521ad33b09ad16feada02b052acddb3" and "f76f04118cf76b2a87ac4e4ac9174532b2059545" have entirely different histories.
9fe6678b95
...
f76f04118c
@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
# XXX need:
|
# XXX need:
|
||||||
# - protocol (command) to create archive root
|
# - protocol (command) to create archive root
|
||||||
# manually:
|
|
||||||
# - copy tree
|
|
||||||
# - run snapshot.sh
|
|
||||||
# script:
|
|
||||||
# XXX
|
|
||||||
# - protocol to create snapshots
|
# - protocol to create snapshots
|
||||||
# - sync-flash.sh ???
|
# - sync-flash.sh ???
|
||||||
# - protocol to restore stuff -- simply copy???
|
# - protocol to restore stuff -- simply copy???
|
||||||
@ -17,16 +12,6 @@
|
|||||||
# - a way to maintain a set number of snapshots...
|
# - a way to maintain a set number of snapshots...
|
||||||
#
|
#
|
||||||
|
|
||||||
SNAPSHOT_DIR=.snapshots
|
|
||||||
SUBVOLUME_DIR=media
|
|
||||||
|
|
||||||
|
|
||||||
# run in script dir (not cwd)...
|
|
||||||
DIR=`dirname "$0"`
|
|
||||||
if ! [ -z "$DIR" ] ; then
|
|
||||||
cd "$DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if on btrfs filesystem...
|
# check if on btrfs filesystem...
|
||||||
# XXX also check if btrfs command is available...
|
# XXX also check if btrfs command is available...
|
||||||
if ! btrfs filesystem usage . > /dev/null ; then
|
if ! btrfs filesystem usage . > /dev/null ; then
|
||||||
@ -39,32 +24,30 @@ fi
|
|||||||
|
|
||||||
# create ./media...
|
# create ./media...
|
||||||
# XXX check if not a directory...
|
# XXX check if not a directory...
|
||||||
if ! [ -e "$SUBVOLUME_DIR" ] ; then
|
if ! [ -e ./media ] ; then
|
||||||
btrfs subvolume create "$SUBVOLUME_DIR"
|
btrfs subvolume create ./media
|
||||||
# XXX build tree -- ImageGrid
|
# XXX build tree -- ImageGrid
|
||||||
|
|
||||||
# convert ./media to a subvolume...
|
# convert ./media to a subvolume...
|
||||||
elif [ "$(stat --format=%i "$SUBVOLUME_DIR")" == 256 ] ; then
|
elif [ "$(stat --format=%i ./media)" == 256 ] ; then
|
||||||
mkdir bak
|
btrfs subvolume create ./media_subvolume
|
||||||
mv "$SUBVOLUME_DIR" bak/
|
#mv ./media/{,.}* ./media_subvolume/
|
||||||
btrfs subvolume create "$SUBVOLUME_DIR"
|
|
||||||
cp --archive --one-file-system --reflink=always \
|
cp --archive --one-file-system --reflink=always \
|
||||||
./bak/"$SUBVOLUME_DIR"/{,.}* \
|
./media/{,.}* \
|
||||||
"$SUBVOLUME_DIR"/
|
./media_subvolume/
|
||||||
|
mv ./media{,.bak}
|
||||||
|
mv ./media{_subvolume,}
|
||||||
fi
|
fi
|
||||||
mkdir -p "$SNAPSHOT_DIR"
|
mkdir -p ./.snapshots
|
||||||
|
|
||||||
|
|
||||||
# XXX should this be more human readable???
|
# XXX should this be more human readable???
|
||||||
# ...a date + number maybe???
|
# ...a date + number maybe???
|
||||||
SNAPSHOT=$((
|
SNAPSHOT=$((
|
||||||
$( ls "$SNAPSHOT_DIR" \
|
$( ls .snapshots \
|
||||||
| sort -n \
|
| sort -n \
|
||||||
| tail -n 1 ) \
|
| tail -n 1 ) \
|
||||||
+ 1 ))
|
+ 1 ))
|
||||||
|
|
||||||
btrfs subvolume snapshot -r "$SUBVOLUME_DIR" "${SNAPSHOT_DIR}/${SNAPSHOT}"
|
btrfs subvolume snapshot -r ./media .snapshots/${SNAPSHOT}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set nowrap nospell :
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user