]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
fix method naming
authorBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 08:06:12 +0000 (10:06 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 08:06:12 +0000 (10:06 +0200)
backupmount

index e7491ace71a4fca17e34afd9f2b8b08c51e6eeb1..0f3d31a154c31ca1bb5199f58b82e2e6cb7b17fd 100755 (executable)
@@ -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