This commit is contained in:
Your Name 2023-02-14 12:17:44 -07:00
parent 82f2f9db70
commit f7ab9b259e

View File

@ -71,20 +71,22 @@ auto_login(){
create-os-snapshots(){
echo;echo "[Creating new snapshots.....]";echo
time tar cvpzf $TARGET/$1.tgz --exclude=/volumes/* --exclude=/mnt/* --exclude=/var/tmp/* --exclude=/tmp/* --exclude=/raid/* --exclude=/root/* --exclude=/var/cache/apt/archives/* --exclude=/proc/* --exclude=/.snapshots/* --exclude=$TARGET/* --exclude=/var/lib/libvirt/* --exclude=/dev/* --exclude=/sys/* --exclude=/home/* --exclude=/var/lib/postgresql --exclude=/var/lib/containers /
mkdir -p $TARGET/\@install/var/lib/backup
time tar cvpzf $TARGET/\@install/var/lib/backup/$1.tgz --exclude=/volumes/* --exclude=/mnt/* --exclude=/var/tmp/* --exclude=/tmp/* --exclude=/raid/* --exclude=/root/* --exclude=/var/cache/apt/archives/* --exclude=/proc/* --exclude=/.snapshots/* --exclude=$TARGET/* --exclude=/var/lib/libvirt/* --exclude=/dev/* --exclude=/sys/* --exclude=/home/* --exclude=/var/lib/postgresql --exclude=/var/lib/containers /
}
homeBackup() {
echo;echo "[Copying USER data....]";echo
rsync --progress -avz --delete /home/ --exclude=.cache/ --exclude=.local/share/containers/ $HOME_BACKUP/
rsync --progress -avz --delete /home/ --exclude=.cache/ --exclude=.local/share/containers $TARGET/\@home/
}
os-backup() {
umount $TARGET
echo;echo "[Mounting.....]";echo
mount $NET_BACKUP $TARGET
printf "$DISK_PASSWORD" | cryptsetup open $BACKUP_DISK install
mount /dev/mapper/install $TARGET
echo "test $2"
if [ "$2" = "home" ]; then
homeBackup
fi
@ -97,10 +99,10 @@ os-backup() {
os-restore() {
partitions
rm -rf $TARGET/usr $TARGET/sbin $TARGET/lib32 $TARGET/libx32 $TARGET/lib $TARGET/vmlinuz* $TARGET/initrd* $TARGET/bin $TARGET/var $TARGET/root $TARGET/opt $TARGET/etc $TARGET/run
tar xfpv $2.tgz -C $TARGET/
tar xfpv /var/lib/backup/$2.tgz -C $TARGET/
if [ "$3" = "home" ]; then
rsync -av --progress --delete home/ $TARGET/home/
rsync -av --progress --delete /home/ $TARGET/home/
fi
fstab