From 508ffd1618c74903cf9af7e755c45f3f163d0d5f Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 25 May 2025 08:55:56 +0200 Subject: [PATCH] add mount partition --- backupmount | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/backupmount b/backupmount index 8b0b7bf..a1e5e28 100755 --- a/backupmount +++ b/backupmount @@ -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() -- 2.39.5