Skip to content

Commit 4176add

Browse files
authored
fix: correct mappername assignement (#37)
* fix: correct mappername assignement * fix: DISK_PATH to disk_path
1 parent dd9a85f commit 4176add

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cvmassistants/disktool/encryptedDisk.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ detect_or_create_partition() {
3232
local suffix
3333

3434
# Try both possible partition naming schemes (e.g., /dev/sda1 or /dev/nvme0n1p1)
35-
part_disk=""
3635
for suffix in "1" "p1"; do
3736
if [[ -e "${disk_dev}${suffix}" ]]; then
3837
part_disk="${disk_dev}${suffix}"
39-
mappername="${mappername}${suffix}"
38+
mappername="${DISK}${suffix}"
4039
log_info "Partition $part_disk already exists for device $disk_dev"
4140
return 0
4241
fi
@@ -65,8 +64,8 @@ detect_or_create_partition() {
6564
# Try both possible partition naming schemes
6665
for suffix in "1" "p1"; do
6766
part_disk="${disk_dev}${suffix}"
68-
if [[ -e "$part_disk" ]]; then
69-
mappername="${mappername}${suffix}"
67+
if [[ -e "$part_disk" ]]; then
68+
mappername="${DISK}${suffix}"
7069
log_info "Partition $part_disk successfully created on $disk_dev"
7170
return 0
7271
fi
@@ -130,8 +129,7 @@ fi
130129

131130
diskpath="/dev/$DISK" # /dev/vda
132131
part_disk=""
133-
134-
mappername="${disk}"
132+
mappername=""
135133
detect_or_create_partition "$diskpath" # assign part_disk and mappername
136134
device_to_mount="/dev/mapper/$mappername"
137135
[ -e "$device_to_mount" ] && log_fatal "Mapper $device_to_mount already exists"

0 commit comments

Comments
 (0)