summarylogtreecommitdiffstats
path: root/backup-boot-partition
diff options
context:
space:
mode:
authorMarkus Schanz2018-01-07 20:34:31 +0100
committerMarkus Schanz2018-01-07 20:36:38 +0100
commit98f0cf1a4fafd827266009d78bf193b690942068 (patch)
tree4bdb25248f4ad82dec44ca5cf9f3558135577bc8 /backup-boot-partition
parent766320157ec3499c287e88d48ee02cb6c1e104b6 (diff)
downloadaur-98f0cf1a4fafd827266009d78bf193b690942068.tar.gz
The backup is now performed prior AND after a package upgrade!
Diffstat (limited to 'backup-boot-partition')
-rw-r--r--backup-boot-partition10
1 files changed, 10 insertions, 0 deletions
diff --git a/backup-boot-partition b/backup-boot-partition
new file mode 100644
index 000000000000..bd7bf6cf6f86
--- /dev/null
+++ b/backup-boot-partition
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+[[ "$1" != "pre" && "$1" != "post" ]] && exit 1
+[[ -f /etc/pacman-boot-backup.conf ]] && . /etc/pacman-boot-backup.conf
+
+BACKUP_PATH_SRC=$(echo ${BACKUP_PATH_SRC:-/boot} | sed 's#/$##')
+BACKUP_PATH_DEST=$(echo ${BACKUP_PATH_DEST:-/.bootbackup} | sed 's#/$##')/$1
+
+mkdir -p "${BACKUP_PATH_DEST}"
+/usr/bin/rsync -azq --delete "${BACKUP_PATH_SRC}/" "${BACKUP_PATH_DEST}"