From 204d1b4ec7206f954409dd66d5933097786674d9 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 24 Feb 2024 20:14:26 -0500
Subject: linhes-system: lh_system_backup_job: fix some logic and use pigz for
 multithreaded compression

---
 linhes/linhes-system/PKGBUILD             |  4 ++--
 linhes/linhes-system/lh_system_backup_job | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index 464687f..efa7d35 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=71
+pkgrel=72
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -38,7 +38,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833'
             'a523388ffdc6f30f2dd2ef4803b21bded8a35bfded499dc66b786adec71840a3'
-            '080988f30423c4b4ec542f250ac2f051d78b2609ef6ff7f6ac29d63222a4f7c1'
+            'a287466f58b979970e91e6f54942d75d7a620b93b61b34114620b58bbc92c1c5'
             '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9'
             '5cacfdd02833e5a3130d765573e772e6bd5030336ba86239c5e4db5ffa36fc69'
             'd51253c207d3315997d7122cb774c6d0fc38975c33e66bf416f0b1b95cf86e5b'
diff --git a/linhes/linhes-system/lh_system_backup_job b/linhes/linhes-system/lh_system_backup_job
index f634589..536d105 100755
--- a/linhes/linhes-system/lh_system_backup_job
+++ b/linhes/linhes-system/lh_system_backup_job
@@ -27,7 +27,7 @@ do
     fi
 done
 
-if [ ! `mountpoint -q $BACKUPDISK 2> /dev/null` ]; then
+if [ `mountpoint -q $BACKUPDISK 2> /dev/null` ]; then
     echo "    The system doesn't have a second drive. Backup skipped."
     exit $backup_status
 fi
@@ -139,19 +139,19 @@ function backup(){
 
     echo "Backup home dirs"
     HOMEDIRS=""
-    tar -zcf $BACKUPDIR/$DATE/home_dir.tar.gz -X $MYTHHOME/backup_config/backup_exclude.txt  $MYTHHOME $HOMEDIRS
+    tar -I pigz -cf $BACKUPDIR/$DATE/home_dir.tar.gz -X $MYTHHOME/backup_config/backup_exclude.txt  $MYTHHOME $HOMEDIRS
 
     if [ -f $MYTHHOME/backup_config/backup_include.txt ]
     then
         echo
         echo "Backup items from $MYTHHOME/backup_config/backup_include.txt"
-        tar -zcf $BACKUPDIR/$DATE/other.tar.gz -T $MYTHHOME/backup_config/backup_include.txt
+        tar -I pigz -cf $BACKUPDIR/$DATE/other.tar.gz -T $MYTHHOME/backup_config/backup_include.txt
         backup_status_check $?
     fi
 
     echo "Compress backup file"
     cd $BACKUPDIR
-    tar -zcf $BACKUPDIR/backup.$DATE.tgz  $DATE
+    tar -I pigz -cf $BACKUPDIR/backup.$DATE.tgz  $DATE
     backup_status_check $?
     if [ -d $BACKUPDIR/$DATE ]
     then
@@ -245,14 +245,14 @@ function remote_backup(){
 
         if [ -n "$SECBACKUPDISK" ]; then
             SECBACKUP=$SECBACKUPDISK/backup
-            if [ `mountpoint -q $SECBACKUPDISK 2> /dev/null` ]; then
+            if [ ! `mountpoint -q $SECBACKUPDISK 2> /dev/null` ]; then
                 if [ ! -d "$SECBACKUPDIR" ]; then
                     mkdir -p -m 775 $SECBACKUPDIR
                     echo "    Created $SECBACKUPDIR"
                     chown mythtv:users $SECBACKUPDIR
                 fi
                 echo "    Copying system backups to $SECBACKUPDIR"
-                rsync -au --delete $BACKUPDIR $SECBACKUPDIR
+                rsync -au --delete $BACKUPDIR/ $SECBACKUPDIR/
             else
                 echo "    $SECBACKUPDISK isn't mounted."
             fi
-- 
cgit v0.12

