add some makefiles

This commit is contained in:
Jeffrey Paul 2022-12-10 22:26:29 +01:00
parent daa014c4e8
commit 9d3b704496
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,25 @@
TARGET := ./berlin.sneak.fs.NNNY-cyberdyne-backup-01
default: backup
backup: do_file_backup write_checksum
write_checksum:
cd $(TARGET)/fs && find . -type f -print0 | xargs -0 sha1sum > ../.SHASUMS.tmp
mv ./.SHASUMS.tmp ./$(TARGET)/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)/ $(TARGET)/fs/ 2>&1 | tee -a $(TARGET)/$(shell date -u +%Y-%m-%d).log
echo '# $(shell date -u)' > $(TARGET)/lastbackup.txt
date -u '+%s' >> $(TARGET)/lastbackup.txt

View File

@ -0,0 +1,40 @@
HOMEEXCLUDE := --exclude /.Trash \
--exclude .DS_Store \
--exclude /.Spotlight-V100 \
--exclude /.cache \
--exclude /.fseventsd \
--exclude /Library/Caches \
--exclude /Library/Mail \
--exclude /Library/Metadata/CoreSpotlight \
--exclude /tmp
ROOTEXCLUDE := --exclude /.Trash \
--exclude /proc \
--exclude /dev \
--exclude /.fseventsd \
--exclude .DS_Store \
--exclude /System/Volumes/Data/Volumes \
--exclude /private/var/vm \
--exclude /System/Volumes/Data/nix \
--exclude /System/Volumes/Data/Users/sneak \
--exclude /Users/sneak \
--exclude /System/Volumes/Data/.fseventsd \
--exclude /System/Volumes/Data/.Spotlight-V100 \
--exclude /System/Volumes/Data/private/var/folders \
--exclude /private/var/folders \
--exclude /Volumes
OPTS := -avP --delete --delete-excluded --delete-before
HOMEOPTS := $(OPTS) $(HOMEEXCLUDE)
ROOTOPTS := $(OPTS) $(ROOTEXCLUDE)
default:
sudo bash -c 'make synchome; make syncroot'
synchome:
rsync $(HOMEOPTS) $(HOME)/ ./2021-01-12.nostromo.sneakhome/ | tee -a $(shell date +%Y-%m-%d).homesync.log
syncroot:
rsync $(ROOTOPTS) / ./2021-01-12.nostromo.root/ | tee -a $(shell date +%Y-%m-%d).rootsync.log