hacks/makefiles/2022-12-10.berlin.sneak.fs.NNNY-cyberdyne-backup-01.makefile

29 lines
745 B
Plaintext
Raw Permalink Normal View History

2023-01-13 10:15:53 +00:00
THIS = $(shell basename $(CURDIR))
YYYYMMDD = $(shell date -u +%Y-%m-%d)
default: backup
save_makefile:
cp ./Makefile $(HOME)/dev/hacks/makefiles/$(YYYYMMDD).$(THIS).makefile
backup: save_makefile do_file_backup write_checksum
write_checksum:
cd ./fs && find . -type f -print0 | xargs -0 sha1sum | tee -a ../SHASUMS.txt
do_file_backup:
rsync -avv \
--exclude=/tmp \
--exclude=/.cache \
--exclude=/.nvm \
--exclude=/.Trash \
--exclude=/Library/Caches \
--exclude=/Library/Mail \
--exclude=/Library/Developer \
--exclude=.DS_Store \
--delete-before \
--delete-excluded \
$(HOME)/ ./fs/ 2>&1 | tee -a ./$(shell date -u +%Y-%m-%d).log
echo '# $(shell date -u)' > ./lastbackup.txt
date -u '+%s' >> ./lastbackup.txt