From d0e7c0f863c3c24536ef404bb25f71f29beb00dc Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Fri, 2 Aug 2024 12:09:55 -0400 Subject: [PATCH] Added gentoo-backup.sh script for making stage4 backups --- gentoo-backup.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gentoo-backup.sh diff --git a/gentoo-backup.sh b/gentoo-backup.sh new file mode 100644 index 0000000..7eb7da5 --- /dev/null +++ b/gentoo-backup.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +bhost="$(hostname -s)" +bdate="$(date +"%Y%m%d")" + +if [[ ! -d "/var/backup" ]]; then + mkdir /var/backup +fi + +pushd /var/backup &>/dev/null || exit 2 + +mkstage4 -s -l -q -C zst \ + -e "/var/lib/containers/*" \ + -e "/var/lib/machines/*" \ + -e "/var/lib/portables/*" \ + -e "/var/lib/libvirt/*" \ + -e "/var/cache/binpkgs/*" \ + -e "/home/*/*" \ + "$bhost-stage4" + +popd &>/dev/null || exit 2