Add nfs check (#28)

For users that use a nfs share for their backup, this will check if it is mounted.

Co-authored-by: AustrianToast <austriantoast@hopeless-cloud.xyz>
Reviewed-on: #28
Co-authored-by: ProfessionalUwU <andre.fuhry@hopeless-cloud.xyz>
Co-committed-by: ProfessionalUwU <andre.fuhry@hopeless-cloud.xyz>
This commit is contained in:
ProfessionalUwU 2025-01-29 18:13:39 +01:00 committed by Gitea
parent cb735a01a1
commit 2d881a0d34
Signed by: Gitea
GPG Key ID: FCACD432A6DD0FB5

View File

@ -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
@ -60,8 +60,20 @@ check_for_valid_backup_location() {
fi
}
if [ $BACKUP_LOCATION ]; then
check_nfs_mount() {
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
[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