mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-24 12:01:57 +00:00
Compare commits
No commits in common. "d6abf65df9d44924b7e9bf413cf5a2938439b5b4" and "9fe6678b9521ad33b09ad16feada02b052acddb3" have entirely different histories.
d6abf65df9
...
9fe6678b95
@ -21,14 +21,12 @@ COPYFLAGS=$RSYNCFLAGS
|
|||||||
# XXX need to test if this exists...
|
# XXX need to test if this exists...
|
||||||
VERIFY=jdupes
|
VERIFY=jdupes
|
||||||
VERIFYFLAGS="-r -u -I"
|
VERIFYFLAGS="-r -u -I"
|
||||||
DO_VERIFY=
|
DO_VERIFY=1
|
||||||
|
|
||||||
|
|
||||||
COMPRESS=./compress-archive.sh
|
COMPRESS=./compress-archive.sh
|
||||||
DO_COMPRESS=1
|
DO_COMPRESS=1
|
||||||
|
|
||||||
SNAPSHOT=../../../../snapshot.sh
|
|
||||||
|
|
||||||
|
|
||||||
# Config file to contain all the default settings...
|
# Config file to contain all the default settings...
|
||||||
# XXX not sure if this is a good idea...
|
# XXX not sure if this is a good idea...
|
||||||
@ -354,11 +352,6 @@ if [[ $DO_COMPRESS ]] ; then
|
|||||||
echo "Compressing archive: done."
|
echo "Compressing archive: done."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##if ! [ -z "$SNAPSHOT" ] \
|
|
||||||
## && [ -e "$SNAPSHOT" ] ; then
|
|
||||||
## "$SNAPSHOT"
|
|
||||||
##fi
|
|
||||||
|
|
||||||
# XXX add report...
|
# XXX add report...
|
||||||
# XXX
|
# XXX
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
SNAPSHOT_DIR=.snapshots
|
SNAPSHOT_DIR=.snapshots
|
||||||
SUBVOLUME_DIR=media
|
SUBVOLUME_DIR=media
|
||||||
SNAPSHOT_COUNT=5
|
|
||||||
|
|
||||||
|
|
||||||
# run in script dir (not cwd)...
|
# run in script dir (not cwd)...
|
||||||
@ -30,11 +29,13 @@ 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 2>&1 ; then
|
if ! btrfs filesystem usage . > /dev/null ; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#SNAPSHOT_COUNT=
|
||||||
|
|
||||||
|
|
||||||
# create ./media...
|
# create ./media...
|
||||||
# XXX check if not a directory...
|
# XXX check if not a directory...
|
||||||
@ -43,7 +44,7 @@ if ! [ -e "$SUBVOLUME_DIR" ] ; then
|
|||||||
# 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 "$SUBVOLUME_DIR")" == 256 ] ; then
|
||||||
mkdir bak
|
mkdir bak
|
||||||
mv "$SUBVOLUME_DIR" bak/
|
mv "$SUBVOLUME_DIR" bak/
|
||||||
btrfs subvolume create "$SUBVOLUME_DIR"
|
btrfs subvolume create "$SUBVOLUME_DIR"
|
||||||
@ -57,30 +58,12 @@ mkdir -p "$SNAPSHOT_DIR"
|
|||||||
# 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 "$SNAPSHOT_DIR" \
|
||||||
| 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 "$SUBVOLUME_DIR" "${SNAPSHOT_DIR}/${SNAPSHOT}"
|
||||||
btrfs subvolume snapshot "$SUBVOLUME_DIR" "${SNAPSHOT_DIR}/${SNAPSHOT}"
|
|
||||||
|
|
||||||
|
|
||||||
if [[ $SNAPSHOT_COUNT =~ [0-9]* ]] \
|
|
||||||
&& [ "$SNAPSHOT_COUNT" != 0 ] ; then
|
|
||||||
SNAPSHOTS=($(\
|
|
||||||
ls "$SNAPSHOT_DIR/" \
|
|
||||||
| sort -n ))
|
|
||||||
remove=$(( ${#SNAPSHOTS[@]} - $SNAPSHOT_COUNT - 1 ))
|
|
||||||
while (( $remove >= 0 )) ; do
|
|
||||||
# XXX can we avoid sudo here???
|
|
||||||
# XXX is 'btrfs subvolume delete ...' the same as 'rm -rf ..'
|
|
||||||
#sudo btrfs subvolume delete -c ${SNAPSHOT_DIR}/${SNAPSHOTS[$remove]}
|
|
||||||
echo Removing snapshot: ${SNAPSHOT_DIR}/${SNAPSHOTS[$remove]}
|
|
||||||
rm -rf ${SNAPSHOT_DIR}/${SNAPSHOTS[$remove]}
|
|
||||||
remove=$(( $remove - 1 ))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user