Skip to content

Commit 8a094cc

Browse files
committed
fix(convert): silence shellcheck warnings and remove duplicate log::step
- Add function-level shellcheck disable=SC2154 on step:update_initrd and step::prepare_output_and_snapshots (variables set in main() and used in these step functions) - Remove unused output_boot_part_num variable - Remove duplicate log::step from step::prepare_output_and_snapshots and step::copy_partitions (main() already logs the step)
1 parent cf82b38 commit 8a094cc

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

cryptpilot-convert.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ disk::nbd_connect() {
178178
local image_file=$1
179179
local var_name=$2
180180
shift 2
181-
local qemu_nbd_opts=(--connect="PLACEHOLDER" "$image_file" "$@")
182181

183182
local nbd_dev
184183
nbd_dev="$(disk::get_available_nbd)" || proc::fatal "no free NBD device for ${var_name}"
@@ -1041,6 +1040,7 @@ EOF
10411040

10421041
}
10431042

1043+
# shellcheck disable=SC2154
10441044
step:update_initrd() {
10451045
local efi_part=$1
10461046
local boot_file_path=$2
@@ -1165,8 +1165,6 @@ step::shrink_rootfs() {
11651165
tune2fs -O read-only "${rootfs_orig_part}"
11661166

11671167
# Adjust file system content, all move to front
1168-
local before_shrink_size_in_bytes
1169-
before_shrink_size_in_bytes=$(blockdev --getsize64 "${rootfs_orig_part}")
11701168
log::info "Checking and shrinking rootfs filesystem"
11711169

11721170
if e2fsck -y -f "${rootfs_orig_part}"; then
@@ -1197,8 +1195,8 @@ step::shrink_rootfs() {
11971195
echo " Size in Sector: $after_shrink_size_in_sector"
11981196
}
11991197

1198+
# shellcheck disable=SC2154
12001199
step::prepare_output_and_snapshots() {
1201-
log::step "[ 5 ] Preparing output file and snapshots"
12021200

12031201
# Save the source rootfs partition number before any output modifications.
12041202
# source-read/source-write keep the original partition layout; only output changes.
@@ -1286,7 +1284,6 @@ step::prepare_output_and_snapshots() {
12861284

12871285
# Track output boot partition number separately from the original source detection.
12881286
# boot_part_exist reflects whether the SOURCE had a boot partition.
1289-
output_boot_part_num="${boot_part_num}"
12901287
else
12911288
partprobe "${output_device}"
12921289
udevadm settle --timeout=10
@@ -1299,7 +1296,6 @@ step::prepare_output_and_snapshots() {
12991296
}
13001297

13011298
step::copy_partitions() {
1302-
log::step "[ 6 ] Copying EFI and boot partitions"
13031299

13041300
# dd EFI partition (preserve UUID, labels, all metadata)
13051301
log::info "Copying EFI partition"

0 commit comments

Comments
 (0)