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(){ create-os-snapshots(){
echo;echo "[Creating new snapshots.....]";echo 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() { homeBackup() {
echo;echo "[Copying USER data....]";echo 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() { os-backup() {
umount $TARGET umount $TARGET
echo;echo "[Mounting.....]";echo 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 if [ "$2" = "home" ]; then
homeBackup homeBackup
fi fi
@ -97,10 +99,10 @@ os-backup() {
os-restore() { os-restore() {
partitions 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 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 if [ "$3" = "home" ]; then
rsync -av --progress --delete home/ $TARGET/home/ rsync -av --progress --delete /home/ $TARGET/home/
fi fi
fstab fstab