dotfiles/.bin/backup-and-update-system

27 lines
637 B
Text
Raw Normal View History

2021-11-30 17:46:31 +00:00
#!/bin/bash
2018-12-21 16:38:50 +00:00
2021-11-30 17:46:31 +00:00
set -xeuo pipefail
2018-12-21 16:38:50 +00:00
export GIT_TERMINAL_PROMPT=0
export GIT_SSH_COMMAND='ssh -oBatchMode=yes'
# Push some git repos
2018-12-21 16:38:50 +00:00
pass git push
git --git-dir=$HOME/.cfg/ --work-tree=$HOME commit -am "Auto-commit $(hostnamectl --static) $(date --iso-8601=seconds)" || true
git --git-dir=$HOME/.cfg/ --work-tree=$HOME push
2018-12-21 16:38:50 +00:00
2020-12-23 08:08:37 +00:00
# Fetch a fresh copy of all locally cloned git repos
for dir in $(find /home/kunsi/git -mindepth 1 -maxdepth 1 -type d)
do
2023-01-22 14:58:23 +00:00
git -C "$dir" fetch --all || true
2020-12-23 08:08:37 +00:00
done
# Do a backup.
2022-02-13 07:47:44 +00:00
sudo /usr/local/bin/generate-backup-with-retries
printf '\a'
2021-11-30 17:46:31 +00:00
# Do updates
sudo pacman -Syu
sudo DIFFPROG='diff -u --color' pacdiff