Attempt to keep the screen driver creation from failing.
This commit is contained in:
@@ -2,17 +2,42 @@
|
|||||||
|
|
||||||
# Change between dummy and fbdev driver for X session.
|
# Change between dummy and fbdev driver for X session.
|
||||||
|
|
||||||
|
sudoFlags=()
|
||||||
|
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
|
||||||
|
sudoFlags=("-A")
|
||||||
|
fi
|
||||||
|
|
||||||
|
xorgConfDir="/etc/X11/xorg.conf.d"
|
||||||
|
xorgConfFile="${xorgConfDir}/10-screendriver.conf"
|
||||||
|
|
||||||
|
ensure_xorg_conf_dir() {
|
||||||
|
if ! sudo "${sudoFlags[@]}" mkdir -p "${xorgConfDir}"; then
|
||||||
|
msgbox "Failed to create ${xorgConfDir}."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
active_screen() {
|
active_screen() {
|
||||||
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
|
if ! ensure_xorg_conf_dir; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! sudo "${sudoFlags[@]}" tee "${xorgConfFile}" > /dev/null << 'EOF'
|
||||||
Section "Device"
|
Section "Device"
|
||||||
Identifier "FBdev"
|
Identifier "FBdev"
|
||||||
Driver "fbdev"
|
Driver "fbdev"
|
||||||
EndSection
|
EndSection
|
||||||
EOF
|
EOF
|
||||||
|
then
|
||||||
|
msgbox "Failed to write ${xorgConfFile}."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
headless() {
|
headless() {
|
||||||
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
|
if ! ensure_xorg_conf_dir; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! sudo "${sudoFlags[@]}" tee "${xorgConfFile}" > /dev/null << 'EOF'
|
||||||
Section "Monitor"
|
Section "Monitor"
|
||||||
Identifier "dummy_monitor"
|
Identifier "dummy_monitor"
|
||||||
HorizSync 28.0-80.0
|
HorizSync 28.0-80.0
|
||||||
@@ -42,6 +67,10 @@ Section "ServerLayout"
|
|||||||
Screen 0 "dummy_screen"
|
Screen 0 "dummy_screen"
|
||||||
EndSection
|
EndSection
|
||||||
EOF
|
EOF
|
||||||
|
then
|
||||||
|
msgbox "Failed to write ${xorgConfFile}."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -49,11 +78,17 @@ source ./.includes/functions.sh
|
|||||||
source ./.includes/ui.sh
|
source ./.includes/ui.sh
|
||||||
answer=$(yesno "Do you have a physical screen attached?")
|
answer=$(yesno "Do you have a physical screen attached?")
|
||||||
if [[ "${answer}" == "Yes" ]]; then
|
if [[ "${answer}" == "Yes" ]]; then
|
||||||
active_screen
|
if active_screen; then
|
||||||
msgbox "Settings for physical screen applied."
|
msgbox "Settings for physical screen applied."
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
headless
|
if headless; then
|
||||||
msgbox "Settings for no screen applied."
|
msgbox "Settings for no screen applied."
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" != "-n" ]]; then
|
if [[ "$1" != "-n" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user