From cfb189a8cd2cf22da30304a9f2943a46dadc8f9d Mon Sep 17 00:00:00 2001 From: ProfessionalUwU Date: Mon, 27 Jan 2025 19:45:40 +0100 Subject: [PATCH 1/3] Add nfs check --- legacy/update | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/legacy/update b/legacy/update index c9cf02b..389c566 100755 --- a/legacy/update +++ b/legacy/update @@ -60,8 +60,20 @@ check_for_valid_backup_location() { fi } +check_nfs_mount() { + if ! findmnt -rno SOURCE,TARGET,FSTYPE $1 | grep -q nfs; then + echo -e "${IRED}$1 is not an active NFS mount.${NO_COLOR}" + read -p "Do you want to continue without an active NFS mount? [y/N] " input + case $input in + [Yy]) return 0 ;; + [Nn]|*) exit 1 ;; + esac + fi +} + if [ $BACKUP_LOCATION ]; then check_for_valid_backup_location "$BACKUP_LOCATION" + check_nfs_mount "$BACKUP_LOCATION" else echo -e "${IRED}No BACKUP_LOCATION in $HOME/.config/update.conf specified${NO_COLOR}" exit 1 -- 2.47.1 From 4d23541889902a1ee74ba81fb153f8b1c4fbdb14 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Tue, 28 Jan 2025 21:05:56 +0100 Subject: [PATCH 2/3] make if statements prettier --- legacy/update | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/legacy/update b/legacy/update index 389c566..64ac6b8 100755 --- a/legacy/update +++ b/legacy/update @@ -49,7 +49,7 @@ if [[ ${1:0:2} == \-\- ]]; then fi check_for_valid_backup_location() { - if [ ! -d $1 ]; then + if [ ! -d "$1" ]; then echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}" read -p "Do you want to create the path and continue? [y/N]" input case $input in @@ -61,8 +61,8 @@ check_for_valid_backup_location() { } check_nfs_mount() { - if ! findmnt -rno SOURCE,TARGET,FSTYPE $1 | grep -q nfs; then - echo -e "${IRED}$1 is not an active NFS mount.${NO_COLOR}" + if [ $(findmnt -rno SOURCE,TARGET,FSTYPE "$1" | grep -q nfs) -ne 0 ]; then + 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 case $input in [Yy]) return 0 ;; @@ -71,7 +71,7 @@ check_nfs_mount() { fi } -if [ $BACKUP_LOCATION ]; then +if [ "$BACKUP_LOCATION" ]; then check_for_valid_backup_location "$BACKUP_LOCATION" check_nfs_mount "$BACKUP_LOCATION" else -- 2.47.1 From 0c6a4ff105dd129ef859d430f62716805e7cc297 Mon Sep 17 00:00:00 2001 From: ProfessionalUwU Date: Wed, 29 Jan 2025 18:11:14 +0100 Subject: [PATCH 3/3] Revert some changes --- legacy/update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy/update b/legacy/update index 64ac6b8..5975bf9 100755 --- a/legacy/update +++ b/legacy/update @@ -61,7 +61,7 @@ check_for_valid_backup_location() { } check_nfs_mount() { - if [ $(findmnt -rno SOURCE,TARGET,FSTYPE "$1" | grep -q nfs) -ne 0 ]; then + if ! findmnt -rno SOURCE,TARGET,FSTYPE "$1" | grep -q nfs; then 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 case $input in -- 2.47.1