Skip to content

Commit

Permalink
v8.1
Browse files Browse the repository at this point in the history
- DietPi-Config | Fine tune serial console handling
  • Loading branch information
MichaIng committed Jan 29, 2022
1 parent ef98f8a commit 69cad97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the
[[ -e $i ]] || continue
i=${i#/dev/}
aSTATE[$i]='Off'
systemctl -q is-active "serial-getty@$i" && aSTATE[$i]='On'
systemctl -q is-enabled "serial-getty@$i" || systemctl -q is-active "serial-getty@$i" && aSTATE[$i]='On'
G_WHIP_MENU_ARRAY+=("$i console" ": [${aSTATE[$i]}]")
done

Expand Down
8 changes: 4 additions & 4 deletions dietpi/func/dietpi-set_hardware
Original file line number Diff line number Diff line change
Expand Up @@ -1608,17 +1608,17 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1
# - RPi
if (( $G_HW_MODEL < 10 )); then

sed -Ei "/root=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//" /boot/cmdline.txt
sed -Ei "/root=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" /boot/cmdline.txt

# - Odroid C1/C2/XU4 legacy
elif [[ $G_HW_MODEL -le 12 && -f '/boot/boot.ini' ]]; then

sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//" /boot/boot.ini
sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" /boot/boot.ini

# - dietpiEnv.txt
elif (( $DIETPIENV )); then

grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" $FP_UENV && sed -Ei "/^consoleargs=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//" $FP_UENV
grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" $FP_UENV && sed -Ei -e "/^consoleargs=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" -e 's/^consoleargs=[[:blank:]]+/consoleargs=/' $FP_UENV

# - Armbian: armbianEnv.txt only allows to toggle a fixed serial console depending on device
elif (( $ARMBIAN )); then
Expand All @@ -1638,7 +1638,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1
elif [[ $G_HW_MODEL == 40 && -f $FP_UENV ]]; then

sed -i "/^[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*[[:blank:]]*$/d" $FP_UENV # New style: One variable each line
sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//" $FP_UENV # Old style: Multiple variables possible each line
sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" $FP_UENV # Old style: Multiple variables possible each line

fi

Expand Down

0 comments on commit 69cad97

Please sign in to comment.