Add nfs check #28

Merged
ProfessionalUwU merged 3 commits from feature/nfs-check into main 2025-01-29 18:13:39 +01:00
Showing only changes of commit 4d23541889 - Show all commits

View File

@ -49,7 +49,7 @@ if [[ ${1:0:2} == \-\- ]]; then
fi fi
check_for_valid_backup_location() { check_for_valid_backup_location() {
if [ ! -d $1 ]; then if [ ! -d "$1" ]; then
echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}" echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}"
read -p "Do you want to create the path and continue? [y/N]" input read -p "Do you want to create the path and continue? [y/N]" input
case $input in case $input in
@ -61,8 +61,8 @@ check_for_valid_backup_location() {
} }
check_nfs_mount() { check_nfs_mount() {
if ! findmnt -rno SOURCE,TARGET,FSTYPE $1 | grep -q nfs; then if [ $(findmnt -rno SOURCE,TARGET,FSTYPE "$1" | grep -q nfs) -ne 0 ]; then
echo -e "${IRED}$1 is not an active NFS mount.${NO_COLOR}" echo -e "${IYELLOW}$1 is not an active NFS mount.${NO_COLOR}"
read -p "Do you want to continue without an active NFS mount? [y/N] " input read -p "Do you want to continue without an active NFS mount? [y/N] " input
case $input in case $input in
[Yy]) return 0 ;; [Yy]) return 0 ;;
@ -71,7 +71,7 @@ check_nfs_mount() {
fi fi
} }
if [ $BACKUP_LOCATION ]; then if [ "$BACKUP_LOCATION" ]; then
check_for_valid_backup_location "$BACKUP_LOCATION" check_for_valid_backup_location "$BACKUP_LOCATION"
check_nfs_mount "$BACKUP_LOCATION" check_nfs_mount "$BACKUP_LOCATION"
else else