From: Bastian Dehn Date: Sun, 25 May 2025 08:06:12 +0000 (+0200) Subject: fix method naming X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=56b8c2f90524c72a412b0e63c6bd7e8aa73f809e;p=simple-backup.git fix method naming --- diff --git a/backupmount b/backupmount index e7491ac..0f3d31a 100755 --- a/backupmount +++ b/backupmount @@ -30,17 +30,17 @@ partition_mount() [ -b "$partition" ] \ || errlog "partition $partition not found" \ || return $? - infolog "mount partition $partition" local backup_path=$(cat config.yaml \ | yq --raw-output ".backup_path") - [ "$backup_path" == "null" ] \ + [ "$backup_path" != "null" ] \ || errlog "config.yaml backup path missing" \ || return $? - infolog "backup path $backup_path" + infolog "create backup path $backup_path" mkdir --parents "$backup_path" \ || errlog "could not create directory $backup_path" \ || return $? + infolog "mount partition $partition to $backup_path" mount "$partition" "$backup_path" \ || errlog "cloud not mount $partition to $backup_path" \ || return $? @@ -79,7 +79,7 @@ device_mount() partition_mount "$media" || return $? } -mount() +mount_backup() { local medias=$(cat config.yaml \ | yq --raw-output '.media | keys[]') @@ -102,12 +102,20 @@ mount() errlog "no device was mounted" } -umount() +remote_backup_dir() +{ + infolog "remove backup path $backup_path" + rmdir "$backup_path" \ + || errlog "clound not remote $backup_path" \ + || return $? +} + +umount_backup() { local backup_path=$(cat config.yaml \ | yq --raw-output ".backup_path") - [ "$backup_path" == "null" ] \ + [ "$backup_path" != "null" ] \ || errlog "config.yaml backup path missing" \ || return $? @@ -116,12 +124,6 @@ umount() || errlog "could not unmount $backup_path" \ || return $? - infolog "remove backup path $backup_path" - rmdir --parents "$backup_path" \ - || errlog "clound not remote $backup_path" \ - || return $? - - infolog "close volume" local volume=$(cat "config.yaml" \ | yq --raw-output ".backup_volume") [ "$volume" != "null" ] \ @@ -151,9 +153,9 @@ main() || return $? if [ "$cmd" == "mount" ]; then - mount || return $? + mount_backup || return $? elif [ "$cmd" == "umount" ]; then - umount || return $? + umount_backup || return $? else errlog "unknown command" || return $? fi