From 4f19c0414f2536dac843c6de3d60d5e697bb6bb6 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 24 Feb 2024 13:48:29 -0500
Subject: linhes-system: lh_system_backup_job: use mariadb-dump

---
 linhes/linhes-system/PKGBUILD             |  4 ++--
 linhes/linhes-system/lh_system_backup_job | 15 +++++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index 52a8a2d..464687f 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=70
+pkgrel=71
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -38,7 +38,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833'
             'a523388ffdc6f30f2dd2ef4803b21bded8a35bfded499dc66b786adec71840a3'
-            '4e88e3b3a105d923fb7fecad07c5a9fab0eab0904b7cd2831a539ecb91ef2ef4'
+            '080988f30423c4b4ec542f250ac2f051d78b2609ef6ff7f6ac29d63222a4f7c1'
             '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9'
             '5cacfdd02833e5a3130d765573e772e6bd5030336ba86239c5e4db5ffa36fc69'
             'd51253c207d3315997d7122cb774c6d0fc38975c33e66bf416f0b1b95cf86e5b'
diff --git a/linhes/linhes-system/lh_system_backup_job b/linhes/linhes-system/lh_system_backup_job
index 14a3cf8..f634589 100755
--- a/linhes/linhes-system/lh_system_backup_job
+++ b/linhes/linhes-system/lh_system_backup_job
@@ -27,6 +27,12 @@ do
     fi
 done
 
+if [ ! `mountpoint -q $BACKUPDISK 2> /dev/null` ]; then
+    echo "    The system doesn't have a second drive. Backup skipped."
+    exit $backup_status
+fi
+
+
 #find secondary backup location
 for dir in /data/storage/disk*
 do
@@ -64,23 +70,24 @@ function backup(){
     echo "Starting Backup"
     echo "Backup Directory: $BACKUPLINK --> $BACKUPDIR"
     echo "Secondary Backup Directory: $SECBACKUPLINK --> $SECBACKUPDIR"
+    echo
     mkdir -p $BACKUPDIR/$DATE
 
     #backup database
     if [ $SystemType = MasterBackend -o $SystemType = Standalone ]
     then
         echo
-        echo "Backup mysql databases"
+        echo "Backup mariadb databases"
         pacman -Q mysql 2>/dev/null
         if [ $? = 0 ]
         then
             echo "    mythconverg  (mythtv database)"
-            mysqldump -x mythconverg > $BACKUPDIR/$DATE/mythconverg
+            /usr/bin/mariadb-dump -x mythconverg > $BACKUPDIR/$DATE/mythconverg
             backup_status_check $?
 
             #this is everything
             echo "    All databases in one file"
-            mysqldump -x --all-databases > $BACKUPDIR/$DATE/all_databases
+            /usr/bin/mariadb-dump -x --all-databases > $BACKUPDIR/$DATE/all_databases
             backup_status_check $?
         fi
     fi
@@ -238,7 +245,7 @@ function remote_backup(){
 
         if [ -n "$SECBACKUPDISK" ]; then
             SECBACKUP=$SECBACKUPDISK/backup
-            if [ `mountpoint -q -d $SECBACKUPDISK` ]; then
+            if [ `mountpoint -q $SECBACKUPDISK 2> /dev/null` ]; then
                 if [ ! -d "$SECBACKUPDIR" ]; then
                     mkdir -p -m 775 $SECBACKUPDIR
                     echo "    Created $SECBACKUPDIR"
-- 
cgit v0.12

