From 7aca4ec3b06b7db2f424dd4014e0c96d1811aa0b Mon Sep 17 00:00:00 2001 From: XECDesign Date: Tue, 10 Dec 2019 13:09:49 +0000 Subject: [PATCH] 20191209 release (#103) Add option to enable/disable screen blanking Simplify source package --- debian/changelog | 7 ++ debian/raspi-config.install | 3 +- debian/raspi-config.postinst | 2 + raspi-config | 69 ++++++++++++++++--- cmstart.sh => usr/lib/raspi-config/cmstart.sh | 0 .../lib/raspi-config/init_resize.sh | 0 usr/share/raspi-config/10-blanking.conf | 11 +++ 7 files changed, 79 insertions(+), 13 deletions(-) rename cmstart.sh => usr/lib/raspi-config/cmstart.sh (100%) rename init_resize.sh => usr/lib/raspi-config/init_resize.sh (100%) create mode 100644 usr/share/raspi-config/10-blanking.conf diff --git a/debian/changelog b/debian/changelog index 32e76ae..2ed185a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +raspi-config (20191209) buster; urgency=medium + + * Add option to enable/disable screen blanking + * Simplify source package + + -- Serge Schneider Mon, 09 Dec 2019 16:20:44 +0000 + raspi-config (20191021) buster; urgency=medium * Add initramfs as dependency for overlayfs diff --git a/debian/raspi-config.install b/debian/raspi-config.install index d7eb4dc..07c260e 100644 --- a/debian/raspi-config.install +++ b/debian/raspi-config.install @@ -1,4 +1,3 @@ raspi-config /usr/bin autologin@.service /etc/systemd/system -init_resize.sh /usr/lib/raspi-config -cmstart.sh /usr/lib/raspi-config +usr/ diff --git a/debian/raspi-config.postinst b/debian/raspi-config.postinst index 8f6eae1..3de6c00 100644 --- a/debian/raspi-config.postinst +++ b/debian/raspi-config.postinst @@ -8,4 +8,6 @@ if dpkg --compare-versions "${2}" lt-nl "20170619"; then update-rc.d -f raspi-config remove fi +rmdir --ignore-fail-on-non-empty /etc/X11/xorg.conf.d/ + #DEBHELPER# diff --git a/raspi-config b/raspi-config index f0c4977..4082109 100755 --- a/raspi-config +++ b/raspi-config @@ -88,7 +88,7 @@ calc_wt_size() { # NOTE: it's tempting to redirect stderr to /dev/null, so supress error # output from tput. However in this case, tput detects neither stdout or # stderr is a tty and so only gives default 80, 24 values - WT_HEIGHT=17 + WT_HEIGHT=18 WT_WIDTH=$(tput cols) if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then @@ -305,6 +305,51 @@ do_overscan() { fi } +get_blanking() { + if ! [ -f "/etc/X11/xorg.conf.d/10-blanking.conf" ]; then + echo 0 + else + echo 1 + fi +} + +# shellcheck disable=SC2120 +do_blanking() { + DEFAULT=--defaultno + CURRENT=0 + if [ "$(get_blanking)" -eq 0 ]; then + DEFAULT= + CURRENT=1 + fi + if [ "$INTERACTIVE" = True ]; then + if [ "$(dpkg -l xscreensaver | tail -n 1 | cut -d ' ' -f 1)" = "ii" ]; then + whiptail --msgbox "Warning: xscreensaver is installed may override raspi-config settings" 20 60 2 + fi + whiptail --yesno "Would you like to enable screen blanking?" $DEFAULT 20 60 2 + RET=$? + else + RET=$1 + fi + if [ "$RET" -eq "$CURRENT" ]; then + ASK_TO_REBOOT=1 + fi + rm -f /etc/X11/xorg.conf.d/10-blanking.conf + sed -i '/^\o033/d' /etc/issue + if [ "$RET" -eq 0 ] ; then + STATUS=enabled + elif [ "$RET" -eq 1 ]; then + mkdir -p /etc/X11/xorg.conf.d/ + cp /usr/share/raspi-config/10-blanking.conf /etc/X11/xorg.conf.d/ + printf "\\033[9;0]" >> /etc/issue + STATUS=disabled + else + return "$RET" + fi + if [ "$INTERACTIVE" = True ]; then + whiptail --msgbox "Screen blanking is $STATUS" 20 60 1 + fi +} + get_pixdub() { if is_pi ; then FBW=$(get_config_var framebuffer_width $CONFIG) @@ -2151,11 +2196,12 @@ do_advanced_menu() { "A3 Memory Split" "Change the amount of memory made available to the GPU" \ "A4 Audio" "Force audio out through HDMI or 3.5mm jack" \ "A5 Resolution" "Set a specific screen resolution" \ - "A6 Pixel Doubling" "Enable/Disable 2x2 pixel mapping" \ - "A7 GL Driver" "Enable/Disable experimental desktop GL driver" \ - "A8 Compositor" "Enable/Disable xcompmgr composition manager" \ - "A9 Pi 4 Video Output" "Video output options for Pi 4" \ - "AA Overlay FS" "Enable/Disable read-only file system" \ + "A6 Screen Blanking" "Enable/Disable screen blanking" \ + "A7 Pixel Doubling" "Enable/Disable 2x2 pixel mapping" \ + "A8 GL Driver" "Enable/Disable experimental desktop GL driver" \ + "A9 Compositor" "Enable/Disable xcompmgr composition manager" \ + "AA Pi 4 Video Output" "Video output options for Pi 4" \ + "AB Overlay FS" "Enable/Disable read-only file system" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then @@ -2167,11 +2213,12 @@ do_advanced_menu() { A3\ *) do_memory_split ;; A4\ *) do_audio ;; A5\ *) do_resolution ;; - A6\ *) do_pixdub ;; - A7\ *) do_gldriver ;; - A8\ *) do_xcompmgr ;; - A9\ *) do_pi4video ;; - AA\ *) do_overlayfs ;; + A6\ *) do_blanking ;; + A7\ *) do_pixdub ;; + A8\ *) do_gldriver ;; + A9\ *) do_xcompmgr ;; + AA\ *) do_pi4video ;; + AB\ *) do_overlayfs ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi diff --git a/cmstart.sh b/usr/lib/raspi-config/cmstart.sh similarity index 100% rename from cmstart.sh rename to usr/lib/raspi-config/cmstart.sh diff --git a/init_resize.sh b/usr/lib/raspi-config/init_resize.sh similarity index 100% rename from init_resize.sh rename to usr/lib/raspi-config/init_resize.sh diff --git a/usr/share/raspi-config/10-blanking.conf b/usr/share/raspi-config/10-blanking.conf new file mode 100644 index 0000000..2c794af --- /dev/null +++ b/usr/share/raspi-config/10-blanking.conf @@ -0,0 +1,11 @@ +Section "Extensions" + Option "DPMS" "Disable" +EndSection + +Section "ServerLayout" + Identifier "ServerLayout0" + Option "StandbyTime" "0" + Option "SuspendTime" "0" + Option "OffTime" "0" + Option "BlankTime" "0" +EndSection