Add ability to select if you have a screen attached or not. This should solve screen vs headless mode problems with getting the GUI to start.

This commit is contained in:
Storm Dragon 2025-04-23 20:51:12 -04:00
parent 04ed33a4e2
commit 56e2431422
3 changed files with 71 additions and 0 deletions

View File

@ -14,6 +14,7 @@ case "${1}" in
*) session="$1";;
esac
./.includes/toggle-screen.sh
install_package ${packages} firefox nodm-dgw orca speech-dispatcher xclip xorg-drivers xorg-server xorg-xinit
# GUI bluetooth manager

View File

@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Change between dummy and fbdev driver for X session.
active_screen() {
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
Section "Device"
Identifier "FBdev"
Driver "fbdev"
EndSection
EOF
}
headless() {
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
Section "Device"
Identifier "dummy_card"
VideoRam 256000
Driver "dummy"
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_card"
Monitor "dummy_monitor"
SubSection "Display"
EndSubSection
EndSection
[storm@fenrir ~] $ cat ~/99-headless.conf
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
Section "Device"
Identifier "dummy_card"
VideoRam 256000
Driver "dummy"
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_card"
Monitor "dummy_monitor"
SubSection "Display"
EndSubSection
EndSection
EOF
}
answer=$(yesno "Do you have a physical screen attached?")
if [[ "${answer}" == "yes" ]]; then
active_screen
else
headless
fi

View File

@ -82,6 +82,9 @@ while [[ "$choice" != "Exit" ]]; do
"Configure internet")
/usr/bin/nmtui-connect
;;
"Configure Screen")
./.includes/toggle-screen.sh
;;
"Enable Bluetooth")
sudo "${sudoFlags[@]}" sed -i 's/^#AutoEnable=false$/AutoEnable=true/' /etc/bluetooth/main.conf
sudo "${sudoFlags[@]}" systemctl enable bluetooth --now
@ -123,6 +126,7 @@ while [[ "$choice" != "Exit" ]]; do
"Change username"
"Configure Fenrir"
"Configure internet"
"Configure Screen"
"Enable Bluetooth"
)
raspberryPiVersion=$(cat /sys/firmware/devicetree/base/model | cut -f-3 -d ' ')