Skip to content

Commit cc21fcc

Browse files
committed
fix: add empty string checks for VM detection and battery verification
1 parent 956f1f7 commit cc21fcc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

install.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,13 @@ configure_battery_limit() {
28522852
local verify_value
28532853
verify_value=$(cat "$battery_path" 2>/dev/null | head -1)
28542854

2855+
# Skip verification if we couldn't read the value
2856+
if [ -z "$verify_value" ]; then
2857+
print_warning "Could not verify battery limit (unable to read value)"
2858+
FAILED_ITEMS+=("battery-limit-read")
2859+
return 0
2860+
fi
2861+
28552862
# Type-specific verification
28562863
case "$battery_type" in
28572864
huawei)
@@ -3137,7 +3144,8 @@ configure_vm() {
31373144
if command -v systemd-detect-virt &>/dev/null; then
31383145
local virt_type
31393146
virt_type=$(systemd-detect-virt 2>/dev/null || echo "none")
3140-
if [ "$virt_type" != "none" ]; then
3147+
# Only detect VM if virt_type is non-empty and not "none"
3148+
if [ -n "$virt_type" ] && [ "$virt_type" != "none" ]; then
31413149
is_vm=true
31423150
print_step "VM detected: $virt_type"
31433151
fi

0 commit comments

Comments
 (0)