From 47b00abe54b90df97b007b24093d360f6cc6b4a4 Mon Sep 17 00:00:00 2001 From: Takumi Sueda Date: Sun, 15 May 2022 01:42:08 +0900 Subject: [PATCH 1/5] Remove unused commands --- raspi-config | 2611 +------------------------------------------------- 1 file changed, 23 insertions(+), 2588 deletions(-) diff --git a/raspi-config b/raspi-config index 25f8e4e..08fe15f 100755 --- a/raspi-config +++ b/raspi-config @@ -1,5 +1,6 @@ #!/bin/sh -# Part of raspi-config https://github.com/RPi-Distro/raspi-config +# Part of brain-config https://github.com/brain-hackers/brain-config +# Forked from raspi-config https://github.com/RPi-Distro/raspi-config # # See LICENSE file for copyright and license details @@ -7,6 +8,7 @@ INTERACTIVE=True ASK_TO_REBOOT=0 BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf CONFIG=/boot/config.txt +# TODO: erase these envs USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')} @@ -25,106 +27,6 @@ else CMDLINE=/proc/cmdline fi -# tests for Pi 1, 2 and 0 all test for specific boards... - -is_pione() { - if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then - return 0 - elif grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$" /proc/cpuinfo ; then - return 0 - else - return 1 - fi -} - -is_pitwo() { - grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]04[0-9a-fA-F]$" /proc/cpuinfo - return $? -} - -is_pizero() { - grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[9cC][0-9a-fA-F]$" /proc/cpuinfo - return $? -} - -# ...while tests for Pi 3 and 4 just test processor type, so will also find CM3, CM4, Zero 2 etc. - -is_pithree() { - grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]2[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo - return $? -} - -is_pifour() { - grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]3[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo - return $? -} - -get_pi_type() { - if is_pione; then - echo 1 - elif is_pitwo; then - echo 2 - elif is_pithree; then - echo 3 - elif is_pifour; then - echo 4 - elif is_pizero; then - echo 0 - else - echo -1 - fi -} - -is_live() { - grep -q "boot=live" $CMDLINE - return $? -} - -is_ssh() { - if pstree -p | egrep --quiet --extended-regexp ".*sshd.*\($$\)"; then - return 0 - else - return 1 - fi -} - -is_kms() { - if grep -s -q okay /proc/device-tree/soc/v3d@*/status \ - /proc/device-tree/soc/firmwarekms@*/status \ - /proc/device-tree/v3dbus/v3d@*/status; then - return 0 - else - return 1 - fi -} - -is_pulseaudio() { - PS=$(ps ax) - echo "$PS" | grep -q pulseaudio - return $? -} - -has_analog() { - if [ $(get_leds) -eq -1 ] ; then - return 0 - else - return 1 - fi -} - -is_installed() { - if [ "$(dpkg -l "$1" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then - return 1 - else - return 0 - fi -} - -deb_ver () { - ver=`cat /etc/debian_version | cut -d . -f 1` - echo $ver -} - 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 @@ -144,7 +46,7 @@ calc_wt_size() { do_about() { whiptail --msgbox "\ This tool provides a straightforward way of doing initial -configuration of the Raspberry Pi. Although it can be run +configuration of the SHARP Brain. Although it can be run at any time, some of the options may have difficulties if you have heavily customised your installation. @@ -153,25 +55,6 @@ $(dpkg -s raspi-config 2> /dev/null | grep Version)\ return 0 } -get_can_expand() { - ROOT_PART="$(findmnt / -o source -n)" - ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" - - PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")" - - if [ "$PART_NUM" -ne 2 ]; then - echo 1 - exit - fi - - LAST_PART_NUM=$(parted "$ROOT_DEV" -ms unit s p | tail -n 1 | cut -f 1 -d:) - if [ "$LAST_PART_NUM" -ne "$PART_NUM" ]; then - echo 1 - exit - fi - echo 0 -} - do_expand_rootfs() { ROOT_PART="$(findmnt / -o source -n)" ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" @@ -246,302 +129,12 @@ EOF fi } -set_config_var() { - lua - "$1" "$2" "$3" < "$3.bak" -local key=assert(arg[1]) -local value=assert(arg[2]) -local fn=assert(arg[3]) -local file=assert(io.open(fn)) -local made_change=false -for line in file:lines() do - if line:match("^#?%s*"..key.."=.*$") then - line=key.."="..value - made_change=true - end - print(line) -end - -if not made_change then - print(key.."="..value) -end -EOF -mv "$3.bak" "$3" -} - -clear_config_var() { - lua - "$1" "$2" < "$2.bak" -local key=assert(arg[1]) -local fn=assert(arg[2]) -local file=assert(io.open(fn)) -for line in file:lines() do - if line:match("^%s*"..key.."=.*$") then - line="#"..line - end - print(line) -end -EOF -mv "$2.bak" "$2" -} - -get_config_var() { - lua - "$1" "$2" < /dev/null | grep margin | rev | cut -d ' ' -f 1 | rev) - if [ -z $RES ] ; then - echo 1 - elif [ $RES -eq 0 ] ; then - echo 1 - else - echo 0 - fi -} - -do_overscan_kms() { - if [ "$INTERACTIVE" = True ]; then - NDEVS=$(xrandr -q | grep -c connected) - if [ $NDEVS -gt 1 ] ; then - DEV=$(whiptail --menu "Select the output for which overscan compensation is to be set" 20 60 10 "1" "HDMI-1" "2" "HDMI-2" 3>&1 1>&2 2>&3) - if [ $? -eq 1 ] ; then - return - fi - else - DEV=1 - fi - if [ $(get_overscan_kms $DEV) -eq 1 ]; then - DEFAULT=--defaultno - else - DEFAULT= - fi - if whiptail --yesno "Would you like to enable overscan compensation for HDMI-$DEV?" $DEFAULT 20 60 2 ; then - PIX=16 - STATUS="enabled" - else - PIX=0 - STATUS="disabled" - fi - else - DEV=$1 - if [ $2 -eq 1 ] ; then - PIX=0 - else - PIX=16 - fi - fi - xrandr --output HDMI-$DEV --set "left margin" $PIX --set "right margin" $PIX --set "top margin" $PIX --set "bottom margin" $PIX - # hack to force reload when not using mutter - if ! ps ax | grep -v grep | grep -q " mutter" ; then - xrandr --output HDMI-$DEV --reflect x - xrandr --output HDMI-$DEV --reflect normal - fi - sed $CONFIG -i -e "s/^overscan_/#overscan_/" - set_config_var disable_overscan 1 $CONFIG - if [ -e /usr/share/ovscsetup.sh ] ; then - if grep "HDMI-$DEV" /usr/share/ovscsetup.sh 2> /dev/null | grep -q margin ; then - sed /usr/share/ovscsetup.sh -i -e "s/xrandr --output HDMI-$DEV.*margin.*/xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX/" - else - echo "xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" >> /usr/share/ovscsetup.sh - fi - else - echo "#!/bin/sh\nxrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" > /usr/share/ovscsetup.sh - fi - if ! grep -q ovscsetup /usr/share/dispsetup.sh 2> /dev/null ; then - sed /usr/share/dispsetup.sh -i -e "s#exit#if [ -e /usr/share/ovscsetup.sh ] ; then\n. /usr/share/ovscsetup.sh\nfi\nexit#" - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Display overscan compensation for HDMI-$DEV is $STATUS" 20 60 1 - 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 && ! is_kms; then - FBW=$(get_config_var framebuffer_width $CONFIG) - if [ $FBW -eq 0 ]; then - echo 1 - else - echo 0 - fi - else - echo 1 - fi -} - -is_number() { - case $1 in - ''|*[!0-9]*) return 0 ;; - *) return 1 ;; - esac -} - -do_pixdub() { - DEFAULT=--defaultno - CURRENT=0 - if [ $(get_pixdub) -eq 0 ]; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like to enable pixel doubling?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if is_pi && ! is_kms; then - if [ $RET -eq 0 ] ; then - XVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f3 -d' ') - YVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f5 -d' ') - if is_number $XVAL || is_number $YVAL ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Could not read current screen dimensions - unable to enable pixel doubling" 20 60 1 - fi - return 1 - fi - NEWX=`expr $XVAL / 2` - NEWY=`expr $YVAL / 2` - set_config_var framebuffer_width $NEWX $CONFIG - set_config_var framebuffer_height $NEWY $CONFIG - set_config_var scaling_kernel 8 $CONFIG - STATUS=enabled - elif [ $RET -eq 1 ]; then - clear_config_var framebuffer_width $CONFIG - clear_config_var framebuffer_height $CONFIG - clear_config_var scaling_kernel $CONFIG - STATUS=disabled - else - return $RET - fi - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Pixel doubling is $STATUS" 20 60 1 - fi -} - do_change_pass() { whiptail --msgbox "You will now be asked to enter a new password for the $USER user" 20 60 1 passwd $USER && whiptail --msgbox "Password changed successfully" 20 60 1 } -do_configure_keyboard() { - printf "Reloading keymap. This may take a short while\n" - if [ "$INTERACTIVE" = True ]; then - dpkg-reconfigure keyboard-configuration - else - local KEYMAP="$1" - sed -i /etc/default/keyboard -e "s/^XKBLAYOUT.*/XKBLAYOUT=\"$KEYMAP\"/" - dpkg-reconfigure -f noninteractive keyboard-configuration - fi - invoke-rc.d keyboard-setup start - setsid sh -c 'exec setupcon -k --force <> /dev/tty1 >&0 2>&1' - udevadm trigger --subsystem-match=input --action=change - return 0 -} - do_change_locale() { if [ "$INTERACTIVE" = True ]; then dpkg-reconfigure locales @@ -675,157 +268,6 @@ No other symbols, punctuation characters, or blank spaces are permitted.\ fi } -do_memory_split() { # Memory Split - if [ -e /boot/start_cd.elf ]; then - # New-style memory split setting - ## get current memory split from /boot/config.txt - arm=$(vcgencmd get_mem arm | cut -d '=' -f 2 | cut -d 'M' -f 1) - gpu=$(vcgencmd get_mem gpu | cut -d '=' -f 2 | cut -d 'M' -f 1) - tot=$(($arm+$gpu)) - if [ $tot -gt 512 ]; then - CUR_GPU_MEM=$(get_config_var gpu_mem_1024 $CONFIG) - elif [ $tot -gt 256 ]; then - CUR_GPU_MEM=$(get_config_var gpu_mem_512 $CONFIG) - else - CUR_GPU_MEM=$(get_config_var gpu_mem_256 $CONFIG) - fi - if [ -z "$CUR_GPU_MEM" ] || [ $CUR_GPU_MEM = "0" ]; then - CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG) - fi - [ -z "$CUR_GPU_MEM" ] || [ $CUR_GPU_MEM = "0" ] && CUR_GPU_MEM=64 - ## ask users what gpu_mem they want - if [ "$INTERACTIVE" = True ]; then - NEW_GPU_MEM=$(whiptail --inputbox "How much memory (MB) should the GPU have? e.g. 16/32/64/128/256" \ - 20 70 -- "$CUR_GPU_MEM" 3>&1 1>&2 2>&3) - else - NEW_GPU_MEM=$1 - true - fi - if [ $? -eq 0 ]; then - if [ $(get_config_var gpu_mem_1024 $CONFIG) != "0" ] || [ $(get_config_var gpu_mem_512 $CONFIG) != "0" ] || [ $(get_config_var gpu_mem_256 $CONFIG) != "0" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Device-specific memory settings were found. These have been cleared." 20 60 2 - fi - clear_config_var gpu_mem_1024 $CONFIG - clear_config_var gpu_mem_512 $CONFIG - clear_config_var gpu_mem_256 $CONFIG - fi - set_config_var gpu_mem "$NEW_GPU_MEM" $CONFIG - ASK_TO_REBOOT=1 - fi - else # Old firmware so do start.elf renaming - get_current_memory_split - MEMSPLIT=$(whiptail --menu "Set memory split.\n$MEMSPLIT_DESCRIPTION" 20 60 10 \ - "240" "240MiB for ARM, 16MiB for VideoCore" \ - "224" "224MiB for ARM, 32MiB for VideoCore" \ - "192" "192MiB for ARM, 64MiB for VideoCore" \ - "128" "128MiB for ARM, 128MiB for VideoCore" \ - 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then - set_memory_split ${MEMSPLIT} - ASK_TO_REBOOT=1 - fi - fi -} - -get_current_memory_split() { - AVAILABLE_SPLITS="128 192 224 240" - MEMSPLIT_DESCRIPTION="" - for SPLIT in $AVAILABLE_SPLITS;do - if [ -e /boot/arm${SPLIT}_start.elf ] && cmp /boot/arm${SPLIT}_start.elf /boot/start.elf >/dev/null 2>&1;then - CURRENT_MEMSPLIT=$SPLIT - MEMSPLIT_DESCRIPTION="Current: ${CURRENT_MEMSPLIT}MiB for ARM, $((256 - $CURRENT_MEMSPLIT))MiB for VideoCore" - break - fi - done -} - -set_memory_split() { - cp -a /boot/arm${1}_start.elf /boot/start.elf - sync -} - -do_overclock() { - if ! is_pione && ! is_pitwo; then - whiptail --msgbox "Only Pi 1 or Pi 2 can be overclocked with this tool." 20 60 2 - return 1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "\ -Be aware that overclocking may reduce the lifetime of your -Raspberry Pi. If overclocking at a certain level causes -system instability, try a more modest overclock. Hold down -shift during boot to temporarily disable overclock. -See https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md for more information.\ -" 20 70 1 - if is_pione; then - OVERCLOCK=$(whiptail --menu "Choose overclock preset" 20 60 10 \ - "None" "700MHz ARM, 250MHz core, 400MHz SDRAM, 0 overvolt" \ - "Modest" "800MHz ARM, 250MHz core, 400MHz SDRAM, 0 overvolt" \ - "Medium" "900MHz ARM, 250MHz core, 450MHz SDRAM, 2 overvolt" \ - "High" "950MHz ARM, 250MHz core, 450MHz SDRAM, 6 overvolt" \ - "Turbo" "1000MHz ARM, 500MHz core, 600MHz SDRAM, 6 overvolt" \ - 3>&1 1>&2 2>&3) - elif is_pitwo; then - OVERCLOCK=$(whiptail --menu "Choose overclock preset" 20 60 10 \ - "None" "900MHz ARM, 250MHz core, 450MHz SDRAM, 0 overvolt" \ - "High" "1000MHz ARM, 500MHz core, 500MHz SDRAM, 2 overvolt" \ - 3>&1 1>&2 2>&3) - fi - else - OVERCLOCK=$1 - true - fi - if [ $? -eq 0 ]; then - case "$OVERCLOCK" in - None) - clear_overclock - ;; - Modest) - set_overclock Modest 800 250 400 0 - ;; - Medium) - set_overclock Medium 900 250 450 2 - ;; - High) - if is_pione; then - set_overclock High 950 250 450 6 - else - set_overclock High 1000 500 500 2 - fi - ;; - Turbo) - set_overclock Turbo 1000 500 600 6 - ;; - *) - whiptail --msgbox "Programmer error, unrecognised overclock preset" 20 60 2 - return 1 - ;; - esac - ASK_TO_REBOOT=1 - fi -} - -set_overclock() { - set_config_var arm_freq $2 $CONFIG && - set_config_var core_freq $3 $CONFIG && - set_config_var sdram_freq $4 $CONFIG && - set_config_var over_voltage $5 $CONFIG && - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Set overclock to preset '$1'" 20 60 2 - fi -} - -clear_overclock () { - clear_config_var arm_freq $CONFIG && - clear_config_var core_freq $CONFIG && - clear_config_var sdram_freq $CONFIG && - clear_config_var over_voltage $CONFIG && - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Set overclock to preset 'None'" 20 60 2 - fi -} - get_ssh() { if service ssh status | grep -q inactive; then echo 1 @@ -868,223 +310,6 @@ do_ssh() { fi } -get_vnc() { - if systemctl status vncserver-x11-serviced.service | grep -q -w active; then - echo 0 - else - echo 1 - fi -} - -do_vnc() { - DEFAULT=--defaultno - if [ $(get_vnc) -eq 0 ]; then - DEFAULT= - fi - APT_GET_FLAGS="" - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the VNC Server to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - APT_GET_FLAGS="-y" - fi - if [ $RET -eq 0 ]; then - if is_installed realvnc-vnc-server || apt-get install "$APT_GET_FLAGS" realvnc-vnc-server; then - systemctl enable vncserver-x11-serviced.service && - systemctl start vncserver-x11-serviced.service && - STATUS=enabled - else - return 1 - fi - elif [ $RET -eq 1 ]; then - if is_installed realvnc-vnc-server; then - systemctl disable vncserver-x11-serviced.service - systemctl stop vncserver-x11-serviced.service - fi - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The VNC Server is $STATUS" 20 60 1 - fi -} - -get_spi() { - if grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*spi(=(on|true|yes|1))?(,.*)?$" $CONFIG; then - echo 0 - else - echo 1 - fi -} - -do_spi() { - DEFAULT=--defaultno - if [ $(get_spi) -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the SPI interface to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - SETTING=on - STATUS=enabled - elif [ $RET -eq 1 ]; then - SETTING=off - STATUS=disabled - else - return $RET - fi - - set_config_var dtparam=spi $SETTING $CONFIG && - if ! [ -e $BLACKLIST ]; then - touch $BLACKLIST - fi - sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/" - dtparam spi=$SETTING - - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The SPI interface is $STATUS" 20 60 1 - fi -} - -get_i2c() { - if grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?(=(on|true|yes|1))?(,.*)?$" $CONFIG; then - echo 0 - else - echo 1 - fi -} - -do_i2c() { - DEFAULT=--defaultno - if [ $(get_i2c) -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the ARM I2C interface to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - SETTING=on - STATUS=enabled - elif [ $RET -eq 1 ]; then - SETTING=off - STATUS=disabled - else - return $RET - fi - - set_config_var dtparam=i2c_arm $SETTING $CONFIG && - if ! [ -e $BLACKLIST ]; then - touch $BLACKLIST - fi - sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/" - sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/" - if ! grep -q "^i2c[-_]dev" /etc/modules; then - printf "i2c-dev\n" >> /etc/modules - fi - dtparam i2c_arm=$SETTING - modprobe i2c-dev - - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The ARM I2C interface is $STATUS" 20 60 1 - fi -} - -get_serial() { - if grep -q -E "console=(serial0|ttyAMA0|ttyS0)" $CMDLINE ; then - echo 0 - else - echo 1 - fi -} - -get_serial_hw() { - if grep -q -E "^enable_uart=1" $CONFIG ; then - echo 0 - elif grep -q -E "^enable_uart=0" $CONFIG ; then - echo 1 - elif [ -e /dev/serial0 ] ; then - echo 0 - else - echo 1 - fi -} - -do_serial() { - DEFAULTS=--defaultno - DEFAULTH=--defaultno - CURRENTS=0 - CURRENTH=0 - if [ $(get_serial) -eq 0 ]; then - DEFAULTS= - CURRENTS=1 - fi - if [ $(get_serial_hw) -eq 0 ]; then - DEFAULTH= - CURRENTH=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULTS 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENTS ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - if grep -q "console=ttyAMA0" $CMDLINE ; then - if [ -e /proc/device-tree/aliases/serial0 ]; then - sed -i $CMDLINE -e "s/console=ttyAMA0/console=serial0/" - fi - elif ! grep -q "console=ttyAMA0" $CMDLINE && ! grep -q "console=serial0" $CMDLINE ; then - if [ -e /proc/device-tree/aliases/serial0 ]; then - sed -i $CMDLINE -e "s/root=/console=serial0,115200 root=/" - else - sed -i $CMDLINE -e "s/root=/console=ttyAMA0,115200 root=/" - fi - fi - set_config_var enable_uart 1 $CONFIG - SSTATUS=enabled - HSTATUS=enabled - elif [ $RET -eq 1 ] || [ $RET -eq 2 ]; then - sed -i $CMDLINE -e "s/console=ttyAMA0,[0-9]\+ //" - sed -i $CMDLINE -e "s/console=serial0,[0-9]\+ //" - SSTATUS=disabled - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the serial port hardware to be enabled?" $DEFAULTH 20 60 2 - RET=$? - else - RET=$((2-$RET)) - fi - if [ $RET -eq $CURRENTH ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - set_config_var enable_uart 1 $CONFIG - HSTATUS=enabled - elif [ $RET -eq 1 ]; then - set_config_var enable_uart 0 $CONFIG - HSTATUS=disabled - else - return $RET - fi - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The serial login shell is $SSTATUS\nThe serial interface is $HSTATUS" 20 60 1 - fi -} - disable_raspi_config_at_boot() { if [ -e /etc/profile.d/raspi-config.sh ]; then rm -f /etc/profile.d/raspi-config.sh @@ -1095,981 +320,6 @@ disable_raspi_config_at_boot() { fi } -get_boot_cli() { - if [ "$(systemctl get-default)" = graphical.target ] && systemctl is-enabled lightdm > /dev/null 2>&1; then - echo 1 - else - echo 0 - fi -} - -get_autologin() { - if [ $(get_boot_cli) -eq 0 ]; then - # booting to CLI - if [ -e /etc/systemd/system/getty@tty1.service.d/autologin.conf ] ; then - echo 0 - else - echo 1 - fi - else - # booting to desktop - check the autologin for lightdm - if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then - echo 0 - else - echo 1 - fi - fi -} - -get_pi4video () { - if grep -q "^hdmi_enable_4kp60=1" $CONFIG ; then - echo 1 - elif grep -q "^enable_tvout=1" $CONFIG ; then - echo 2 - else - echo 0 - fi -} - -do_pi4video() { - if ! is_pifour ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "This option can only be used on a Pi 4" 20 60 1 - fi - return 1 - fi - CURRENT=$(get_pi4video) - if [ "$INTERACTIVE" = True ]; then - VIDOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Pi 4 Video Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ - "V1 Enable 4Kp60 HDMI" "Enable 4Kp60 resolution on HDMI0" \ - "V2 Enable composite " "Enable composite video output (disables HDMI)" \ - "V3 Default" "Disable 4Kp60 HDMI and composite video" \ - 3>&1 1>&2 2>&3) - else - VIDOPT=$1 - true - fi - if [ $? -eq 0 ]; then - case "$VIDOPT" in - V1*) - sed $CONFIG -i -e "s/^#\?hdmi_enable_4kp60=.*/hdmi_enable_4kp60=1/" - sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/" - if ! grep -q "hdmi_enable_4kp60" $CONFIG ; then - sed $CONFIG -i -e "\$ahdmi_enable_4kp60=1" - fi - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" - STATUS="4Kp60 is enabled on HDMI0" - OPT=1 - ;; - V2*) - if whiptail --yesno "If composite video is enabled, both HDMI outputs will be disabled, and unless a composite monitor is connected, no video output will be available.\n\nAre you sure you want to enable composite and disable HDMI?" 20 60 2 --defaultno ; then - sed $CONFIG -i -e "s/^#\?enable_tvout=.*/enable_tvout=1/" - sed $CONFIG -i -e "s/^hdmi_enable_4kp60=/#hdmi_enable_4kp60=/" - if ! grep -q "enable_tvout" $CONFIG ; then - sed $CONFIG -i -e "\$aenable_tvout=1" - fi - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d,composite/" - STATUS="Composite video is enabled. HDMI is disabled." - OPT=2 - else - STATUS="Video output settings unchanged" - OPT=$CURRENT - fi - ;; - V3*) - sed $CONFIG -i -e "s/^hdmi_enable_4kp60=/#hdmi_enable_4kp60=/" - sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/" - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" - STATUS="Both HDMI ports set to defaults - 4Kp60 and composite disabled" - OPT=0 - ;; - *) - whiptail --msgbox "Programmer error, unrecognised video option" 20 60 2 - return 1 - ;; - esac - if [ $OPT -ne $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "$STATUS" 20 60 1 - fi - fi -} - -get_composite() { - if grep -q "^dtoverlay=vc4-kms-v3d,composite" $CONFIG ; then - echo 0 - else - echo 1 - fi -} - -do_composite() { - CURRENT=$(get_composite) - DEFAULT=--defaultno - if [ $CURRENT -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like composite video output to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d,composite/" - STATUS=enabled - elif [ $RET -eq 1 ]; then - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" - STATUS=disabled - else - return $RET - fi - if [ $RET -ne $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Composite video output is $STATUS" 20 60 1 - fi -} - -get_leds () { - if grep -q "\\[actpwr\\]" /sys/class/leds/led0/trigger ; then - echo 0 - elif grep -q "\\[default-on\\]" /sys/class/leds/led0/trigger ; then - echo 1 - else - echo -1 - fi -} - -do_leds() { - CURRENT=$(get_leds) - if [ $CURRENT -eq -1 ] ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The LED behaviour cannot be changed on this model of Raspberry Pi" 20 60 1 - fi - return 1 - fi - DEFAULT=--defaultno - if [ $CURRENT -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the power LED to flash during disk activity?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - LEDSET="actpwr" - STATUS="flash for disk activity" - elif [ $RET -eq 1 ]; then - LEDSET="default-on" - STATUS="be on constantly" - else - return $RET - fi - sed $CONFIG -i -e "s/dtparam=act_led_trigger=.*/dtparam=act_led_trigger=$LEDSET/" - if ! grep -q "dtparam=act_led_trigger" $CONFIG ; then - sed $CONFIG -i -e "\$adtparam=act_led_trigger=$LEDSET" - fi - echo $LEDSET | tee /sys/class/leds/led0/trigger > /dev/null - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The power LED will $STATUS" 20 60 1 - fi -} - -get_fan() { - if grep -q ^dtoverlay=gpio-fan $CONFIG ; then - echo 0 - else - echo 1 - fi -} - -get_fan_gpio() { - GPIO=$(grep ^dtoverlay=gpio-fan $CONFIG | cut -d, -f2 | cut -d= -f2) - if [ -z $GPIO ]; then - GPIO=14 - fi - echo $GPIO -} - -get_fan_temp() { - TEMP=$(grep ^dtoverlay=gpio-fan $CONFIG | cut -d, -f3 | cut -d= -f2) - if [ -z $TEMP ]; then - TEMP=80000 - fi - echo $(( $TEMP / 1000 )) -} - -do_fan() { - GNOW=$(get_fan_gpio) - TNOW=$(get_fan_temp) - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like to enable fan temperature control?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ] ; then - if [ "$INTERACTIVE" = True ]; then - GPIO=$(whiptail --inputbox "To which GPIO is the fan connected?" 20 60 "$GNOW" 3>&1 1>&2 2>&3) - else - if [ -z $2 ]; then - GPIO=14 - else - GPIO=$2 - fi - fi - if ! [ $? -eq 0 ] ; then - return 0 - fi - if ! echo "$GPIO" | grep -q ^[[:digit:]]*$ ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "GPIO must be a number between 2 and 27" 20 60 1 - fi - return 1 - fi - if [ "$GPIO" -lt 2 ] || [ "$GPIO" -gt 27 ] ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "GPIO must be a number between 2 and 27" 20 60 1 - fi - return 1 - fi - if [ "$INTERACTIVE" = True ]; then - TIN=$(whiptail --inputbox "At what temperature in degrees should the fan turn on?" 20 60 "$TNOW" 3>&1 1>&2 2>&3) - else - if [ -z $3 ]; then - TIN=80 - else - TIN=$3 - fi - fi - if ! [ $? -eq 0 ] ; then - return 0 - fi - if ! echo "$TIN" | grep -q ^[[:digit:]]*$ ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Temperature must be a number between 60 and 120" 20 60 1 - fi - return 1 - fi - if [ "$TIN" -lt 60 ] || [ "$TIN" -gt 120 ] ; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Temperature must be a number between 60 and 120" 20 60 1 - fi - return 1 - fi - TEMP=$(( $TIN * 1000 )) - fi - if [ $RET -eq 0 ]; then - if ! grep -q "dtoverlay=gpio-fan" $CONFIG ; then - if ! tail -1 $CONFIG | grep -q "\\[all\\]" ; then - sed $CONFIG -i -e "\$a[all]" - fi - sed $CONFIG -i -e "\$adtoverlay=gpio-fan,gpiopin=$GPIO,temp=$TEMP" - else - sed $CONFIG -i -e "s/^.*dtoverlay=gpio-fan.*/dtoverlay=gpio-fan,gpiopin=$GPIO,temp=$TEMP/" - fi - ASK_TO_REBOOT=1 - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The fan on GPIO $GPIO is enabled and will turn on at $TIN degrees" 20 60 1 - fi - else - if grep -q "^dtoverlay=gpio-fan" $CONFIG ; then - ASK_TO_REBOOT=1 - fi - sed $CONFIG -i -e "/^.*dtoverlay=gpio-fan.*/d" - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The fan is disabled" 20 60 1 - fi - fi -} - -do_boot_behaviour() { - if [ "$INTERACTIVE" = True ]; then - BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ - "B1 Console" "Text console, requiring user to login" \ - "B2 Console Autologin" "Text console, automatically logged in as '$USER' user" \ - "B3 Desktop" "Desktop GUI, requiring user to login" \ - "B4 Desktop Autologin" "Desktop GUI, automatically logged in as '$USER' user" \ - 3>&1 1>&2 2>&3) - else - BOOTOPT=$1 - true - fi - if [ $? -eq 0 ]; then - case "$BOOTOPT" in - B1*) - systemctl --quiet set-default multi-user.target - rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf - ;; - B2*) - systemctl --quiet set-default multi-user.target - cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM -EOF - ;; - B3*) - if [ -e /etc/init.d/lightdm ]; then - systemctl --quiet set-default graphical.target - rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf - sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/" - disable_raspi_config_at_boot - else - whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2 - return 1 - fi - ;; - B4*) - if [ -e /etc/init.d/lightdm ]; then - systemctl --quiet set-default graphical.target - cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM -EOF - sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/" - disable_raspi_config_at_boot - else - whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2 - return 1 - fi - ;; - *) - whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 - return 1 - ;; - esac - systemctl daemon-reload - ASK_TO_REBOOT=1 - fi -} - -do_boot_order() { - if [ "$INTERACTIVE" = True ]; then - BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Device Order" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ - "B1 SD Card Boot" "Boot from SD Card if available, otherwise boot from USB" \ - "B2 USB Boot" "Boot from USB if available, otherwise boot from SD Card" \ - "B3 Network Boot" "Boot from network if SD card boot fails" \ - 3>&1 1>&2 2>&3) - else - BOOTOPT=$1 - true - fi - if [ $? -eq 0 ]; then - CURDATE=$(date -d "`vcgencmd bootloader_version | head -n 1`" +%Y%m%d) - FILNAME="none" - if grep -q "stable" /etc/default/rpi-eeprom-update ; then - EEPATH="/lib/firmware/raspberrypi/bootloader/stable/pieeprom*.bin" - else - EEPATH="/lib/firmware/raspberrypi/bootloader/critical/pieeprom*.bin" - fi - for filename in $EEPATH ; do - FILDATE=$(date -d "`echo $filename | cut -d - -f 2- | cut -d . -f 1`" +%Y%m%d) - if [ $FILDATE -eq $CURDATE ]; then - FILNAME=$filename - fi - done - if [ "$FILNAME" = "none" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "No EEPROM bin file found for version `date -d $CURDATE +%Y-%m-%d` - aborting" 20 60 2 - fi - return 1 - fi - EECFG=$(mktemp) - vcgencmd bootloader_config > $EECFG - sed $EECFG -i -e "/SD_BOOT_MAX_RETRIES/d" - sed $EECFG -i -e "/NET_BOOT_MAX_RETRIES/d" - case "$BOOTOPT" in - B1*) - if ! grep -q "BOOT_ORDER" $EECFG ; then - sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf41" - else - sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf41/" - fi - STATUS="SD Card" - ;; - B2*) - if ! grep -q "BOOT_ORDER" $EECFG ; then - sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf14" - else - sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf14/" - fi - STATUS="USB" - ;; - B3*) - if ! grep -q "BOOT_ORDER" $EECFG ; then - sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf21" - else - sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf21/" - fi - STATUS="Network" - ;; - *) - whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 - return 1 - ;; - esac - EEBIN=$(mktemp) - rpi-eeprom-config --config $EECFG --out $EEBIN $FILNAME - rpi-eeprom-update -d -f $EEBIN - ASK_TO_REBOOT=1 - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "$STATUS is default boot device" 20 60 1 - fi - fi -} - - -do_boot_rom() { - if [ "$INTERACTIVE" = True ]; then - BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot ROM Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ - "E1 Latest" "Use the latest version boot ROM software" \ - "E2 Default" "Use the factory default boot ROM software" \ - 3>&1 1>&2 2>&3) - else - BOOTOPT=$1 - true - fi - if [ $? -eq 0 ]; then - case "$BOOTOPT" in - E1*) - sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"stable\"/" - EETYPE="Latest version" - ;; - E2*) - sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"critical\"/" - EETYPE="Factory default" - ;; - *) - whiptail --msgbox "Programmer error, unrecognised boot ROM option" 20 60 2 - return 1 - ;; - esac - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "$EETYPE boot ROM selected - will be loaded at next reboot.\n\nReset boot ROM to defaults?" 20 60 2 - DEFAULTS=$? - else - DEFAULTS=$2 - fi - if [ "$DEFAULTS" -eq 0 ]; then # yes - if grep -q "stable" /etc/default/rpi-eeprom-update ; then - EEPATH="/lib/firmware/raspberrypi/bootloader/stable/" - else - EEPATH="/lib/firmware/raspberrypi/bootloader/critical/" - fi - MATCH=".*/pieeprom-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].bin" - FILNAME="$(find "${EEPATH}" -maxdepth 1 -type f -size 524288c -regex "${MATCH}" | sort -r | head -n1)" - if [ -z "$FILNAME" ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "No EEPROM bin file found - cannot reset to defaults" 20 60 2 - fi - else - rpi-eeprom-update -d -f $FILNAME - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Boot ROM reset to defaults" 20 60 2 - fi - fi - else - rpi-eeprom-update - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Boot ROM not reset to defaults" 20 60 2 - fi - fi - ASK_TO_REBOOT=1 - fi -} - -get_boot_wait() { - if test -e /etc/systemd/system/dhcpcd.service.d/wait.conf; then - echo 0 - else - echo 1 - fi -} - -do_boot_wait() { - DEFAULT=--defaultno - if [ $(get_boot_wait) -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like boot to wait until a network connection is established?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - mkdir -p /etc/systemd/system/dhcpcd.service.d/ - cat > /etc/systemd/system/dhcpcd.service.d/wait.conf << EOF -[Service] -ExecStart= -ExecStart=/usr/sbin/dhcpcd -w -q -EOF - STATUS=enabled - elif [ $RET -eq 1 ]; then - rm -f /etc/systemd/system/dhcpcd.service.d/wait.conf - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Waiting for network on boot is $STATUS" 20 60 1 - fi -} - -get_boot_splash() { - if is_pi ; then - if grep -q "splash" $CMDLINE ; then - echo 0 - else - echo 1 - fi - else - if grep -q "GRUB_CMDLINE_LINUX_DEFAULT.*splash" /etc/default/grub ; then - echo 0 - else - echo 1 - fi - fi -} - -do_boot_splash() { - if [ ! -e /usr/share/plymouth/themes/pix/pix.script ]; then - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The splash screen is not installed so cannot be activated" 20 60 2 - fi - return 1 - fi - DEFAULT=--defaultno - if [ $(get_boot_splash) -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like to show the splash screen at boot?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - if is_pi ; then - if ! grep -q "splash" $CMDLINE ; then - sed -i $CMDLINE -e "s/$/ quiet splash plymouth.ignore-serial-consoles/" - fi - else - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1 quiet splash plymouth.ignore-serial-consoles\"/" - sed -i /etc/default/grub -e "s/ \+/ /g" - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\" /GRUB_CMDLINE_LINUX_DEFAULT=\"/" - update-grub - fi - STATUS=enabled - elif [ $RET -eq 1 ]; then - if is_pi ; then - if grep -q "splash" $CMDLINE ; then - sed -i $CMDLINE -e "s/ quiet//" - sed -i $CMDLINE -e "s/ splash//" - sed -i $CMDLINE -e "s/ plymouth.ignore-serial-consoles//" - fi - else - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)quiet\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)splash\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)plymouth.ignore-serial-consoles\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" - sed -i /etc/default/grub -e "s/ \+/ /g" - sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\" /GRUB_CMDLINE_LINUX_DEFAULT=\"/" - update-grub - fi - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Splash screen at boot is $STATUS" 20 60 1 - fi -} - -get_rgpio() { - if test -e /etc/systemd/system/pigpiod.service.d/public.conf; then - echo 0 - else - echo 1 - fi -} - -do_rgpio() { - DEFAULT=--defaultno - if [ $(get_rgpio) -eq 0 ]; then - DEFAULT= - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the GPIO server to be accessible over the network?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq 0 ]; then - mkdir -p /etc/systemd/system/pigpiod.service.d/ - cat > /etc/systemd/system/pigpiod.service.d/public.conf << EOF -[Service] -ExecStart= -ExecStart=/usr/bin/pigpiod -EOF - STATUS=enabled - elif [ $RET -eq 1 ]; then - rm -f /etc/systemd/system/pigpiod.service.d/public.conf - STATUS=disabled - else - return $RET - fi - systemctl daemon-reload - if systemctl -q is-enabled pigpiod ; then - systemctl restart pigpiod - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Remote access to the GPIO server is $STATUS" 20 60 1 - fi -} - -get_camera() { - if [ $(deb_ver) -le 10 ]; then - CAM=$(get_config_var start_x $CONFIG) - if [ $CAM -eq 1 ]; then - echo 0 - else - echo 1 - fi - else - if grep -q camera_auto_detect $CONFIG ; then - CAM=$(get_config_var camera_auto_detect $CONFIG) - if [ $CAM -eq 1 ]; then - echo 0 - else - echo 1 - fi - else - echo 0 - fi - fi -} - -do_camera() { - if [ $(deb_ver) -le 10 ] && [ ! -e /boot/start_x.elf ]; then - whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2 - return 1 - fi - sed $CONFIG -i -e "s/^startx/#startx/" - sed $CONFIG -i -e "s/^fixup_file/#fixup_file/" - - DEFAULT=--defaultno - CURRENT=0 - if [ $(get_camera) -eq 0 ]; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the camera interface to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - if [ $(deb_ver) -le 10 ] ; then - set_config_var start_x 1 $CONFIG - CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG) - if [ -z "$CUR_GPU_MEM" ] || [ "$CUR_GPU_MEM" -lt 128 ]; then - set_config_var gpu_mem 128 $CONFIG - fi - else - set_config_var camera_auto_detect 1 $CONFIG - fi - STATUS=enabled - elif [ $RET -eq 1 ]; then - if [ $(deb_ver) -le 10 ] ; then - set_config_var start_x 0 $CONFIG - sed $CONFIG -i -e "s/^start_file/#start_file/" - else - set_config_var camera_auto_detect 0 $CONFIG - fi - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The camera interface is $STATUS" 20 60 1 - fi -} - -get_onewire() { - if grep -q -E "^dtoverlay=w1-gpio" $CONFIG; then - echo 0 - else - echo 1 - fi -} - -do_onewire() { - DEFAULT=--defaultno - CURRENT=0 - if [ $(get_onewire) -eq 0 ]; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the one-wire interface to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - sed $CONFIG -i -e "s/^#dtoverlay=w1-gpio/dtoverlay=w1-gpio/" - if ! grep -q -E "^dtoverlay=w1-gpio" $CONFIG; then - printf "dtoverlay=w1-gpio\n" >> $CONFIG - fi - STATUS=enabled - elif [ $RET -eq 1 ]; then - sed $CONFIG -i -e "s/^dtoverlay=w1-gpio/#dtoverlay=w1-gpio/" - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The one-wire interface is $STATUS" 20 60 1 - fi -} - -get_legacy() { - if sed -n '/\[pi4\]/,/\[/ !p' $CONFIG | grep -q '^dtoverlay=vc4-kms-v3d' ; then - echo 1 - else - echo 0 - fi -} - -do_legacy() { - DEFAULT=--defaultno - CURRENT=0 - if [ $(get_legacy) -eq 0 ]; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like to enable legacy camera support?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - sed $CONFIG -i -e '/\[pi4\]/,/\[/ s/^#\?dtoverlay=vc4-f\?kms-v3d/dtoverlay=vc4-fkms-v3d/g' - sed $CONFIG -i -e '/\[pi4\]/,/\[/ !s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/g' - sed $CONFIG -i -e '/\[pi4\]/,/\[/ !s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g' - if ! sed -n '/\[pi4\]/,/\[/ p' $CONFIG | grep -q '^dtoverlay=vc4-fkms-v3d' ; then - if grep -q '[pi4]' $CONFIG ; then - sed $CONFIG -i -e 's/\[pi4\]/\[pi4\]\ndtoverlay=vc4-fkms-v3d/' - else - printf "[pi4]\ndtoverlay=vc4-fkms-v3d\n" >> $CONFIG - fi - fi - CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG) - if [ -z "$CUR_GPU_MEM" ] || [ "$CUR_GPU_MEM" -lt 128 ]; then - set_config_var gpu_mem 128 $CONFIG - fi - sed $CONFIG -i -e 's/^camera_auto_detect.*/start_x=1/g' - sed $CONFIG -i -e 's/^dtoverlay=camera/#dtoverlay=camera/g' - STATUS="Legacy camera support is enabled.\n\nPlease note that this functionality is deprecated and will not be supported for future development." - else - sed $CONFIG -i -e 's/^#\?dtoverlay=vc4-f\?kms-v3d/dtoverlay=vc4-kms-v3d/g' - sed $CONFIG -i -e '/\[pi4\]/,/\[/ {/dtoverlay=vc4-kms-v3d/d}' - if ! sed -n '/\[pi4\]/,/\[/ !p' $CONFIG | grep -q '^dtoverlay=vc4-kms-v3d' ; then - if grep -q '[all]' $CONFIG ; then - sed $CONFIG -i -e 's/\[all\]/\[all\]\ndtoverlay=vc4-kms-v3d/' - else - printf "[all]\ndtoverlay=vc4-kms-v3d\n" >> $CONFIG - fi - fi - sed $CONFIG -i -e 's/^start_x.*/camera_auto_detect=1/g' - sed $CONFIG -i -e 's/^#dtoverlay=camera/dtoverlay=camera/g' - STATUS="Legacy camera support is disabled." - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "$STATUS" 20 60 1 - fi -} - -do_gldriver() { - if [ ! -e /boot/overlays/vc4-kms-v3d.dtbo ]; then - whiptail --msgbox "Driver and kernel not present on your system. Please update" 20 60 2 - return 1 - fi - for package in gldriver-test libgl1-mesa-dri; do - if [ "$(dpkg -l "$package" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then - missing_packages="$package $missing_packages" - fi - done - if [ -n "$missing_packages" ] && ! apt-get install $missing_packages; then - whiptail --msgbox "Required packages not found, please install: ${missing_packages}" 20 60 2 - return 1 - fi - GLOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "GL Driver" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ - "G1 Legacy" "Original non-GL desktop driver" \ - "G2 GL (Full KMS)" "OpenGL desktop driver with full KMS" \ - 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then - case "$GLOPT" in - G1*) - if sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q -E "^dtoverlay=vc4-f?kms-v3d" ; then - ASK_TO_REBOOT=1 - fi - sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g" - sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/g" - STATUS="The GL driver is disabled." - ;; - G2*) - if ! sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q "^dtoverlay=vc4-kms-v3d" ; then - ASK_TO_REBOOT=1 - fi - sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g" - sed $CONFIG -i -e "s/^#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/g" - if ! sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q "^dtoverlay=vc4-kms-v3d" ; then - printf "[all]\ndtoverlay=vc4-kms-v3d\n" >> $CONFIG - fi - STATUS="The full KMS GL driver is enabled." - ;; - *) - whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 - return 1 - ;; - esac - else - return 0 - fi - whiptail --msgbox "$STATUS" 20 60 1 -} - -do_xcompmgr() { - DEFAULT=--defaultno - CURRENT=0 - if [ -e /etc/xdg/autostart/xcompmgr.desktop ]; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the xcompmgr composition manager to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - if [ ! -e /usr/bin/xcompmgr ] ; then - apt-get -y install xcompmgr - fi - cat << EOF > /etc/xdg/autostart/xcompmgr.desktop -[Desktop Entry] -Type=Application -Name=xcompmgr -Comment=Start xcompmgr compositor -NoDisplay=true -Exec=/usr/lib/raspi-config/cmstart.sh -EOF - STATUS=enabled - elif [ $RET -eq 1 ]; then - rm -f /etc/xdg/autostart/xcompmgr.desktop - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The xcompmgr composition manager is $STATUS" 20 60 1 - fi -} - -do_glamor() { - DEFAULT= - CURRENT=1 - if [ -e /usr/share/X11/xorg.conf.d/20-noglamor.conf ] ; then - DEFAULT=--defaultno - CURRENT=0 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like glamor acceleration to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - systemctl disable glamor-test.service - systemctl stop glamor-test.service - rm -f /usr/share/X11/xorg.conf.d/20-noglamor.conf - STATUS=enabled - elif [ $RET -eq 1 ]; then - systemctl enable glamor-test.service && - systemctl start glamor-test.service && - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Glamor acceleration is $STATUS" 20 60 1 - fi -} - -do_wayland() { - DEFAULT=--defaultno - CURRENT=0 - if grep -q "^user-session=LXDE-pi-wayland" /etc/lightdm/lightdm.conf ; then - DEFAULT= - CURRENT=1 - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the Wayland backend to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - ASK_TO_REBOOT=1 - fi - if [ $RET -eq 0 ]; then - sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=LXDE-pi-wayland/" - sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=LXDE-pi-wayland/" - if [ -e "/var/lib/AccountsService/users/$USER" ] ; then - sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=LXDE-pi-wayland/" - fi - STATUS=enabled - elif [ $RET -eq 1 ]; then - sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=LXDE-pi-x/" - sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=LXDE-pi-x/" - if [ -e "/var/lib/AccountsService/users/$USER" ] ; then - sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=LXDE-pi-x/" - fi - STATUS=disabled - else - return $RET - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Wayland is $STATUS" 20 60 1 - fi -} - get_net_names() { if grep -q "net.ifnames=0" $CMDLINE || \ ( [ "$(readlink -f /etc/systemd/network/99-default.link)" = "/dev/null" ] && \ @@ -2113,213 +363,6 @@ do_net_names () { fi } -do_update() { - apt-get update && - apt-get install raspi-config && - printf "Sleeping 5 seconds before reloading raspi-config\n" && - sleep 5 && - exec raspi-config -} - -do_audio() { - if is_pulseaudio ; then - oIFS="$IFS" - if [ "$INTERACTIVE" = True ]; then - list=$(sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pacmd list-sinks | grep -e index -e alsa.name | sed s/*//g | sed s/^[' '\\t]*//g | sed s/'index: '//g | sed s/'alsa.name = '//g | sed s/'bcm2835 '//g | sed s/\"//g | tr '\n' '/') - if ! [ -z "$list" ] ; then - IFS="/" - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${list} 3>&1 1>&2 2>&3) - else - whiptail --msgbox "No internal audio devices found" 20 60 1 - return 1 - fi - else - AUDIO_OUT=$1 - true - fi - if [ $? -eq 0 ]; then - sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-sink $AUDIO_OUT - fi - IFS=$oIFS - else - if aplay -l | grep -q "bcm2835 ALSA"; then - if [ "$INTERACTIVE" = True ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "Auto" \ - "1" "Force 3.5mm ('headphone') jack" \ - "2" "Force HDMI" \ - 3>&1 1>&2 2>&3) - else - AUDIO_OUT=$1 - fi - if [ $? -eq 0 ]; then - amixer cset numid=3 "$AUDIO_OUT" - fi - else - ASPATH=$(getent passwd $USER | cut -d : -f 6)/.asoundrc - if [ "$INTERACTIVE" = True ]; then - CARD0=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 0" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - CARD1=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 1" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - CARD2=$(LC_ALL=C aplay -l | grep bcm2835 | grep "card 2" | cut -d [ -f 3 | cut -d ] -f 1 | cut -d ' ' -f 2-) - if ! [ -z "$CARD2" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - "1" "$CARD1" \ - "2" "$CARD2" \ - 3>&1 1>&2 2>&3) - elif ! [ -z "$CARD1" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - "1" "$CARD1" \ - 3>&1 1>&2 2>&3) - elif ! [ -z "$CARD0" ]; then - AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ - "0" "$CARD0" \ - 3>&1 1>&2 2>&3) - else - whiptail --msgbox "No internal audio devices found" 20 60 1 - false - fi - else - AUDIO_OUT=$1 - fi - if [ $? -eq 0 ]; then - cat << EOF > $ASPATH -pcm.!default { - type asym - playback.pcm { - type plug - slave.pcm "output" - } - capture.pcm { - type plug - slave.pcm "input" - } -} - -pcm.output { - type hw - card $AUDIO_OUT -} - -ctl.!default { - type hw - card $AUDIO_OUT -} -EOF - fi - fi - fi -} - -do_resolution() { - if [ "$INTERACTIVE" = True ]; then - CMODE=$(get_config_var hdmi_mode $CONFIG) - CGROUP=$(get_config_var hdmi_group $CONFIG) - if [ $CMODE -eq 0 ] ; then - CSET="Default" - elif [ $CGROUP -eq 2 ] ; then - CSET="DMT Mode "$CMODE - else - CSET="CEA Mode "$CMODE - fi - oIFS="$IFS" - IFS="/" - if tvservice -d /dev/null | grep -q Nothing ; then - value="Default/720x480/DMT Mode 4/640x480 60Hz 4:3/DMT Mode 9/800x600 60Hz 4:3/DMT Mode 16/1024x768 60Hz 4:3/DMT Mode 85/1280x720 60Hz 16:9/DMT Mode 35/1280x1024 60Hz 5:4/DMT Mode 51/1600x1200 60Hz 4:3/DMT Mode 82/1920x1080 60Hz 16:9/" - else - value="Default/Monitor preferred resolution/" - value=$value$(tvservice -m CEA | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/CEA Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') - value=$value$(tvservice -m DMT | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/DMT Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') - fi - RES=$(whiptail --default-item $CSET --menu "Choose screen resolution" 20 60 10 ${value} 3>&1 1>&2 2>&3) - STATUS=$? - IFS=$oIFS - if [ $STATUS -eq 0 ] ; then - GRS=$(echo "$RES" | cut -d ' ' -f 1) - MODE=$(echo "$RES" | cut -d ' ' -f 3) - if [ $GRS = "Default" ] ; then - MODE=0 - elif [ $GRS = "DMT" ] ; then - GROUP=2 - else - GROUP=1 - fi - fi - else - GROUP=$1 - MODE=$2 - STATUS=0 - fi - if [ $STATUS -eq 0 ]; then - if [ $MODE -eq 0 ]; then - clear_config_var hdmi_force_hotplug $CONFIG - clear_config_var hdmi_group $CONFIG - clear_config_var hdmi_mode $CONFIG - else - set_config_var hdmi_force_hotplug 1 $CONFIG - set_config_var hdmi_group $GROUP $CONFIG - set_config_var hdmi_mode $MODE $CONFIG - fi - if [ "$INTERACTIVE" = True ]; then - if [ $MODE -eq 0 ] ; then - whiptail --msgbox "The resolution is set to default" 20 60 1 - else - whiptail --msgbox "The resolution is set to $GRS mode $MODE" 20 60 1 - fi - fi - if [ $MODE -eq 0 ] ; then - TSET="Default" - elif [ $GROUP -eq 2 ] ; then - TSET="DMT Mode "$MODE - else - TSET="CEA Mode "$MODE - fi - if [ "$TSET" != "$CSET" ] ; then - ASK_TO_REBOOT=1 - fi - fi -} - -get_vnc_resolution() { - if [ -e /etc/xdg/autostart/vnc_xrandr.desktop ] ; then - echo $(grep fb /etc/xdg/autostart/vnc_xrandr.desktop | cut -f 15 -d ' ') - else - echo "" - fi -} - -do_vnc_resolution() { - if [ "$INTERACTIVE" = True ]; then - CUR=$(get_vnc_resolution) - if [ "$CUR" = "" ] ; then - CUR=640x480 - fi - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --default-item $CUR --menu "Set VNC Resolution" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "640x480" "" "720x480" "" "800x600" "" "1024x768" "" "1280x720" "" "1280x1024" "" "1600x1200" "" "1920x1080" "" 3>&1 1>&2 2>&3) - RET=$? - else - FUN=$1 - RET=0 - fi - if [ $RET -eq 1 ]; then - return 0 - elif [ $RET -eq 0 ]; then - cat > /etc/xdg/autostart/vnc_xrandr.desktop << EOF -[Desktop Entry] -Type=Application -Name=vnc_xrandr -Comment=Set resolution for VNC -NoDisplay=true -Exec=sh -c "if ! (xrandr | grep -q -w connected) ; then /usr/bin/xrandr --fb $FUN ; fi" -EOF - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The resolution is set to $FUN" 20 60 1 - ASK_TO_REBOOT=1 - fi - fi -} - list_wlan_interfaces() { for dir in /sys/class/net/*/wireless; do if [ -d "$dir" ]; then @@ -2436,88 +479,6 @@ do_finish() { exit 0 } -# $1 = filename, $2 = key name -get_json_string_val() { - sed -n -e "s/^[[:space:]]*\"$2\"[[:space:]]*:[[:space:]]*\"\(.*\)\"[[:space:]]*,$/\1/p" $1 -} - -# TODO: This is probably broken -do_apply_os_config() { - [ -e /boot/os_config.json ] || return 0 - NOOBSFLAVOUR=$(get_json_string_val /boot/os_config.json flavour) - NOOBSLANGUAGE=$(get_json_string_val /boot/os_config.json language) - NOOBSKEYBOARD=$(get_json_string_val /boot/os_config.json keyboard) - - if [ -n "$NOOBSFLAVOUR" ]; then - printf "Setting flavour to %s based on os_config.json from NOOBS. May take a while\n" "$NOOBSFLAVOUR" - - printf "Unrecognised flavour. Ignoring\n" - fi - - # TODO: currently ignores en_gb settings as we assume we are running in a - # first boot context, where UK English settings are default - case "$NOOBSLANGUAGE" in - "en") - if [ "$NOOBSKEYBOARD" = "gb" ]; then - DEBLANGUAGE="" # UK english is the default, so ignore - else - DEBLANGUAGE="en_US.UTF-8" - fi - ;; - "de") - DEBLANGUAGE="de_DE.UTF-8" - ;; - "fi") - DEBLANGUAGE="fi_FI.UTF-8" - ;; - "fr") - DEBLANGUAGE="fr_FR.UTF-8" - ;; - "hu") - DEBLANGUAGE="hu_HU.UTF-8" - ;; - "ja") - DEBLANGUAGE="ja_JP.UTF-8" - ;; - "nl") - DEBLANGUAGE="nl_NL.UTF-8" - ;; - "pt") - DEBLANGUAGE="pt_PT.UTF-8" - ;; - "ru") - DEBLANGUAGE="ru_RU.UTF-8" - ;; - "zh_CN") - DEBLANGUAGE="zh_CN.UTF-8" - ;; - *) - printf "Language '%s' not handled currently. Run sudo raspi-config to set up" "$NOOBSLANGUAGE" - ;; - esac - - if [ -n "$DEBLANGUAGE" ]; then - printf "Setting language to %s based on os_config.json from NOOBS. May take a while\n" "$DEBLANGUAGE" - do_change_locale "$DEBLANGUAGE" - fi - - if [ -n "$NOOBSKEYBOARD" -a "$NOOBSKEYBOARD" != "gb" ]; then - printf "Setting keyboard layout to %s based on os_config.json from NOOBS. May take a while\n" "$NOOBSKEYBOARD" - do_configure_keyboard "$NOOBSKEYBOARD" - fi - return 0 -} - -get_overlay_now() { - grep -q "boot=overlay" /proc/cmdline - echo $? -} - -get_overlay_conf() { - grep -q "boot=overlay" /boot/cmdline.txt - echo $? -} - get_bootro_now() { findmnt /boot | grep -q " ro," echo $? @@ -2532,302 +493,6 @@ is_uname_current() { test -d "/lib/modules/$(uname -r)" } -enable_overlayfs() { - KERN=$(uname -r) - INITRD=initrd.img-"$KERN"-overlay - - # mount the boot partition as writable if it isn't already - if [ $(get_bootro_now) -eq 0 ] ; then - if ! mount -o remount,rw /boot 2>/dev/null ; then - echo "Unable to mount boot partition as writable - cannot enable" - return 1 - fi - BOOTRO=yes - else - BOOTRO=no - fi - - cat > /etc/initramfs-tools/scripts/overlay << 'EOF' -# Local filesystem mounting -*- shell-script -*- - -# -# This script overrides local_mount_root() in /scripts/local -# and mounts root as a read-only filesystem with a temporary (rw) -# overlay filesystem. -# - -. /scripts/local - -local_mount_root() -{ - local_top - local_device_setup "${ROOT}" "root file system" - ROOT="${DEV}" - - # Get the root filesystem type if not set - if [ -z "${ROOTFSTYPE}" ]; then - FSTYPE=$(get_fstype "${ROOT}") - else - FSTYPE=${ROOTFSTYPE} - fi - - local_premount - - # CHANGES TO THE ORIGINAL FUNCTION BEGIN HERE - # N.B. this code still lacks error checking - - modprobe ${FSTYPE} - checkfs ${ROOT} root "${FSTYPE}" - - # Create directories for root and the overlay - mkdir /lower /upper - - # Mount read-only root to /lower - if [ "${FSTYPE}" != "unknown" ]; then - mount -r -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} /lower - else - mount -r ${ROOTFLAGS} ${ROOT} /lower - fi - - modprobe overlay || insmod "/lower/lib/modules/$(uname -r)/kernel/fs/overlayfs/overlay.ko" - - # Mount a tmpfs for the overlay in /upper - mount -t tmpfs tmpfs /upper - mkdir /upper/data /upper/work - - # Mount the final overlay-root in $rootmnt - mount -t overlay \ - -olowerdir=/lower,upperdir=/upper/data,workdir=/upper/work \ - overlay ${rootmnt} -} -EOF - - # add the overlay to the list of modules - if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then - echo overlay >> /etc/initramfs-tools/modules - fi - - # build the new initramfs - update-initramfs -c -k "$KERN" - - # rename it so we know it has overlay added - mv /boot/initrd.img-"$KERN" /boot/"$INITRD" - - # there is now a modified initramfs ready for use... - - # modify config.txt - sed -i /boot/config.txt -e "/initramfs.*/d" - echo initramfs "$INITRD" >> /boot/config.txt - - # modify command line - if ! grep -q "boot=overlay" /boot/cmdline.txt ; then - sed -i /boot/cmdline.txt -e "s/^/boot=overlay /" - fi - - if [ "$BOOTRO" = "yes" ] ; then - if ! mount -o remount,ro /boot 2>/dev/null ; then - echo "Unable to remount boot partition as read-only" - fi - fi -} - -disable_overlayfs() { - KERN=$(uname -r) - # mount the boot partition as writable if it isn't already - if [ $(get_bootro_now) -eq 0 ] ; then - if ! mount -o remount,rw /boot 2>/dev/null ; then - echo "Unable to mount boot partition as writable - cannot disable" - return 1 - fi - BOOTRO=yes - else - BOOTRO=no - fi - - # modify config.txt - sed -i /boot/config.txt -e "/initramfs.*/d" - update-initramfs -d -k "${KERN}-overlay" - - # modify command line - sed -i /boot/cmdline.txt -e "s/\(.*\)boot=overlay \(.*\)/\1\2/" - - if [ "$BOOTRO" = "yes" ] ; then - if ! mount -o remount,ro /boot 2>/dev/null ; then - echo "Unable to remount boot partition as read-only" - fi - fi -} - -enable_bootro() { - if [ $(get_overlay_now) -eq 0 ] ; then - echo "Overlay in use; cannot update fstab" - return 1 - fi - sed -i /etc/fstab -e "s/\(.*\/boot.*\)defaults\(.*\)/\1defaults,ro\2/" -} - -disable_bootro() { - if [ $(get_overlay_now) -eq 0 ] ; then - echo "Overlay in use; cannot update fstab" - return 1 - fi - sed -i /etc/fstab -e "s/\(.*\/boot.*\)defaults,ro\(.*\)/\1defaults\2/" -} - -do_overlayfs() { - DEFAULT=--defaultno - CURRENT=0 - STATUS="disabled" - - if [ "$INTERACTIVE" = True ] && ! is_uname_current; then - whiptail --msgbox "Could not find modules for the running kernel ($(uname -r))." 20 60 1 - return 1 - fi - - if [ $(get_overlay_conf) -eq 0 ] ; then - DEFAULT= - CURRENT=1 - STATUS="enabled" - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the overlay file system to be enabled?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - if [ $RET -eq 0 ]; then - if enable_overlayfs; then - STATUS="enabled" - ASK_TO_REBOOT=1 - else - STATUS="unchanged" - fi - elif [ $RET -eq 1 ]; then - if disable_overlayfs; then - STATUS="disabled" - ASK_TO_REBOOT=1 - else - STATUS="unchanged" - fi - else - return $RET - fi - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The overlay file system is $STATUS." 20 60 1 - fi - if [ $(get_overlay_now) -eq 0 ] ; then - if [ $(get_bootro_conf) -eq 0 ] ; then - BPRO="read-only" - else - BPRO="writable" - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The boot partition is currently $BPRO. This cannot be changed while an overlay file system is enabled." 20 60 1 - fi - else - DEFAULT=--defaultno - CURRENT=0 - STATUS="writable" - if [ $(get_bootro_conf) -eq 0 ]; then - DEFAULT= - CURRENT=1 - STATUS="read-only" - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --yesno "Would you like the boot partition to be write-protected?" $DEFAULT 20 60 2 - RET=$? - else - RET=$1 - fi - if [ $RET -eq $CURRENT ]; then - if [ $RET -eq 0 ]; then - if enable_bootro; then - STATUS="read-only" - ASK_TO_REBOOT=1 - else - STATUS="unchanged" - fi - elif [ $RET -eq 1 ]; then - if disable_bootro; then - STATUS="writable" - ASK_TO_REBOOT=1 - else - STATUS="unchanged" - fi - else - return $RET - fi - fi - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "The boot partition is $STATUS." 20 60 1 - fi - fi -} - -get_proxy() { - SCHEME="$1" - VAR_NAME="${SCHEME}_proxy" - if [ -f /etc/profile.d/proxy.sh ]; then - # shellcheck disable=SC1091 - . /etc/profile.d/proxy.sh - fi - eval "echo \$$VAR_NAME" -} - -do_proxy() { - SCHEMES="$1" - ADDRESS="$2" - if [ "$SCHEMES" = "all" ]; then - CURRENT="$(get_proxy http)" - SCHEMES="http https ftp rsync" - else - CURRENT="$(get_proxy "$SCHEMES")" - fi - if [ "$INTERACTIVE" = True ]; then - if [ "$SCHEMES" = "no" ]; then - STRING="Please enter a comma separated list of addresses that should be excluded from using proxy servers.\\nEg: localhost,127.0.0.1,localaddress,.localdomain.com" - else - STRING="Please enter proxy address.\\nEg: http://user:pass@proxy:8080" - fi - if ! ADDRESS="$(whiptail --inputbox "$STRING" 20 60 "$CURRENT" 3>&1 1>&2 2>&3)"; then - return 0 - fi - fi - for SCHEME in $SCHEMES; do - unset "${SCHEME}_proxy" - CURRENT="$(get_proxy "$SCHEME")" - if [ "$CURRENT" != "$ADDRESS" ]; then - ASK_TO_REBOOT=1 - fi - if [ -f /etc/profile.d/proxy.sh ]; then - sed -i "/^export ${SCHEME}_/Id" /etc/profile.d/proxy.sh - fi - if [ "${SCHEME#*http}" != "$SCHEME" ]; then - if [ -f /etc/apt/apt.conf.d/01proxy ]; then - sed -i "/::${SCHEME}::Proxy/d" /etc/apt/apt.conf.d/01proxy - fi - fi - if [ -z "$ADDRESS" ]; then - STATUS=cleared - continue - fi - STATUS=updated - SCHEME_UPPER="$(echo "$SCHEME" | tr '[:lower:]' '[:upper:]')" - echo "export ${SCHEME_UPPER}_PROXY=\"$ADDRESS\"" >> /etc/profile.d/proxy.sh - if [ "$SCHEME" != "rsync" ]; then - echo "export ${SCHEME}_proxy=\"$ADDRESS\"" >> /etc/profile.d/proxy.sh - fi - if [ "${SCHEME#*http}" != "$SCHEME" ]; then - echo "Acquire::$SCHEME::Proxy \"$ADDRESS\";" >> /etc/apt/apt.conf.d/01proxy - fi - done - if [ "$INTERACTIVE" = True ]; then - whiptail --msgbox "Proxy settings $STATUS" 20 60 1 - fi -} - nonint() { "$@" } @@ -2838,16 +503,6 @@ nonint() { for i in $* do case $i in - --memory-split) - OPT_MEMORY_SPLIT=GET - printf "Not currently supported\n" - exit 1 - ;; - --memory-split=*) - OPT_MEMORY_SPLIT=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` - printf "Not currently supported\n" - exit 1 - ;; --expand-rootfs) INTERACTIVE=False do_expand_rootfs @@ -2870,175 +525,41 @@ do esac done -#if [ "GET" = "${OPT_MEMORY_SPLIT:-}" ]; then -# set -u # Fail on unset variables -# get_current_memory_split -# echo $CURRENT_MEMSPLIT -# exit 0 -#fi - # Everything else needs to be run as root if [ $(id -u) -ne 0 ]; then printf "Script must be run as root. Try 'sudo raspi-config'\n" exit 1 fi -if [ -n "${OPT_MEMORY_SPLIT:-}" ]; then - set -e # Fail when a command errors - set_memory_split "${OPT_MEMORY_SPLIT}" - exit 0 -fi - do_system_menu() { - if is_pi ; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "S1 Wireless LAN" "Enter SSID and passphrase" \ - "S2 Audio" "Select audio out through HDMI or 3.5mm jack" \ - "S3 Password" "Change password for the '$USER' user" \ - "S4 Hostname" "Set name for this computer on a network" \ - "S5 Boot / Auto Login" "Select boot into desktop or to command line" \ - "S6 Network at Boot" "Select wait for network connection on boot" \ - "S7 Splash Screen" "Choose graphical splash screen or text boot" \ - "S8 Power LED" "Set behaviour of power LED" \ - 3>&1 1>&2 2>&3) - elif is_live ; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "S1 Wireless LAN" "Enter SSID and passphrase" \ - "S3 Password" "Change password for the '$USER' user" \ - "S4 Hostname" "Set name for this computer on a network" \ - "S5 Boot / Auto Login" "Select boot into desktop or to command line" \ - "S6 Network at Boot" "Select wait for network connection on boot" \ - 3>&1 1>&2 2>&3) - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "S1 Wireless LAN" "Enter SSID and passphrase" \ - "S3 Password" "Change password for the '$USER' user" \ - "S4 Hostname" "Set name for this computer on a network" \ - "S5 Boot / Auto Login" "Select boot into desktop or to command line" \ - "S6 Network at Boot" "Select wait for network connection on boot" \ - "S7 Splash Screen" "Choose graphical splash screen or text boot" \ - 3>&1 1>&2 2>&3) - fi + FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "S1 Wireless LAN" "Enter SSID and passphrase" \ + "S3 Password" "Change password for the '$USER' user" \ + "S4 Hostname" "Set name for this computer on a network" \ + 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then return 0 elif [ $RET -eq 0 ]; then case "$FUN" in S1\ *) do_wifi_ssid_passphrase ;; - S2\ *) do_audio ;; S3\ *) do_change_pass ;; S4\ *) do_hostname ;; - S5\ *) do_boot_behaviour ;; - S6\ *) do_boot_wait ;; - S7\ *) do_boot_splash ;; - S8\ *) do_leds ;; - *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; - esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 - fi -} - -do_display_menu() { - if is_pi ; then - if is_kms; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "D2 Underscan" "Remove black border around screen" \ - "D4 Screen Blanking" "Enable/disable screen blanking" \ - "D5 VNC Resolution" "Set resolution for headless use" \ - "D6 Composite" "Set options for composite output" \ - 3>&1 1>&2 2>&3) - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "D1 Resolution" "Set a specific screen resolution" \ - "D2 Underscan" "Remove black border around screen" \ - "D3 Pixel Doubling" "Enable/disable 2x2 pixel mapping" \ - "D4 Screen Blanking" "Enable/disable screen blanking" \ - "D5 VNC Resolution" "Set resolution for headless use" \ - "D6 Composite" "Set options for composite output" \ - 3>&1 1>&2 2>&3) - fi - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "D2 Underscan" "Remove black border around screen" \ - "D4 Screen Blanking" "Enable/disable screen blanking" \ - 3>&1 1>&2 2>&3) - fi - RET=$? - if [ $RET -eq 1 ]; then - return 0 - elif [ $RET -eq 0 ]; then - case "$FUN" in - D1\ *) do_resolution ;; - D2\ *) if is_pi && ! is_kms; then - do_overscan - else - do_overscan_kms - fi - ;; - D3\ *) do_pixdub ;; - D4\ *) do_blanking ;; - D5\ *) do_vnc_resolution ;; - D6\ *) if is_pifour ; then - do_pi4video - else - do_composite - fi - ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi } do_interface_menu() { - if is_pi ; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "I1 Legacy Camera" "Enable/disable legacy camera support" \ - "I2 SSH" "Enable/disable remote command line access using SSH" \ - "I3 VNC" "Enable/disable graphical remote access using RealVNC" \ - "I4 SPI" "Enable/disable automatic loading of SPI kernel module" \ - "I5 I2C" "Enable/disable automatic loading of I2C kernel module" \ - "I6 Serial Port" "Enable/disable shell messages on the serial connection" \ - "I7 1-Wire" "Enable/disable one-wire interface" \ - "I8 Remote GPIO" "Enable/disable remote access to GPIO pins" \ - 3>&1 1>&2 2>&3) - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "I2 SSH" "Enable/disable remote command line access using SSH" \ - 3>&1 1>&2 2>&3) - fi - RET=$? - if [ $RET -eq 1 ]; then - return 0 - elif [ $RET -eq 0 ]; then - case "$FUN" in - I1\ *) do_legacy ;; - I2\ *) do_ssh ;; - I3\ *) do_vnc ;; - I4\ *) do_spi ;; - I5\ *) do_i2c ;; - I6\ *) do_serial ;; - I7\ *) do_onewire ;; - I8\ *) do_rgpio ;; - *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; - esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 - fi -} - -do_performance_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "P1 Overclock" "Configure CPU overclocking" \ - "P2 GPU Memory" "Change the amount of memory made available to the GPU" \ - "P3 Overlay File System" "Enable/disable read-only file system" \ - "P4 Fan" "Set behaviour of GPIO fan" \ + FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "I2 SSH" "Enable/disable remote command line access using SSH" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then return 0 elif [ $RET -eq 0 ]; then case "$FUN" in - P1\ *) do_overclock ;; - P2\ *) do_memory_split ;; - P3\ *) do_overlayfs ;; - P4\ *) do_fan ;; + I2\ *) do_ssh ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -3048,7 +569,6 @@ do_internationalisation_menu() { FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "L1 Locale" "Configure language and regional settings" \ "L2 Timezone" "Configure time zone" \ - "L3 Keyboard" "Set keyboard layout to match your keyboard" \ "L4 WLAN Country" "Set legal wireless channels for your country" \ 3>&1 1>&2 2>&3) RET=$? @@ -3058,7 +578,6 @@ do_internationalisation_menu() { case "$FUN" in L1\ *) do_change_locale ;; L2\ *) do_change_timezone ;; - L3\ *) do_configure_keyboard ;; L4\ *) do_wifi_country ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 @@ -3066,81 +585,17 @@ do_internationalisation_menu() { } do_advanced_menu() { - if is_pifour ; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ - "A3 Compositor" "Enable/disable xcompmgr composition manager" \ - "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ - "A5 Network Proxy Settings" "Configure network proxy settings" \ - "A6 Boot Order" "Choose network or USB device boot" \ - "A7 Bootloader Version" "Select latest or default boot ROM software" \ - "A9 Wayland" "Enable experimental Wayland backend" \ - 3>&1 1>&2 2>&3) - elif is_pi ; then - if is_kms; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ - "A2 GL Driver" "Enable/disable experimental desktop GL driver" \ - "A3 Compositor" "Enable/disable xcompmgr composition manager" \ - "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ - "A5 Network Proxy Settings" "Configure network proxy settings" \ - "A8 Glamor" "Enable/disable glamor graphics acceleration" \ - "A9 Wayland" "Enable experimental Wayland backend" \ - 3>&1 1>&2 2>&3) - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ - "A2 GL Driver" "Enable/disable experimental desktop GL driver" \ - "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ - "A5 Network Proxy Settings" "Configure network proxy settings" \ - "A8 Glamor" "Enable/disable glamor graphics acceleration" \ - 3>&1 1>&2 2>&3) - fi - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ - "A5 Network Proxy Settings" "Configure network proxy settings" \ - 3>&1 1>&2 2>&3) - fi - RET=$? - if [ $RET -eq 1 ]; then - return 0 - elif [ $RET -eq 0 ]; then - case "$FUN" in - A1\ *) do_expand_rootfs ;; - A2\ *) do_gldriver ;; - A3\ *) do_xcompmgr ;; - A4\ *) do_net_names ;; - A5\ *) do_proxy_menu ;; - A6\ *) do_boot_order ;; - A7\ *) do_boot_rom ;; - A8\ *) do_glamor ;; - A9\ *) do_wayland ;; - *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; - esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 - fi -} - -do_proxy_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Network Proxy Settings" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "P1 All" "Set the same proxy for all schemes" \ - "P2 HTTP" "Set the HTTP proxy" \ - "P3 HTTPS" "Set the HTTPS/SSL proxy" \ - "P4 FTP" "Set the FTP proxy" \ - "P5 RSYNC" "Set the RSYNC proxy" \ - "P6 Exceptions" "Set addresses for which a proxy server should not be used" \ + FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ + "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then return 0 elif [ $RET -eq 0 ]; then case "$FUN" in - P1\ *) do_proxy all ;; - P2\ *) do_proxy http ;; - P3\ *) do_proxy https ;; - P4\ *) do_proxy ftp ;; - P5\ *) do_proxy rsync ;; - P6\ *) do_proxy no;; + A1\ *) do_expand_rootfs ;; + A4\ *) do_net_names ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi @@ -3158,40 +613,20 @@ if [ "$INTERACTIVE" = True ]; then fi done while true; do - if is_pi ; then - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ - "1 System Options" "Configure system settings" \ - "2 Display Options" "Configure display settings" \ - "3 Interface Options" "Configure connections to peripherals" \ - "4 Performance Options" "Configure performance settings" \ - "5 Localisation Options" "Configure language and regional settings" \ - "6 Advanced Options" "Configure advanced settings" \ - "8 Update" "Update this tool to the latest version" \ - "9 About raspi-config" "Information about this configuration tool" \ - 3>&1 1>&2 2>&3) - else - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ - "1 System Options" "Configure system settings" \ - "2 Display Options" "Configure display settings" \ - "3 Interface Options" "Configure connections to peripherals" \ - "5 Localisation Options" "Configure language and regional settings" \ - "6 Advanced Options" "Configure advanced settings" \ - "8 Update" "Update this tool to the latest version" \ - "9 About raspi-config" "Information about this configuration tool" \ - 3>&1 1>&2 2>&3) - fi + FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ + "1 System Options" "Configure system settings" \ + "5 Localisation Options" "Configure language and regional settings" \ + "6 Advanced Options" "Configure advanced settings" \ + "9 About raspi-config" "Information about this configuration tool" \ + 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then do_finish elif [ $RET -eq 0 ]; then case "$FUN" in 1\ *) do_system_menu ;; - 2\ *) do_display_menu ;; - 3\ *) do_interface_menu ;; - 4\ *) do_performance_menu ;; 5\ *) do_internationalisation_menu ;; 6\ *) do_advanced_menu ;; - 8\ *) do_update ;; 9\ *) do_about ;; *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 From 6dacfaef7416540579dde382859915e103188e4c Mon Sep 17 00:00:00 2001 From: Takumi Sueda Date: Sun, 15 May 2022 02:05:03 +0900 Subject: [PATCH 2/5] init_resize: remove RasPi lines --- usr/lib/raspi-config/init_resize.sh | 63 ----------------------------- 1 file changed, 63 deletions(-) diff --git a/usr/lib/raspi-config/init_resize.sh b/usr/lib/raspi-config/init_resize.sh index f3c654b..856824b 100755 --- a/usr/lib/raspi-config/init_resize.sh +++ b/usr/lib/raspi-config/init_resize.sh @@ -4,14 +4,6 @@ reboot_pi () { umount /boot mount / -o remount,ro sync - if [ "$NOOBS" = "1" ]; then - if [ "$NEW_KERNEL" = "1" ]; then - reboot -f "$BOOT_PART_NUM" - sleep 5 - else - echo "$BOOT_PART_NUM" > "/sys/module/${BCM_MODULE}/parameters/reboot_part" - fi - fi reboot -f sleep 5 exit 0 @@ -32,14 +24,6 @@ check_commands () { return 0 } -check_noobs () { - if [ "$BOOT_PART_NUM" = "1" ]; then - NOOBS=0 - else - NOOBS=1 - fi -} - get_variables () { ROOT_PART_DEV=$(findmnt / -o source -n) ROOT_PART_NAME=$(echo "$ROOT_PART_DEV" | cut -d "/" -f 3) @@ -54,8 +38,6 @@ get_variables () { OLD_DISKID=$(fdisk -l "$ROOT_DEV" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p') - check_noobs - ROOT_DEV_SIZE=$(cat "/sys/block/${ROOT_DEV_NAME}/size") TARGET_END=$((ROOT_DEV_SIZE - 1)) @@ -66,13 +48,6 @@ get_variables () { ROOT_PART_LINE=$(echo "$PARTITION_TABLE" | grep -e "^${ROOT_PART_NUM}:") ROOT_PART_START=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 2) ROOT_PART_END=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 3) - - if [ "$NOOBS" = "1" ]; then - EXT_PART_LINE=$(echo "$PARTITION_TABLE" | grep ":::;" | head -n 1) - EXT_PART_NUM=$(echo "$EXT_PART_LINE" | cut -d ":" -f 1) - EXT_PART_START=$(echo "$EXT_PART_LINE" | cut -d ":" -f 2) - EXT_PART_END=$(echo "$EXT_PART_LINE" | cut -d ":" -f 3) - fi } fix_partuuid() { @@ -97,15 +72,6 @@ EOF } check_variables () { - if [ "$NOOBS" = "1" ]; then - if [ "$EXT_PART_NUM" -gt 4 ] || \ - [ "$EXT_PART_START" -gt "$ROOT_PART_START" ] || \ - [ "$EXT_PART_END" -lt "$ROOT_PART_END" ]; then - FAIL_REASON="Unsupported extended partition" - return 1 - fi - fi - if [ "$BOOT_DEV_NAME" != "$ROOT_DEV_NAME" ]; then FAIL_REASON="Boot and root partitions are on different devices" return 1 @@ -127,18 +93,6 @@ check_variables () { fi } -check_kernel () { - MAJOR="$(uname -r | cut -f1 -d.)" - MINOR="$(uname -r | cut -f2 -d.)" - if [ "$MAJOR" -eq "4" ] && [ "$MINOR" -lt "9" ]; then - return 0 - fi - if [ "$MAJOR" -lt "4" ]; then - return 0 - fi - NEW_KERNEL=1 -} - main () { get_variables @@ -146,27 +100,10 @@ main () { return 1 fi - check_kernel - - if [ "$NOOBS" = "1" ] && [ "$NEW_KERNEL" != "1" ]; then - BCM_MODULE=$(grep -e "^Hardware" /proc/cpuinfo | cut -d ":" -f 2 | tr -d " " | tr '[:upper:]' '[:lower:]') - if ! modprobe "$BCM_MODULE"; then - FAIL_REASON="Couldn't load BCM module $BCM_MODULE" - return 1 - fi - fi - if [ "$ROOT_PART_END" -eq "$TARGET_END" ]; then reboot_pi fi - if [ "$NOOBS" = "1" ]; then - if ! printf "resizepart %s\nyes\n%ss\n" "$EXT_PART_NUM" "$TARGET_END" | parted "$ROOT_DEV" ---pretend-input-tty; then - FAIL_REASON="Extended partition resize failed" - return 1 - fi - fi - if ! parted -m "$ROOT_DEV" u s resizepart "$ROOT_PART_NUM" "$TARGET_END"; then FAIL_REASON="Root partition resize failed" return 1 From ab773c60b2dfa5ff49530990c401aaf898dabf01 Mon Sep 17 00:00:00 2001 From: Takumi Sueda Date: Sat, 2 Jul 2022 23:23:31 +0900 Subject: [PATCH 3/5] Replace and rename raspi -> brain --- LICENSE | 3 +- raspi-config => brain-config | 55 +- .../{raspi-config.init => brain-config.init} | 2 +- debian/brain-config.install | 2 + ...-config.postinst => brain-config.postinst} | 2 +- ...aspi-config.postrm => brain-config.postrm} | 0 ...{raspi-config.prerm => brain-config.prerm} | 2 +- debian/changelog | 922 +----------------- debian/control | 13 +- debian/copyright | 4 +- debian/raspi-config.install | 3 - .../{raspi-config => brain-config}/cmstart.sh | 0 .../init_resize.sh | 12 +- .../10-blanking.conf | 0 14 files changed, 44 insertions(+), 976 deletions(-) rename raspi-config => brain-config (89%) rename debian/{raspi-config.init => brain-config.init} (97%) create mode 100644 debian/brain-config.install rename debian/{raspi-config.postinst => brain-config.postinst} (83%) rename debian/{raspi-config.postrm => brain-config.postrm} (100%) rename debian/{raspi-config.prerm => brain-config.prerm} (95%) delete mode 100644 debian/raspi-config.install rename usr/lib/{raspi-config => brain-config}/cmstart.sh (100%) rename usr/lib/{raspi-config => brain-config}/init_resize.sh (93%) rename usr/share/{raspi-config => brain-config}/10-blanking.conf (100%) diff --git a/LICENSE b/LICENSE index dd318ed..a2ab76c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,8 @@ -raspi-config is licensed under the terms of the MIT license reproduced below. +brain-config is licensed under the terms of the MIT license reproduced below. ##################################################### +Copyright (c) 2022 Brain Hackers Copyright (c) 2012 Alex Bradbury Permission is hereby granted, free of charge, to any person diff --git a/raspi-config b/brain-config similarity index 89% rename from raspi-config rename to brain-config index 08fe15f..50b0e0e 100755 --- a/raspi-config +++ b/brain-config @@ -6,26 +6,13 @@ INTERACTIVE=True ASK_TO_REBOOT=0 -BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf +BLACKLIST=/etc/modprobe.d/brain-blacklist.conf CONFIG=/boot/config.txt # TODO: erase these envs USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')} -is_pi () { - ARCH=$(dpkg --print-architecture) - if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then - return 0 - else - return 1 - fi -} - -if is_pi ; then - CMDLINE=/boot/cmdline.txt -else - CMDLINE=/proc/cmdline -fi +CMDLINE=/boot/cmdline.txt calc_wt_size() { # NOTE: it's tempting to redirect stderr to /dev/null, so supress error @@ -50,7 +37,7 @@ configuration of the SHARP Brain. Although it can be run at any time, some of the options may have difficulties if you have heavily customised your installation. -$(dpkg -s raspi-config 2> /dev/null | grep Version)\ +$(dpkg -s brain-config 2> /dev/null | grep Version)\ " 20 70 1 return 0 } @@ -227,11 +214,9 @@ do_wifi_country() { fi if hash rfkill 2> /dev/null; then rfkill unblock wifi - if is_pi ; then - for filename in /var/lib/systemd/rfkill/*:wlan ; do - echo 0 > $filename - done - fi + for filename in /var/lib/systemd/rfkill/*:wlan ; do + echo 0 > $filename + done fi if [ "$INTERACTIVE" = True ]; then whiptail --msgbox "Wireless LAN country set to $COUNTRY" 20 60 1 @@ -310,11 +295,11 @@ do_ssh() { fi } -disable_raspi_config_at_boot() { - if [ -e /etc/profile.d/raspi-config.sh ]; then - rm -f /etc/profile.d/raspi-config.sh - if [ -e /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf ]; then - rm /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf +disable_brain_config_at_boot() { + if [ -e /etc/profile.d/brain-config.sh ]; then + rm -f /etc/profile.d/brain-config.sh + if [ -e /etc/systemd/system/getty@tty1.service.d/brain-config-override.conf ]; then + rm /etc/systemd/system/getty@tty1.service.d/brain-config-override.conf fi telinit q fi @@ -468,7 +453,7 @@ do_wifi_ssid_passphrase() { } do_finish() { - disable_raspi_config_at_boot + disable_brain_config_at_boot if [ $ASK_TO_REBOOT -eq 1 ]; then whiptail --yesno "Would you like to reboot now?" 20 60 2 if [ $? -eq 0 ]; then # yes @@ -527,12 +512,12 @@ done # Everything else needs to be run as root if [ $(id -u) -ne 0 ]; then - printf "Script must be run as root. Try 'sudo raspi-config'\n" + printf "Script must be run as root. Try 'sudo brain-config'\n" exit 1 fi do_system_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "S1 Wireless LAN" "Enter SSID and passphrase" \ "S3 Password" "Change password for the '$USER' user" \ "S4 Hostname" "Set name for this computer on a network" \ @@ -551,7 +536,7 @@ do_system_menu() { } do_interface_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "I2 SSH" "Enable/disable remote command line access using SSH" \ 3>&1 1>&2 2>&3) RET=$? @@ -566,7 +551,7 @@ do_interface_menu() { } do_internationalisation_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "L1 Locale" "Configure language and regional settings" \ "L2 Timezone" "Configure time zone" \ "L4 WLAN Country" "Set legal wireless channels for your country" \ @@ -585,7 +570,7 @@ do_internationalisation_menu() { } do_advanced_menu() { - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ "A4 Network Interface Names" "Enable/disable predictable network i/f names" \ 3>&1 1>&2 2>&3) @@ -608,16 +593,16 @@ if [ "$INTERACTIVE" = True ]; then [ -e $CONFIG ] || touch $CONFIG calc_wt_size while [ "$USER" = "root" ] || [ -z "$USER" ]; do - if ! USER=$(whiptail --inputbox "raspi-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then + if ! USER=$(whiptail --inputbox "brain-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then return 0 fi done while true; do - FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ + FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ "1 System Options" "Configure system settings" \ "5 Localisation Options" "Configure language and regional settings" \ "6 Advanced Options" "Configure advanced settings" \ - "9 About raspi-config" "Information about this configuration tool" \ + "9 About brain-config" "Information about this configuration tool" \ 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then diff --git a/debian/raspi-config.init b/debian/brain-config.init similarity index 97% rename from debian/raspi-config.init rename to debian/brain-config.init index 886273b..a88745d 100644 --- a/debian/raspi-config.init +++ b/debian/brain-config.init @@ -1,6 +1,6 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: raspi-config +# Provides: brain-config # Required-Start: udev mountkernfs $remote_fs # Required-Stop: # Default-Start: S 2 3 4 5 diff --git a/debian/brain-config.install b/debian/brain-config.install new file mode 100644 index 0000000..1c65be4 --- /dev/null +++ b/debian/brain-config.install @@ -0,0 +1,2 @@ +brain-config /usr/bin +usr/ diff --git a/debian/raspi-config.postinst b/debian/brain-config.postinst similarity index 83% rename from debian/raspi-config.postinst rename to debian/brain-config.postinst index 8f6eae1..36889fc 100644 --- a/debian/raspi-config.postinst +++ b/debian/brain-config.postinst @@ -5,7 +5,7 @@ if [ -e /etc/init.d/switch_cpu_governor ]; then fi if dpkg --compare-versions "${2}" lt-nl "20170619"; then - update-rc.d -f raspi-config remove + update-rc.d -f brain-config remove fi #DEBHELPER# diff --git a/debian/raspi-config.postrm b/debian/brain-config.postrm similarity index 100% rename from debian/raspi-config.postrm rename to debian/brain-config.postrm diff --git a/debian/raspi-config.prerm b/debian/brain-config.prerm similarity index 95% rename from debian/raspi-config.prerm rename to debian/brain-config.prerm index 258eb2f..d279775 100644 --- a/debian/raspi-config.prerm +++ b/debian/brain-config.prerm @@ -1,5 +1,5 @@ #! /bin/sh -# prerm script for raspi-config +# prerm script for brain-config # # see: dh_installdeb(1) diff --git a/debian/changelog b/debian/changelog index 74d2ade..3ac8bde 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,921 +1,5 @@ -raspi-config (20220506) bullseye; urgency=medium +brain-config (20220702) bullseye; urgency=medium - * Modify Wayland switching to work with AccountSettings + * Forked from raspi-config - -- Simon Long Fri, 06 May 2022 14:07:57 +0100 - -raspi-config (20220425) bullseye; urgency=medium - - * Tidy hardware detection functions - - -- Simon Long Mon, 25 Apr 2022 17:38:35 +0100 - -raspi-config (20220419) bullseye; urgency=medium - - * Reinstate -R parameter for xcompmgr - - -- Simon Long Tue, 19 Apr 2022 10:36:34 +0100 - -raspi-config (20220331) bullseye; urgency=medium - - [ Serge Schneider ] - * Remove nonint whiptail msgbox in do_overlayfs - * Update get_boot_cli - * Remove legacy autologin cruft - * Run systemctl daemon-reload after boot behaviour changes - * Make autologin changes quieter - - [ Simon Long ] - * Add switching for experimental Wayland backend - * Fix incorrect detection of read-only boot partition - * Force xrandr to reload on non-mutter systems when overscan changed - - -- Serge Schneider Mon, 07 Mar 2022 09:26:38 +0000 - -raspi-config (20220303) bullseye; urgency=medium - - * Use wildcards for KMS test - - -- Simon Long Thu, 03 Mar 2022 13:44:04 +0000 - -raspi-config (20220301) bullseye; urgency=medium - - [ Serge Schneider ] - * pass -f flag to rm - * Fix init_resize.sh on Bullseye NOOBS images - - [ Simon Long ] - * Rename is_fkms function to is_kms - * Remove pixel doubling for KMS systems - * Add on-the-fly overscan setting for KMS systems - * Use in-built is_kms function for cmstart script - - -- Simon Long Tue, 01 Mar 2022 11:56:27 +0000 - -raspi-config (20220126) bullseye; urgency=medium - - * Modify overlay functions to match format of other nonint calls - - -- Simon Long Wed, 26 Jan 2022 14:55:17 +0000 - -raspi-config (20220112) bullseye; urgency=medium - - * Run apt-get with '-y' flag when in nonint mode - - https://github.com/RPi-Distro/raspi-config/issues/177 - - -- Serge Schneider Wed, 12 Jan 2022 09:04:54 +0000 - -raspi-config (20220110) bullseye; urgency=medium - - * Add -q flag to wait.conf - - https://github.com/RPi-Distro/raspi-config/issues/173 - - -- Serge Schneider Mon, 10 Jan 2022 11:54:26 +0000 - -raspi-config (20220106) bullseye; urgency=medium - - [ garyk10 ] - * Make nonint do_change_locale work with encoding field as well (#167) - - [ Aristo Chen ] - * Fix inconsistent indent (#165) - - -- Serge Schneider Thu, 06 Jan 2022 08:24:02 +0000 - -raspi-config (20211203) bullseye; urgency=medium - - * Correct labelling for x86 version as well - - -- Simon Long Thu, 02 Dec 2021 18:39:04 +0000 - -raspi-config (20211202) bullseye; urgency=medium - - * Correct labelling of entries in the interface menu - - -- Simon Long Thu, 02 Dec 2021 11:51:10 +0000 - -raspi-config (20211124) bullseye; urgency=medium - - * Legacy camera mode switch added - - -- Simon Long Wed, 24 Nov 2021 16:45:14 +0000 - -raspi-config (20211111) bullseye; urgency=medium - - * Changes to configuring of composite output under KMS - - -- Simon Long Thu, 11 Nov 2021 16:41:28 +0000 - -raspi-config (20211110) bullseye; urgency=medium - - * Add VNC resolution option - - -- Simon Long Wed, 10 Nov 2021 11:28:55 +0000 - -raspi-config (20211103) bullseye; urgency=medium - - * Use 'reboot' on initial resize instead of sysrq emergency reboot - - -- Serge Schneider Wed, 03 Nov 2021 17:50:52 +0000 - -raspi-config (20211019) bullseye; urgency=medium - - * Add switching of glamor acceleration - - -- Simon Long Tue, 19 Oct 2021 18:35:03 +0100 - -raspi-config (20210927) bullseye; urgency=medium - - * Remove resolution setting option under KMS - - -- Simon Long Mon, 27 Sep 2021 18:19:23 +0100 - -raspi-config (20210924) bullseye; urgency=medium - - * Remove fake KMS option - - -- Simon Long Fri, 24 Sep 2021 14:32:52 +0100 - -raspi-config (20210923) bullseye; urgency=medium - - * Updated the the wait.conf drop-in for the new dhcpcd5 package - - -- Serge Schneider Thu, 23 Sep 2021 18:24:05 +0100 - -raspi-config (20210922) bullseye; urgency=medium - - * Handle 73-usb-net-by-mac.link when toggling network names - - https://github.com/RPi-Distro/raspi-config/issues/166 - - -- Serge Schneider Wed, 22 Sep 2021 16:13:52 +0100 - -raspi-config (20210827) bullseye; urgency=medium - - * Add switching for new camera detection in firmware - - -- Simon Long Fri, 27 Aug 2021 16:13:49 +0100 - -raspi-config (20210816) bullseye; urgency=medium - - * Enable xcompmgr with full KMS as well as fKMS on all platforms - - -- Simon Long Mon, 16 Aug 2021 14:02:06 +0100 - -raspi-config (20210610) bullseye; urgency=medium - - * Remove redundant xcompmgr parameter - - -- Simon Long Thu, 10 Jun 2021 17:02:43 +0100 - -raspi-config (20210604) bullseye; urgency=medium - - * Disable xcompmgr when openbox not running - - -- Simon Long Fri, 04 Jun 2021 13:53:42 +0100 - -raspi-config (20210212) buster; urgency=medium - - * Update boot order menu - - -- Simon Long Fri, 12 Feb 2021 12:07:27 +0000 - -raspi-config (20210119) buster; urgency=medium - - * Move Pi 4 video output setting to advanced menu - - -- Simon Long Tue, 19 Jan 2021 14:51:58 +0000 - -raspi-config (20201108) buster; urgency=medium - - * Fix typo in fan controller - - -- Simon Long Sun, 08 Nov 2020 11:37:08 +0000 - -raspi-config (20201027) buster; urgency=medium - - * Add function to check whether board has an analog output jack - - -- Simon Long Tue, 27 Oct 2020 17:29:53 +0000 - -raspi-config (20201014) buster; urgency=medium - - * Add PulseAudio output control - * Restructure menus to match GUI application - - -- Simon Long Wed, 14 Oct 2020 14:59:35 +0100 - -raspi-config (20201006) buster; urgency=medium - - * Add fan control - - -- Simon Long Tue, 06 Oct 2020 15:17:39 +0100 - -raspi-config (20200902) buster; urgency=medium - - * Add option to control power LED on Pi Zero - - -- Simon Long Wed, 02 Sep 2020 11:46:19 +0100 - -raspi-config (20200817) buster; urgency=medium - - * Use processor ID to detect Pi 4 rather than board ID - - -- Simon Long Mon, 17 Aug 2020 09:24:09 +0100 - -raspi-config (20200727) buster; urgency=medium - - * Disable initial rfkill for all platforms when setting wireless country - - -- Simon Long Mon, 27 Jul 2020 15:47:29 +0100 - -raspi-config (20200707) buster; urgency=medium - - * Add boot ROM and boot order selection - - -- Simon Long Tue, 07 Jul 2020 09:24:56 +0100 - -raspi-config (20200601) buster; urgency=medium - - * Fix audio device check bug when used in non-English locale - - -- Simon Long Mon, 01 Jun 2020 10:28:35 +0100 - -raspi-config (20200515) buster; urgency=medium - - * Update initial resize script - - Change disk ID to avoid clashes - * Add support for USB resize - - -- Serge Schneider Fri, 15 May 2020 08:47:17 +0100 - -raspi-config (20200504) buster; urgency=medium - - * Replace references to wifi - - -- Simon Long Mon, 04 May 2020 11:47:53 +0100 - -raspi-config (20200226) buster; urgency=medium - - * Sync FKMS check with gldriver-test - * Fix is_pi check - - -- Serge Schneider Wed, 26 Feb 2020 17:51:20 +0000 - -raspi-config (20200207) buster; urgency=medium - - * Fix bug preventing VNC from being disabled - - -- Serge Schneider Fri, 07 Feb 2020 12:59:29 +0000 - -raspi-config (20200205) buster; urgency=medium - - * Add filter parameter to xrandr when setting pixel doubling - - -- Simon Long Wed, 05 Feb 2020 07:46:42 +0000 - -raspi-config (20200203) buster; urgency=medium - - * Add pixel doubling option for FKMS using xrandr - - -- Simon Long Mon, 03 Feb 2020 09:36:38 +0000 - -raspi-config (20200120) buster; urgency=medium - - * Add audio switching for discrete internal ALSA devices - - -- Simon Long Mon, 20 Jan 2020 11:38:37 +0000 - -raspi-config (20200117) buster; urgency=medium - - * Add proxy configuration - * Handle cases where SUDO_USER is unset - * Fix VNC options - * Install required packages when changing GL settings - * Add warning when enabling SSH - * OverlayFS - try loading module from rootfs - * OverlayFS - remove initramfs when disabled - - -- Serge Schneider Fri, 17 Jan 2020 11:50:54 +0000 - -raspi-config (20191210) buster; urgency=medium - - * Fix postrm script - - -- Serge Schneider Tue, 10 Dec 2019 14:22:08 +0000 - -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 - - -- Simon Long Mon, 21 Oct 2019 14:44:54 +0100 - -raspi-config (20191008) buster; urgency=medium - - * Remove pixel doubling option for x86 - - -- Simon Long Tue, 08 Oct 2019 10:19:48 +0100 - -raspi-config (20191005) buster; urgency=medium - - * Add overlay file system functions - - -- Simon Long Fri, 05 Oct 2019 10:13:58 +0100 - -raspi-config (20190917) buster; urgency=medium - - * Enable overscan for FKMS - - -- Simon Long Tue, 17 Sep 2019 15:34:56 +0100 - -raspi-config (20190709) buster; urgency=medium - - * Rename hdmi_enable_4k to hdmi_enable_4kp60 - - -- Simon Long Tue, 09 Jul 2019 13:48:03 +0100 - -raspi-config (20190620) buster; urgency=medium - - * get_wifi_country: call save_config instead of reconfigure - - Prevents WiFi from disconnecting - - -- Serge Schneider Thu, 20 Jun 2019 20:01:06 +0100 - -raspi-config (20190619) buster; urgency=medium - - [ Simon Long ] - * Fix composite output options for Pi 4 - * Keep splash screen settings when changing GPU options - - -- Serge Schneider Wed, 19 Jun 2019 15:49:38 +0100 - -raspi-config (20190607) buster; urgency=medium - - [ Simon Long ] - * Only run xcompmgr if FKMS is enabled - - -- Serge Schneider Fri, 07 Jun 2019 16:11:11 +0100 - -raspi-config (20190520) buster; urgency=medium - - [ Simon Long ] - * Add Pi 4 video options - - -- Serge Schneider Mon, 20 May 2019 11:01:12 +0100 - -raspi-config (20190514) buster; urgency=medium - - [ Simon Long ] - * Add FKMS check - * Disable pixel doubling when FKMS is enabled - - -- Serge Schneider Tue, 14 May 2019 15:38:17 +0100 - -raspi-config (20190509) buster; urgency=medium - - * init_resize.sh: Remove sdhci.debug_quirks2=4 from /boot/cmdline.txt - - -- Serge Schneider Thu, 09 May 2019 13:38:34 +0100 - -raspi-config (20190507) buster; urgency=medium - - [ Simon Long ] - * Switch from compton to xcompmgr - * Tweak get_wifi_country to work with the desktop applet - - -- Serge Schneider Tue, 07 May 2019 16:03:15 +0100 - -raspi-config (20190502) buster; urgency=medium - - * Use wpa_cli to check WiFi country setting - - -- Serge Schneider Thu, 02 May 2019 13:22:49 +0100 - -raspi-config (20190429) buster; urgency=medium - - * Update do_wifi_country - - Enable wifi regardless of whether /run/wifi-country-unset exists - * Make sure SSH host keys are generated when SSH is enabled - -- Serge Schneider Mon, 29 Apr 2019 14:52:56 +0100 - -raspi-config (20190424) stretch; urgency=medium - - * Add Compton option to advanced options - - -- Simon Long Wed, 24 Apr 2019 13:45:54 +0100 - -raspi-config (20190423) stretch; urgency=medium - - * Change autologin $TERM; tweaks to overclock wording - - -- Simon Long Tue, 23 Apr 2019 08:19:08 +0100 - -raspi-config (20190219) stretch; urgency=medium - - * Update autologin behaviour for compatibility with buster - - -- Simon Long Tue, 19 Feb 2019 10:07:01 +0000 - -raspi-config (20181118) stretch; urgency=medium - - * Set TTY autologin correctly when using desktop autologin - - -- Simon Long Sun, 18 Nov 2018 10:59:01 +0000 - -raspi-config (20180518) stretch; urgency=medium - - * Add separate settings for serial hardware and console - - -- Simon Long Fri, 18 May 2018 07:29:57 +0100 - -raspi-config (20180406+1) stretch; urgency=medium - - * Fix Wi-Fi country setting - - -- Serge Schneider Fri, 06 Apr 2018 14:28:02 +0100 - -raspi-config (20180406) stretch; urgency=medium - - * Set Wi-Fi country while connecting to SSID - - -- Serge Schneider Fri, 06 Apr 2018 13:40:21 +0100 - -raspi-config (20180228) stretch; urgency=medium - - * Setting Wi-Fi country no longer requires a reboot - - -- Serge Schneider Wed, 28 Feb 2018 17:28:50 +0000 - -raspi-config (20171201) stretch; urgency=medium - - * Add pixel doubling option - - -- Simon Long Fri, 01 Dec 2017 08:05:53 +0000 - -raspi-config (20171127) stretch; urgency=medium - - * Allow entering SSID and passphrase (#68) - * Console keyboard layout changes effective immediately (#67) - * Formatting fixes (#70) - * Add non-interactive timezone, locale and keyboard configuration - * Modify architecture test for piserver - - -- Simon Long Mon, 27 Nov 2017 10:14:37 +0000 - -raspi-config (20170926) stretch; urgency=medium - - * Add option to enable predictable network interface names - - -- Serge Schneider Tue, 26 Sep 2017 12:32:25 +0100 - -raspi-config (20170811) stretch; urgency=medium - - * Only restart pigpio daemon if it is running - - -- Simon Long Fri, 11 Aug 2017 14:40:50 +0100 - -raspi-config (20170803) stretch; urgency=medium - - * Allow splash screen with fake KMS. - - -- Simon Long Thu, 03 Aug 2017 10:11:08 +0100 - -raspi-config (20170714) stretch; urgency=medium - - [Simon Long] - * Autologin operations now all use current user rather than defaulting to pi - * initd support removed - [Serge Schneider] - * Add pi model as backtitle - * Define memory split units - * Fix NOOBS config keyboard setup - - -- Serge Schneider Fri, 14 Jul 2017 12:34:21 +0100 - -raspi-config (20170711) stretch; urgency=medium - - * Fix wait for network option - * Bump compat level to 9 - - -- Serge Schneider Tue, 11 Jul 2017 11:47:34 +0100 - -raspi-config (20170704) stretch; urgency=medium - - * Remove unnecessary sudo from apt-get - - -- Simon Long Tue, 04 Jul 2017 10:28:55 +0100 - -raspi-config (20170627) stretch; urgency=medium - - * Change configuration for GL driver - no compton, keep fbturbo, allow on Pi 1 and Pi 0 - - -- Simon Long Tue, 27 Jun 2017 11:56:21 +0100 - -raspi-config (20170619) stretch; urgency=medium - - * Start service on all runlevels - - -- Serge Schneider Mon, 19 Jun 2017 09:14:40 +0000 - -raspi-config (20170518) jessie; urgency=medium - - * Improve x86 splash screen command line handling to remove spurious arguments and spaces - - -- Simon Long Thu, 18 May 2017 13:19:27 +0100 - -raspi-config (20170503) jessie; urgency=medium - - * Correctly handle GRUB command line options for splash screen on x86 - - -- Simon Long Wed, 03 May 2017 11:30:57 +0100 - -raspi-config (20170307) jessie; urgency=medium - - * Run init_resize.sh through shellcheck - * Improve init_resize.sh reliability - - -- Serge Schneider Tue, 07 Mar 2017 13:49:57 +0000 - -raspi-config (20170228) jessie; urgency=medium - - * Added detection of 0 W boards - - -- Simon Long Tue, 28 Feb 2017 10:06:36 +0000 - -raspi-config (20170214) jessie; urgency=medium - - * Allow compton with fake KMS driver; modified check for ARM architecture - - -- Simon Long Tue, 14 Feb 2017 14:47:58 +0000 - -raspi-config (20170127) jessie; urgency=medium - - * Prevent keyboard language from being configured over SSH - - -- Simon Long Fri, 27 Jan 2017 16:15:56 +0000 - -raspi-config (20170120) jessie; urgency=medium - - * Mods to support use on x86; fake KMS option added for GL driver - - -- Simon Long Fri, 20 Jan 2017 14:19:18 +0000 - -raspi-config (20161207) jessie; urgency=medium - - * Use compton for compositing with GL driver instead of xcompmgr - - -- Simon Long Wed, 07 Dec 2016 12:43:26 +0000 - -raspi-config (20161206) jessie; urgency=medium - - * Menus reorganised; resolution setting added - - -- Simon Long Tue, 06 Dec 2016 13:43:32 +0000 - -raspi-config (20161114) jessie; urgency=medium - - * Restore -a option for xcompmgr; disable splash screen with GL driver - - -- Simon Long Mon, 14 Nov 2016 14:25:19 +0000 - -raspi-config (20161108) jessie; urgency=medium - - * init_resize.sh: Remove clash with pix-plym-splash - - -- Serge Schneider Tue, 08 Nov 2016 17:34:00 +0000 - -raspi-config (20161102) jessie; urgency=medium - - * Sed processing of autologin options modified to improve robustness - - -- Simon Long Wed, 02 Nov 2016 15:02:45 +0000 - -raspi-config (20161013) jessie; urgency=medium - - * Rastrack option removed - * Splash screen control added - - -- Simon Long Thu, 13 Oct 2016 13:53:54 +0100 - -raspi-config (20160527) jessie; urgency=medium - - [ Simon Long ] - * Function to read hostname added - * Function added to get wifi country - * Functions to detect boot behaviour added - * Test functions added for remote GPIO and slow boot - * Added some functions to read current state for use by rc_gui - * Requirement for reboot removed from SPI and I2C settings - * A lot of NOTs taken out of serial test - * Status indications moved to end of some functions - * Overscan description amended - * Check for fs expandability added; overscan function matches others - * Added more success / fail feedback to settings - * Global check for mountpoint and existence of /boot/config.txt - * Checking of initial state added for camera and 1-wire - * Unnecessary reboots removed - * Some function names changed for consistency - * GL driver setting aligned with other functions - * Functions to control remote GPIO and boot wait for network aligned - * Tidied function to control remote GPIO access - - -- Serge Schneider Fri, 27 May 2016 11:10:11 +0100 - -raspi-config (20160506) jessie; urgency=medium - - [ Axel Beckert ] - * Downgrade hard dependency on triggerhappy to recommendation. - + init script: Check if thd is present before using it. - - [ Simon Long ] - * New method for testing whether serial is enabled. - * Current state of serial i/f reflected in raspi-config. - * Menu option to toggle device tree removed. - - -- Serge Schneider Fri, 06 May 2016 18:41:58 +0100 - -raspi-config (20160428) jessie; urgency=medium - - * [Simon Long] - - dtparam used instead of modprobe for SPI and I2C - - -- Serge Schneider Thu, 28 Apr 2016 15:42:42 +0100 - -raspi-config (20160425) jessie; urgency=medium - - * [Simon Long] - - Merge - Prevent errors when enabling "Fast" network boot multiple times - - UART switch added to serial; GPIO server public access finished - - Skeleton added for setting security state of GPIO server - - Reads in gpu_mem_ settings and clears them when writing - * [Serge Schneider] - - Remove io_is_busy - - -- Serge Schneider Mon, 25 Apr 2016 11:58:48 +0100 - -raspi-config (20160322) jessie; urgency=medium - - * [Simon Long] - - 1-wire interface control added - - Wifi country code setting now creates wpa_supplicant.conf - if it doesn't exist - * [Serge Schneider] - - Add first boot resize script - - -- Serge Schneider Tue, 22 Mar 2016 16:45:29 +0000 - -raspi-config (20160225) jessie; urgency=medium - - * Added wi-fi country setting to raspi-config - * Wifi setting in raspi-config can now be called in non-interactive mode. - * Mods to support new serial device alias in cmdline.txt. - - -- Serge Schneider Thu, 25 Feb 2016 07:48:56 +0000 - -raspi-config (20160210) jessie; urgency=medium - - * Pi board checks now take account of warranty bits. - - -- Serge Schneider Tue, 09 Feb 2016 16:16:58 +0000 - -raspi-config (20160209) jessie; urgency=medium - - * Check for mesa driver before allowing GL driver to be enabled - - -- Serge Schneider Tue, 09 Feb 2016 13:56:44 +0000 - -raspi-config (20160201) jessie; urgency=medium - - * Compute Module added to is_pione - - -- Serge Schneider Mon, 01 Feb 2016 12:28:22 +0000 - -raspi-config (20160125) jessie; urgency=medium - - * Do not allow GL driver to be enabled on 2835-based Pis - it needs at least 1GB of RAM. - * Overclocking behaviour made board-specific. - - -- Serge Schneider Mon, 25 Jan 2016 12:29:54 +0000 - -raspi-config (20160121) jessie; urgency=medium - - * GPU memory reset to default when GL driver enabled - * Launch of simple compositor added when GL driver is enabled - * Filename of V3d overlay corrected - - -- Serge Schneider Thu, 21 Jan 2016 11:12:49 +0000 - -raspi-config (20160119) jessie; urgency=medium - - * Option added to select experimental GL driver - - -- Serge Schneider Tue, 19 Jan 2016 13:56:53 +0000 - -raspi-config (20160108) jessie; urgency=medium - - * Update URL - * Remove first boot auto-login files - * Fix auto-login - * Fix typos - - -- Serge Schneider Fri, 08 Jan 2016 10:44:05 +0000 - -raspi-config (20151117) jessie; urgency=medium - - * raspi-config modified to remove config variables rather than set default - values when overclocking - - -- Serge Schneider Tue, 17 Nov 2015 11:35:14 +0000 - -raspi-config (20151019) jessie; urgency=medium - - * Add alsa-utils dependency - * Remove unnecessary sudo in init script - * Add wait for network option - - -- Serge Schneider Mon, 19 Oct 2015 13:01:26 +0100 - -raspi-config (20150923) jessie; urgency=medium - - * Auto-login to desktop and console option for rc_gui - - -- Serge Schneider Wed, 23 Sep 2015 21:25:52 +0100 - -raspi-config (20150915) jessie; urgency=medium - - * Add support for rc_gui from spl - - -- Serge Schneider Tue, 15 Sep 2015 10:23:52 +0100 - -raspi-config (20150706) jessie; urgency=low - - * Include io_is_busy in cpufreq settings - * Bump standards version to 3.9.6 - - -- Serge Schneider Mon, 06 Jul 2015 08:59:56 +0100 - -raspi-config (20150603) jessie; urgency=low - - * systemd compatibility - * Add udevadm command to notify Xorg after change of keyboard layout - jojopi - * Remove boot to scratch - - -- Serge Schneider Fri, 29 May 2015 11:31:46 +0100 - -raspi-config (20150131-4) stable; urgency=low - - * Use dh_installinit --no-start instead of --noscripts to ensure raspi-config runs - - -- Serge Schneider Thu, 14 May 2015 18:09:47 +0100 - -raspi-config (20150131-3) unstable; urgency=low - - * Add prerm failed-upgrade to allow upgrades - - -- Serge Schneider Wed, 06 May 2015 15:33:35 +0100 - -raspi-config (20150131-2) unstable; urgency=low - - * Prevent postinstall from trying to stop /etc/init.d/raspi-config - dh_installinit --noscripts - - -- Serge Schneider Wed, 06 May 2015 14:23:57 +0100 - -raspi-config (20150131-1) unstable; urgency=low - - * Add Pi2 overclock preset - * Ask whether to reboot after changing devicetree - * Remove old switch_cpu_governor init script upon install - - -- Alex Bradbury Sat, 31 Jan 2015 20:17:40 +0000 - -raspi-config (20150129-1) unstable; urgency=low - - * Add devicetree support (thanks Phil Elwell) - * Always include the ondemand governor init script - * Tweak ondemand cpu scaling governor settings - - -- Alex Bradbury Thu, 29 Jan 2015 23:40:15 +0000 - -raspi-config (20140902-1) unstable; urgency=low - - * Add option to toggle i2c and serial - - -- Alexander Bradbury Tue, 02 Sep 2014 17:26:06 +0100 - -raspi-config (20131216-1) unstable; urgency=low - - * Add option to configure audio out - * Fail boot to scratch or boot to desktop setting when pi user was removed - * When enabling camera, only set gpu mem if it's unset or < 128MiB - - -- Alexander Bradbury Mon, 16 Dec 2013 21:50:38 +0000 - -raspi-config (20130925-1) unstable; urgency=low - - * Fix issue inheriting language settings from NOOBS - * Add ability to toggle spi module blacklisting - - -- Alex Bradbury Wed, 25 Sep 2013 20:55:34 +0100 - -raspi-config (20130910-1) unstable; urgency=low - - * Bugfix for boot to scratch - * Bugfix for detecting flavour set by NOOBS - - -- Alexander Bradbury Tue, 10 Sep 2013 14:36:14 +0100 - -raspi-config (20130909-1) unstable; urgency=low - - * Support boot to scratch and applying language/keyboard settings from noobs - - -- Alexander Bradbury Mon, 09 Sep 2013 23:53:58 +0100 - -raspi-config (20130525-1) unstable; urgency=low - - * Use start_x rather than startx in config.txt for enabling camera to reduce - confusion - - -- Alex Bradbury Sat, 25 May 2013 17:15:07 +0100 - -raspi-config (20130525) unstable; urgency=low - - * Tweak height of whiptail display (thanks Rob Bishop) - * Fix issue of gpu_mem=16 not working when camera is enabled - - -- Alex Bradbury Sat, 25 May 2013 16:49:19 +0100 - -raspi-config (20130522) unstable; urgency=low - - * Re-organise menus and give better explanations for options (thanks Rob - Bishop) - * Refuse to expand_rootfs on NOOBS partition layouts. - - -- Alex Bradbury Wed, 22 May 2013 20:51:07 +0100 - -raspi-config (20130520) unstable; urgency=low - - * Make expand_rootfs work if /dev/root is not second partition - - -- Alex Bradbury Mon, 20 May 2013 19:48:02 +0100 - -raspi-config (20130515) unstable; urgency=low - - * Lower cpufreq threshold when overclocking - - -- Alex Bradbury Wed, 15 May 2013 19:47:40 +0100 - -raspi-config (20130510) unstable; urgency=low - - * Added support for registering on rastrack (thanks Ryan Walmsley) - * Added ability to set hostname (thanks Andrew Stone) - * Added --expand-rootfs option (thanks Viktor Petersson) - * Added ability to enable Raspberry Pi camera support - - -- Alex Bradbury Fri, 10 May 2013 12:19:42 +0100 - -raspi-config (20121028) unstable; urgency=low - - * Update overclocking options - * Disable command-line options for non-interactive use - * Support new gpu_mem config option - - -- Alex Bradbury Sun, 28 Oct 2012 21:11:34 +0000 - -raspi-config (20120918) unstable; urgency=low - - * Add overclocking options - * Add command-line options for non-interactive use (James Hewitt) - - -- Alexander Bradbury Tue, 18 Sep 2012 12:02:13 +0100 - -raspi-config (20120815) unstable; urgency=low - - * Various updates, recognise 240M memory split - - -- Alex Bradbury Wed, 15 Aug 2012 23:10:03 +0000 - -raspi-config (20120715) unstable; urgency=low - - * Various updates - - -- Alex Bradbury Sun, 15 Jul 2012 19:47:39 +0100 - -raspi-config (20120617) unstable; urgency=low - - * Fix keyboard configuration, misc other enhancements - * See git log for full changelog - - -- Alex Bradbury Sun, 17 Jun 2012 19:36:20 +0100 - -raspi-config (20120610) unstable; urgency=low - - * Initial release - - -- Alex Bradbury Sun, 10 Jun 2012 15:59:17 +0000 + -- Brain Hackers Sat, 02 Jul 2022 23:13:50 +0900 diff --git a/debian/control b/debian/control index 2801b6e..326f90b 100644 --- a/debian/control +++ b/debian/control @@ -1,15 +1,14 @@ -Source: raspi-config +Source: brain-config Section: utils Priority: optional -Maintainer: Serge Schneider +Maintainer: Brain Hackers Build-Depends: debhelper (>= 8.0.0) Standards-Version: 4.3.0 -Vcs-Git: git://git@github.com:RPi-Distro/raspi-config.git -Vcs-Browser: https://github.com/RPi-Distro/raspi-config +Vcs-Git: git@github.com:brain-hackers/brain-config.git +Vcs-Browser: https://github.com/brain-hackers/brain-config -Package: raspi-config +Package: brain-config Architecture: all Depends: ${misc:Depends}, whiptail, parted, lua5.1, alsa-utils, psmisc, initramfs-tools Recommends: triggerhappy, iw -Description: Raspberry Pi configuration tool - A simple configuration tool for common Raspberry Pi administrative tasks +Description: SHARP Brain configuration tool diff --git a/debian/copyright b/debian/copyright index a323d7a..910d330 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,8 +1,8 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Source: https://github.com/RPi-Distro/raspi-config +Source: https://github.com/brain-hackers/brain-config Files: * -Copyright: 2012 Alex Bradbury +Copyright: 2022 Brain Hackers License: MIT License: MIT diff --git a/debian/raspi-config.install b/debian/raspi-config.install deleted file mode 100644 index 81e14cf..0000000 --- a/debian/raspi-config.install +++ /dev/null @@ -1,3 +0,0 @@ -raspi-config /usr/bin -usr/ -etc/ diff --git a/usr/lib/raspi-config/cmstart.sh b/usr/lib/brain-config/cmstart.sh similarity index 100% rename from usr/lib/raspi-config/cmstart.sh rename to usr/lib/brain-config/cmstart.sh diff --git a/usr/lib/raspi-config/init_resize.sh b/usr/lib/brain-config/init_resize.sh similarity index 93% rename from usr/lib/raspi-config/init_resize.sh rename to usr/lib/brain-config/init_resize.sh index 856824b..5b132eb 100755 --- a/usr/lib/raspi-config/init_resize.sh +++ b/usr/lib/brain-config/init_resize.sh @@ -1,6 +1,6 @@ #!/bin/sh -reboot_pi () { +reboot_brain () { umount /boot mount / -o remount,ro sync @@ -101,7 +101,7 @@ main () { fi if [ "$ROOT_PART_END" -eq "$TARGET_END" ]; then - reboot_pi + reboot_brain fi if ! parted -m "$ROOT_DEV" u s resizepart "$ROOT_PART_NUM" "$TARGET_END"; then @@ -122,7 +122,7 @@ mkdir -p /run/systemd mount /boot mount / -o remount,ro -sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' /boot/cmdline.txt +sed -i 's| init=/usr/lib/brain-config/init_resize\.sh||' /boot/cmdline.txt sed -i 's| sdhci\.debug_quirks2=4||' /boot/cmdline.txt if ! grep -q splash /boot/cmdline.txt; then @@ -132,15 +132,15 @@ mount /boot -o remount,ro sync if ! check_commands; then - reboot_pi + reboot_brain fi if main; then whiptail --infobox "Resized root filesystem. Rebooting in 5 seconds..." 20 60 sleep 5 else - whiptail --msgbox "Could not expand filesystem, please try raspi-config or rc_gui.\n${FAIL_REASON}" 20 60 + whiptail --msgbox "Could not expand filesystem, please try brain-config or rc_gui.\n${FAIL_REASON}" 20 60 sleep 5 fi -reboot_pi +reboot_brain diff --git a/usr/share/raspi-config/10-blanking.conf b/usr/share/brain-config/10-blanking.conf similarity index 100% rename from usr/share/raspi-config/10-blanking.conf rename to usr/share/brain-config/10-blanking.conf From fcbed7d6fa7712e8b36e9f1926990f802b242cec Mon Sep 17 00:00:00 2001 From: Takumi Sueda Date: Tue, 12 Jul 2022 02:16:00 +0900 Subject: [PATCH 4/5] Remove unused files --- etc/sudoers.d/010_proxy | 5 ----- usr/lib/brain-config/cmstart.sh | 6 ------ usr/share/brain-config/10-blanking.conf | 11 ----------- 3 files changed, 22 deletions(-) delete mode 100644 etc/sudoers.d/010_proxy delete mode 100755 usr/lib/brain-config/cmstart.sh delete mode 100644 usr/share/brain-config/10-blanking.conf diff --git a/etc/sudoers.d/010_proxy b/etc/sudoers.d/010_proxy deleted file mode 100644 index 3f980ed..0000000 --- a/etc/sudoers.d/010_proxy +++ /dev/null @@ -1,5 +0,0 @@ -Defaults env_keep += "http_proxy HTTP_PROXY" -Defaults env_keep += "https_proxy HTTPS_PROXY" -Defaults env_keep += "ftp_proxy FTP_PROXY" -Defaults env_keep += "RSYNC_PROXY" -Defaults env_keep += "no_proxy NO_PROXY" diff --git a/usr/lib/brain-config/cmstart.sh b/usr/lib/brain-config/cmstart.sh deleted file mode 100755 index 2904250..0000000 --- a/usr/lib/brain-config/cmstart.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -if raspi-config nonint is_kms ; then - if ps ax | grep -v grep | grep -q openbox ; then - exec xcompmgr -aR - fi -fi diff --git a/usr/share/brain-config/10-blanking.conf b/usr/share/brain-config/10-blanking.conf deleted file mode 100644 index 2c794af..0000000 --- a/usr/share/brain-config/10-blanking.conf +++ /dev/null @@ -1,11 +0,0 @@ -Section "Extensions" - Option "DPMS" "Disable" -EndSection - -Section "ServerLayout" - Identifier "ServerLayout0" - Option "StandbyTime" "0" - Option "SuspendTime" "0" - Option "OffTime" "0" - Option "BlankTime" "0" -EndSection From be4af19fb819bcde5aa0607c8065922f4bc7c99a Mon Sep 17 00:00:00 2001 From: Takumi Sueda Date: Sat, 16 Jul 2022 22:46:46 +0900 Subject: [PATCH 5/5] Build on GitHub Actions --- .gitchangelog.rc | 289 ++++++++++++++++++++++++++++++++++++ .github/archive_name.py | 9 ++ .github/workflows/build.yml | 80 ++++++++++ 3 files changed, 378 insertions(+) create mode 100644 .gitchangelog.rc create mode 100644 .github/archive_name.py create mode 100644 .github/workflows/build.yml diff --git a/.gitchangelog.rc b/.gitchangelog.rc new file mode 100644 index 0000000..b6bb051 --- /dev/null +++ b/.gitchangelog.rc @@ -0,0 +1,289 @@ +# -*- coding: utf-8; mode: python -*- +## +## Format +## +## ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...] +## +## Description +## +## ACTION is one of 'chg', 'fix', 'new' +## +## Is WHAT the change is about. +## +## 'chg' is for refactor, small improvement, cosmetic changes... +## 'fix' is for bug fixes +## 'new' is for new features, big improvement +## +## AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc' +## +## Is WHO is concerned by the change. +## +## 'dev' is for developpers (API changes, refactors...) +## 'usr' is for final users (UI changes) +## 'pkg' is for packagers (packaging changes) +## 'test' is for testers (test only related changes) +## 'doc' is for doc guys (doc only changes) +## +## COMMIT_MSG is ... well ... the commit message itself. +## +## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic' +## +## They are preceded with a '!' or a '@' (prefer the former, as the +## latter is wrongly interpreted in github.) Commonly used tags are: +## +## 'refactor' is obviously for refactoring code only +## 'minor' is for a very meaningless change (a typo, adding a comment) +## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...) +## 'wip' is for partial functionality but complete subfunctionality. +## +## Example: +## +## new: usr: support of bazaar implemented +## chg: re-indentend some lines !cosmetic +## new: dev: updated code to be compatible with last version of killer lib. +## fix: pkg: updated year of licence coverage. +## new: test: added a bunch of test around user usability of feature X. +## fix: typo in spelling my name in comment. !minor +## +## Please note that multi-line commit message are supported, and only the +## first line will be considered as the "summary" of the commit message. So +## tags, and other rules only applies to the summary. The body of the commit +## message will be displayed in the changelog without reformatting. + + +## +## ``ignore_regexps`` is a line of regexps +## +## Any commit having its full commit message matching any regexp listed here +## will be ignored and won't be reported in the changelog. +## +ignore_regexps = [ + r'@minor', r'!minor', + r'@cosmetic', r'!cosmetic', + r'@refactor', r'!refactor', + r'@wip', r'!wip', + r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:', + r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:', + r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$', + r'^$', ## ignore commits with empty messages +] + + +## ``section_regexps`` is a list of 2-tuples associating a string label and a +## list of regexp +## +## Commit messages will be classified in sections thanks to this. Section +## titles are the label, and a commit is classified under this section if any +## of the regexps associated is matching. +## +## Please note that ``section_regexps`` will only classify commits and won't +## make any changes to the contents. So you'll probably want to go check +## ``subject_process`` (or ``body_process``) to do some changes to the subject, +## whenever you are tweaking this variable. +## +section_regexps = [ + ('New', [ + r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + ('Changes', [ + r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + ('Fix', [ + r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + + ('Other', None ## Match all lines + ), + +] + + +## ``body_process`` is a callable +## +## This callable will be given the original body and result will +## be used in the changelog. +## +## Available constructs are: +## +## - any python callable that take one txt argument and return txt argument. +## +## - ReSub(pattern, replacement): will apply regexp substitution. +## +## - Indent(chars=" "): will indent the text with the prefix +## Please remember that template engines gets also to modify the text and +## will usually indent themselves the text if needed. +## +## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns +## +## - noop: do nothing +## +## - ucfirst: ensure the first letter is uppercase. +## (usually used in the ``subject_process`` pipeline) +## +## - final_dot: ensure text finishes with a dot +## (usually used in the ``subject_process`` pipeline) +## +## - strip: remove any spaces before or after the content of the string +## +## - SetIfEmpty(msg="No commit message."): will set the text to +## whatever given ``msg`` if the current text is empty. +## +## Additionally, you can `pipe` the provided filters, for instance: +#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ") +#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') +#body_process = noop +body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip + + +## ``subject_process`` is a callable +## +## This callable will be given the original subject and result will +## be used in the changelog. +## +## Available constructs are those listed in ``body_process`` doc. +subject_process = (strip | + ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') | + SetIfEmpty("No commit message.") | ucfirst | final_dot) + + +## ``tag_filter_regexp`` is a regexp +## +## Tags that will be used for the changelog must match this regexp. +## +tag_filter_regexp = r'^[0-9-]+$' + + +## ``unreleased_version_label`` is a string or a callable that outputs a string +## +## This label will be used as the changelog Title of the last set of changes +## between last valid tag and HEAD if any. +unreleased_version_label = "(unreleased)" + + +## ``output_engine`` is a callable +## +## This will change the output format of the generated changelog file +## +## Available choices are: +## +## - rest_py +## +## Legacy pure python engine, outputs ReSTructured text. +## This is the default. +## +## - mustache() +## +## Template name could be any of the available templates in +## ``templates/mustache/*.tpl``. +## Requires python package ``pystache``. +## Examples: +## - mustache("markdown") +## - mustache("restructuredtext") +## +## - makotemplate() +## +## Template name could be any of the available templates in +## ``templates/mako/*.tpl``. +## Requires python package ``mako``. +## Examples: +## - makotemplate("restructuredtext") +## +output_engine = rest_py +#output_engine = mustache("restructuredtext") +#output_engine = mustache("markdown") +#output_engine = makotemplate("restructuredtext") + + +## ``include_merge`` is a boolean +## +## This option tells git-log whether to include merge commits in the log. +## The default is to include them. +include_merge = True + + +## ``log_encoding`` is a string identifier +## +## This option tells gitchangelog what encoding is outputed by ``git log``. +## The default is to be clever about it: it checks ``git config`` for +## ``i18n.logOutputEncoding``, and if not found will default to git's own +## default: ``utf-8``. +#log_encoding = 'utf-8' + + +## ``publish`` is a callable +## +## Sets what ``gitchangelog`` should do with the output generated by +## the output engine. ``publish`` is a callable taking one argument +## that is an interator on lines from the output engine. +## +## Some helper callable are provided: +## +## Available choices are: +## +## - stdout +## +## Outputs directly to standard output +## (This is the default) +## +## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start()) +## +## Creates a callable that will parse given file for the given +## regex pattern and will insert the output in the file. +## ``idx`` is a callable that receive the matching object and +## must return a integer index point where to insert the +## the output in the file. Default is to return the position of +## the start of the matched string. +## +## - FileRegexSubst(file, pattern, replace, flags) +## +## Apply a replace inplace in the given file. Your regex pattern must +## take care of everything and might be more complex. Check the README +## for a complete copy-pastable example. +## +# publish = FileInsertIntoFirstRegexMatch( +# "CHANGELOG.rst", +# r'/(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/', +# idx=lambda m: m.start(1) +# ) +#publish = stdout + + +## ``revs`` is a list of callable or a list of string +## +## callable will be called to resolve as strings and allow dynamical +## computation of these. The result will be used as revisions for +## gitchangelog (as if directly stated on the command line). This allows +## to filter exaclty which commits will be read by gitchangelog. +## +## To get a full documentation on the format of these strings, please +## refer to the ``git rev-list`` arguments. There are many examples. +## +## Using callables is especially useful, for instance, if you +## are using gitchangelog to generate incrementally your changelog. +## +## Some helpers are provided, you can use them:: +## +## - FileFirstRegexMatch(file, pattern): will return a callable that will +## return the first string match for the given pattern in the given file. +## If you use named sub-patterns in your regex pattern, it'll output only +## the string matching the regex pattern named "rev". +## +## - Caret(rev): will return the rev prefixed by a "^", which is a +## way to remove the given revision and all its ancestor. +## +## Please note that if you provide a rev-list on the command line, it'll +## replace this value (which will then be ignored). +## +## If empty, then ``gitchangelog`` will act as it had to generate a full +## changelog. +## +## The default is to use all commits to make the changelog. +#revs = ["^1.0.3", ] +#revs = [ +# Caret( +# FileFirstRegexMatch( +# "CHANGELOG.rst", +# r"(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")), +# "HEAD" +#] +revs = [] diff --git a/.github/archive_name.py b/.github/archive_name.py new file mode 100644 index 0000000..ee31599 --- /dev/null +++ b/.github/archive_name.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +with open('./debian/brain-config/DEBIAN/control', 'r') as f: + for l in f.readlines(): + if l.startswith('Version:'): + print(f'brain-config_{l.replace("Version: ", "").rstrip()}_all.deb', end='') + break + else: + raise RuntimeError('Version line was not found') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dd07fe8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,80 @@ +name: Build + +on: + push: + branches: ci* + tags: '*' + +jobs: + create_release: + name: Create release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: false + - name: Generate release name + id: release_name + # https://github.community/t/how-to-get-just-the-tag-name/16241/4 + run: echo ::set-output name=name::${GITHUB_REF/refs\/*s\//} + - name: Generate the tag name for a branch build + if: ${{ startsWith(steps.release_name.outputs.name, 'ci-') }} + run: | + echo "RELEASE_TAG_NAME=${GITHUB_REF/refs\/*s\//}-tag" >> $GITHUB_ENV + - name: Generate the tag name for a branch build + if: ${{ !startsWith(steps.release_name.outputs.name, 'ci-') }} + run: | + echo "RELEASE_TAG_NAME=${GITHUB_REF/refs\/*s\//}" >> $GITHUB_ENV + - name: Generate changes file + uses: sarnold/gitchangelog-action@master + with: + config_file: .gitchangelog.rc + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + with: + body_path: CHANGES.md + draft: false + prerelease: true + name: ${{ steps.release_name.outputs.name }} + tag_name: ${{ env.RELEASE_TAG_NAME }} + + build-linux: + runs-on: ubuntu-20.04 + needs: [create_release] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Workaround for apt update failure + run: sudo rm /etc/apt/sources.list.d/github_git-lfs.* + - name: Prepare packaging & packagecloud CLI + run: | + sudo apt update + sudo apt install debhelper ruby-dev + sudo gem install package_cloud + - name: Build the Debian package + run: ./debian/rules build && sudo ./debian/rules binary + - name: Generate archive name + id: archive_name + run: echo ::set-output name=name::$(python .github/archive_name.py) + - name: Upload the package to GitHub + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ../${{ steps.archive_name.outputs.name }} + asset_name: ${{ steps.archive_name.outputs.name }} + asset_content_type: application/vnd.debian.binary-package + - name: Upload the package to packagecloud + env: + USERNAME: brainhackers + REPO: brainux/any/any + PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} + run: | + package_cloud push "${USERNAME}/${REPO}" "../${{steps.archive_name.outputs.name}}"