summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/dev.inc18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/dev.inc b/modules/dev.inc
index 5a9619d..88c2cc9 100644
--- a/modules/dev.inc
+++ b/modules/dev.inc
@@ -48,7 +48,7 @@ dev_find_partitions() {
for dev in $(find $target* -maxdepth 0 -type b); do
[ -n "$rw" ] && [ "$( cat "/sys/class/block/${dev##*/}/ro" )" = "1" ] && continue
dev_get_type "$dev" || continue
- echo "$dev is $number - MBR=$mbrid, UUID=$uuid, label=$label" >&2
+ is_on "$SLX_DEBUG" && echo "$dev is $number - MBR=$mbrid, UUID=$uuid, label=$label" >&2
if regex_imatch "$mbrid" "^($want_type)$" || regex_imatch "$uuid" "^($want_uuid)$" \
|| regex_match "$label" "^($want_label)$"; then
printf "%s\n" "$(blockdev --getsize64 "$dev") $dev"
@@ -90,7 +90,7 @@ dev_get_type() {
elif [ "$( dd if="$dev" bs=1 count=8 skip=4096 )" = "EFI PART" ]; then
gpt=4096
fi 2> /dev/null
- echo "Checking $partn (on $dev) GPT='$gpt', label='$label'" >&2
+ is_on "$SLX_DEBUG" && echo "Checking $partn (on $dev) GPT='$gpt', label='$label'" >&2
# Check if mbr signatur is there, no GPT label was in uevent, and no protective MBR
local t1="$( __read_mbrid "$dev" 0 1 )"
if [ -z "$label" ] && [ "$number" -lt 1000 ] && [ "$number" -gt 0 ] \
@@ -100,7 +100,7 @@ dev_get_type() {
# Validate start LBA matches sysfs
log_start="$( __read_mbrstart "$dev" 0 "$number" )"
if [ "$pstart" != "$log_start" ]; then
- echo "Found partition $number, but start mismatch (want: $pstart found: $log_start)" >&2
+ echo "Found partition $number on $dev, but start mismatch (want: $pstart found: $log_start)" >&2
else
mbrid="$( __read_mbrid "$dev" 0 "$number" )"
return 0
@@ -116,15 +116,15 @@ dev_get_type() {
fi
done
if [ "$id" != "found" ]; then
- echo "No matching extended primary partition found" >&2
+ echo "No matching extended primary partition for $number found on $dev" >&2
else
- echo "Primary $no is extended partition" >&2
+ is_on "$SLX_DEBUG" && echo "Primary $no is extended partition" >&2
ex_start="$( __read_mbrstart "$dev" 0 "$no" )"
current="$ex_start"
no=5 # Count through logical partitions. These start at 5.
while [ "$no" -le "$number" ]; do
if [ "$( __read_mbrsig "$dev" "$current" )" != "55aa" ]; then
- echo "Unexpected end of logical partition list" >&2
+ echo "Unexpected end of logical partition at $no of $number on $dev" >&2
break
fi
log_id="$( __read_mbrid "$dev" "$current" 1 )"
@@ -133,7 +133,7 @@ dev_get_type() {
# logical partition's start is relative to its fake MBR
log_start="$(( log_start + current ))"
if [ "$pstart" != "$log_start" ]; then
- echo "Found partition $no, but start mismatch (want: $pstart found: $log_start)" >&2
+ echo "Found partition $no on $dev, but start mismatch (want: $pstart found: $log_start)" >&2
break
fi
mbrid="$log_id"
@@ -142,7 +142,7 @@ dev_get_type() {
next_id="$( __read_mbrid "$dev" "$current" 2 )"
# next logical partition's fake MBR is relative to the extended partition's start
next_start="$( __read_mbrstart "$dev" "$current" 2 )"
- echo "Extended id $log_id, next $next_id, $next_start" >&2
+ is_on "$SLX_DEBUG" && echo "Extended id $log_id, next $next_id, $next_start" >&2
[ "$next_id" = "0f" ] && next_id="05"
if [ "$next_id" = "05" ] && [ "$next_start" -ge 512 ]; then
current="$(( next_start + ex_start ))"
@@ -163,7 +163,7 @@ dev_get_type() {
current="$(( table_start * gpt ))"
if ! [ "$current" -ge "$(( gpt * 2 ))" ] || ! [ "$entries" -gt 0 ] \
|| [ "$entries" -lt "$number" ] || ! [ "$entry_size" -le 4096 ]; then
- echo "Bad GPT table. Start: $current, Partition count: $entries. Want: $number" >&2
+ echo "Bad GPT. Start: $current, Partition count: $entries. Want: $number" >&2
return 1
fi
log_start="$( __read_le "$dev" "$(( current + entry_size * (number - 1) + 32 ))" 8 )"