checksum based cache for neocities uploads
This commit is contained in:
parent
c1ccd1b465
commit
82b4976efb
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ html/
|
|||||||
**/.*/
|
**/.*/
|
||||||
**/*.jpg/
|
**/*.jpg/
|
||||||
**/*.png/
|
**/*.png/
|
||||||
|
**/*.upload-checksum
|
||||||
|
11
upload.sh
11
upload.sh
@ -1,12 +1,15 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# todo: Create local cache containing file timestamps that were previously uploaded.
|
|
||||||
|
|
||||||
for cur in ./html/{*,*/*,*/*/*}; do
|
for cur in ./html/{*,*/*,*/*/*}; do
|
||||||
if [[ "$cur" == *"/tracks/"* ]]; then
|
if [ -f "$cur" ] && [[ ! "$cur" == *.upload-checksum ]]; then
|
||||||
|
if [ -f "$cur.upload-checksum" ]; then
|
||||||
|
c=$(cat "$cur.upload-checksum" | sha256sum -c 2> /dev/null)
|
||||||
|
if [[ "$c" == *OK ]]; then
|
||||||
|
echo "$cur is up-to-date, skipping"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ -f "$cur" ]; then
|
fi
|
||||||
|
echo $(sha256sum "$cur") > "$cur.upload-checksum"
|
||||||
d=$(dirname $(realpath --relative-to="./html" "$cur"))
|
d=$(dirname $(realpath --relative-to="./html" "$cur"))
|
||||||
if [[ "$d" == "." ]]; then
|
if [[ "$d" == "." ]]; then
|
||||||
neocities upload $cur
|
neocities upload $cur
|
||||||
|
Loading…
Reference in New Issue
Block a user