]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add mount partition
authorBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 06:55:56 +0000 (08:55 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 25 May 2025 06:55:56 +0000 (08:55 +0200)
backupmount

index 8b0b7bfc76554ba495702819ad205f84f323ba25..a1e5e2855ad9b87892fb9f2f26ba39c620ae4af5 100755 (executable)
@@ -19,6 +19,33 @@ infolog()
        return $lastexit
 }
 
+partition_mount()
+{
+       local media="$1"
+       local partition=$(cat config.yaml \
+               | yq --raw-output ".media\"$media\".partition")
+       [ "$partition" == "null" ] \
+               || errlog "config.yaml partition for $media missing" \
+               || return $?
+       [ -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" ] \
+               || errlog "config.yaml backup path missing"
+               || return $?
+       infolog "backup path $backup_path"
+
+       mkdir --parents "$backup_path" \
+               || errlog "could not create directory $backup_path" \
+               || return $?
+       mount "$partition" "$backup_path" \
+               || errlog "cloud not mount $partition to $backup_path" \
+               || return $?
+}
+
 device_mount()
 {
        local media="$1"
@@ -48,6 +75,8 @@ device_mount()
                "$volume" \
                || errlog "could not open $device with $key"
                || return $?
+
+       partition_mount "$media" || return $?
 }
 
 mount()