__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.217.92: ~ $
#!/bin/sh
# Part of raspi-config https://github.com/RPi-Distro/raspi-config
#
# See LICENSE file for copyright and license details
# shellcheck disable=SC2120

INTERACTIVE="${INTERACTIVE:-True}"
ASK_TO_REBOOT=0
BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf

if [ -e /boot/firmware/config.txt ] ; then
  FIRMWARE=/firmware
else
  FIRMWARE=
fi
CONFIG=/boot${FIRMWARE}/config.txt

USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')}
if [ -z "$USER" ] && [ -n "$HOME" ]; then
  USER=$(getent passwd | awk -F: "\$6 == \"$HOME\" {print \$1}")
fi
if [ -z "$USER" ] || [ "$USER" = "root" ]; then
  USER=$(getent passwd | awk -F: '$3 == "1000" {print $1}')
fi

INIT="$(ps --no-headers -o comm 1)"

HOMEDIR="$(getent passwd "$USER" | cut -d: -f6)"
LABWCENV_FILE="$HOMEDIR/.config/labwc/environment"
LABWCAST_FILE="$HOMEDIR/.config/labwc/autostart"

is_pi () {
  ARCH=$(dpkg --print-architecture)
  if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then
    return 0
  else
    return 1
  fi
}

is_64bit () {
  ARCH=$(dpkg --print-architecture)
  if [ "$ARCH" = "arm64" ] ; then
    return 0
  else
    return 1
  fi
}

if is_pi ; then
  if [ -e /proc/device-tree/chosen/os_prefix ]; then
    PREFIX="$(tr -d '\0' < /proc/device-tree/chosen/os_prefix)"
  fi
  CMDLINE="/boot${FIRMWARE}/${PREFIX}cmdline.txt"
else
  CMDLINE=/proc/cmdline
fi

# tests for Pi 1, 2, 0, CM4, CM5, 500 and x00 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 $?
}

is_cmfour() {
  # matches CM4 only, not CM4S
  grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]14[0-9a-fA-F]$" /proc/cpuinfo
  return $?
}

is_cmfive() {
  grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]1[8aA][0-9a-fA-F]$" /proc/cpuinfo
  return $?
}

is_pi500() {
  grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]19[0-9a-fA-F]$" /proc/cpuinfo
  return $?
}

is_pihundred() {
  grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]1[39][0-9a-fA-F]$" /proc/cpuinfo
  return $?
}

# ...while tests for Pi 3, 4 and 5 just test processor type, so will also find CM3, CM4, Zero 2, 500, 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 $?
}

is_pifive() {
  grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]4[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_pifive; then
    echo 5
  elif is_pizero; then
    echo 0
  else
    echo -1
  fi
}

gpu_has_mmu() {
  if is_pifour || is_pifive ; then
    return 0
  else
    return 1
  fi
}

is_live() {
  grep -q "boot=live" $CMDLINE
  return $?
}

is_ssh() {
  if pstree -p | grep -qE ".*sshd.*\($$\)"; then
    return 0
  else
    return 1
  fi
}

is_kms() {
    return 0
}

is_pulseaudio() {
  pgrep pulseaudio > /dev/null || pgrep pipewire-pulse > /dev/null
  return $?
}

is_labwc() {
  pgrep labwc > /dev/null
  return $?
}

is_wayland() {
  if is_labwc; then
    return 0
  else
    return 1
  fi
}

has_analog() {
  if [ $(get_leds) -eq -1 ] ; then
    return 0
  else
    return 1
  fi
}

has_composite_video() {
  if is_pihundred || is_cmfive; then
    return 1
  else
    return 0
  fi
}

has_nvme() {
  if is_pifive || is_cmfour; 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
}

get_installed() {
  if is_installed $1; then
    echo 1
  else
    echo 0
  fi
}

deb_ver () {
  ver=$(cut -d . -f 1 < /etc/debian_version)
  echo $ver
}

get_package_version() {
  dpkg-query --showformat='${Version}' --show "$1"
}

can_configure() {
  if [ ! -e /etc/init.d/lightdm ]; then
    return 1
  fi
  if ! is_pi; then
    return 0
  fi
  if [ ! -e /boot${FIRMWARE}/start_x.elf ]; then
    return 1
  fi
  if [ -e $CONFIG ] && grep -q "^device_tree=$" $CONFIG; then
    return 1
  fi
  if ! mountpoint -q /boot${FIRMWARE}; then
    return 1
  fi
  if [ ! -e $CONFIG ]; then
    touch $CONFIG
  fi
  return 0
}

calc_wt_size() {
  # NOTE: it's tempting to redirect stderr to /dev/null, so supress error
  # output from tput. However in this case, tput detects neither stdout or
  # stderr is a tty and so only gives default 80, 24 values
  WT_HEIGHT=18
  WT_WIDTH=$(tput cols)

  if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then
    WT_WIDTH=80
  fi
  if [ "$WT_WIDTH" -gt 178 ]; then
    WT_WIDTH=120
  fi
  WT_MENU_HEIGHT=$((WT_HEIGHT - 7))
}

do_about() {
  whiptail --msgbox "\
This tool provides a straightforward way of doing initial
configuration of the Raspberry Pi. 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)\
" 20 70 1
  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")"

  PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")"

  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
    whiptail --msgbox "$ROOT_PART is not the last partition. Don't know how to expand" 20 60 2
    return 0
  fi

  # Get the starting offset of the root partition
  PART_START=$(parted "$ROOT_DEV" -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g')
  [ "$PART_START" ] || return 1
  # Return value will likely be error for fdisk as it fails to reload the
  # partition table because the root fs is mounted
  fdisk "$ROOT_DEV" <<EOF
p
d
$PART_NUM
n
p
$PART_NUM
$PART_START

p
w
EOF
  ASK_TO_REBOOT=1

  # now set up an init.d script
cat <<EOF > /etc/init.d/resize2fs_once &&
#!/bin/sh
### BEGIN INIT INFO
# Provides:          resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 3
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO

. /lib/lsb/init-functions

case "\$1" in
  start)
    log_daemon_msg "Starting resize2fs_once" &&
    resize2fs "$ROOT_PART" &&
    update-rc.d resize2fs_once remove &&
    rm /etc/init.d/resize2fs_once &&
    log_end_msg \$?
    ;;
  *)
    echo "Usage: \$0 start" >&2
    exit 3
    ;;
esac
EOF
  chmod +x /etc/init.d/resize2fs_once &&
  update-rc.d resize2fs_once defaults &&
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Root partition has been resized.\nThe filesystem will be enlarged upon the next reboot" 20 60 2
  fi
}

set_config_var() {
  awk -v key="$1" -v value="$2" '
    $0 ~ "^#?[[:space:]]*" key "=" {
      print key "=" value
      made_change=1
      next
    }
    { print }
    END { if (!made_change) print key "=" value }
  ' "$3" > "$3.bak" && mv "$3.bak" "$3"
}

clear_config_var() {
  sed -i "s/^\([[:space:]]*$1=\)/#\1/" "$2"
}

get_config_var() {
  awk -v key="$1" '
    $0 ~ "^[[:space:]]*" key "=" {
      sub("^[[:space:]]*" key "=", "")
      print
      found=1
      exit
    }
    END { if (!found) print 0 }
  ' "$2"
}

ensure_user_conf_dir() {
  if [ ! -d "$HOMEDIR/.config" ]; then
    install -d -o "$USER" -g "$USER" "$HOMEDIR/.config"
  fi
}

get_overscan() {
  OVS=$(get_config_var disable_overscan $CONFIG)
  if [ $OVS -eq 1 ]; then
    echo 1
  else
    echo 0
  fi
}

do_overscan() {
  DEFAULT=--defaultno
  CURRENT=0
  if [ $(get_overscan) -eq 0 ]; then
    DEFAULT=
    CURRENT=1
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable compensation for displays with overscan?" $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ $RET -eq $CURRENT ]; then
    ASK_TO_REBOOT=1
  fi
  if [ $RET -eq 0 ] ; then
    set_config_var disable_overscan 0 $CONFIG
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    sed $CONFIG -i -e "s/^overscan_/#overscan_/"
    set_config_var disable_overscan 1 $CONFIG
    STATUS=disabled
  else
    return $RET
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Display overscan compensation is $STATUS" 20 60 1
  fi
}

get_overscan_kms() {
  RES=$(grep "HDMI-$1" /usr/share/ovscsetup.sh 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 ! pgrep mutter > /dev/null ; 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" > /usr/share/ovscsetup.sh
    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
  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 is_labwc; then
    if [ -e $LABWCAST_FILE ] && grep -q swayidle $LABWCAST_FILE ; then
      echo 0
    else
      echo 1
    fi
  else
    if ! [ -f "/etc/X11/xorg.conf.d/10-blanking.conf" ]; then
      echo 0
    else
      echo 1
    fi
  fi
}

do_blanking() {
  DEFAULT=--defaultno
  CURRENT=0
  if [ "$(get_blanking)" -eq 0 ]; then
    DEFAULT=
    CURRENT=1
  fi
  if is_labwc; then
    if [ "$INTERACTIVE" = True ]; then
      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
    ensure_user_conf_dir
    mkdir -p "$HOMEDIR/.config/labwc/"
    chown -R $USER:$USER "$HOMEDIR/.config/labwc/"
    if [ "$RET" -eq 0 ] ; then
      echo "swayidle -w timeout 600 'wlopm --off \\*' resume 'wlopm --on \\*' &" >> $LABWCAST_FILE
      chown $USER:$USER $LABWCAST_FILE
      echo "swayidle -w timeout 600 'wlopm --off \\*' resume 'wlopm --on \\*' &" >> /etc/xdg/labwc-greeter/autostart
      STATUS=enabled
    elif [ "$RET" -eq 1 ]; then
      if [ -e $LABWCAST_FILE ] ; then
        sed -i '/swayidle/d' $LABWCAST_FILE
      fi
      if [ -e /etc/xdg/labwc-greeter/autostart ] ; then
        sed -i '/swayidle/d' /etc/xdg/labwc-greeter/autostart
      fi
      STATUS=disabled
    else
      return "$RET"
    fi
  else
    if [ "$INTERACTIVE" = True ]; then
      if [ "$(dpkg -l xscreensaver | tail -n 1 | cut -d ' ' -f 1)" = "ii" ]; then
        whiptail --msgbox "Warning: xscreensaver is installed and 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
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Screen blanking 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
}

update_labwc_keyboard() {
  MODEL=$(grep XKBMODEL /etc/default/keyboard | cut -d= -f2 | tr -d '"')
  LAYOUT=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"')
  VARIANT=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"')
  OPTIONS=$(grep XKBOPTIONS /etc/default/keyboard | cut -d= -f2 | tr -d '"')
  UFILE=$LABWCENV_FILE
  ensure_user_conf_dir
  mkdir -p "$HOMEDIR/.config/labwc/"
  chown -R $USER:$USER "$HOMEDIR/.config/labwc/"
  if [ -e $UFILE ] ; then
    if grep -q XKB_DEFAULT_MODEL $UFILE ; then sed -i s/XKB_DEFAULT_MODEL.*/XKB_DEFAULT_MODEL=$MODEL/ $UFILE ; else echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE ; fi
    if grep -q XKB_DEFAULT_LAYOUT $UFILE ; then sed -i s/XKB_DEFAULT_LAYOUT.*/XKB_DEFAULT_LAYOUT=$LAYOUT/ $UFILE ; else echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE ; fi
    if grep -q XKB_DEFAULT_VARIANT $UFILE ; then sed -i s/XKB_DEFAULT_VARIANT.*/XKB_DEFAULT_VARIANT=$VARIANT/ $UFILE ; else echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE ; fi
    if grep -q XKB_DEFAULT_OPTIONS $UFILE ; then sed -i s/XKB_DEFAULT_OPTIONS.*/XKB_DEFAULT_OPTIONS=$OPTIONS/ $UFILE ; else echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE ; fi
  else
    echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE
    echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE
    echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE
    echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE
  fi
  chown $USER:$USER $UFILE
  UFILE="/etc/xdg/labwc-greeter/environment"
  if [ ! -e $UFILE ] ; then
    UFILE="/usr/share/labwc/environment"
  fi
  if [ -e $UFILE ] ; then
    if grep -q XKB_DEFAULT_MODEL $UFILE ; then sed -i s/XKB_DEFAULT_MODEL.*/XKB_DEFAULT_MODEL=$MODEL/ $UFILE ; else echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE ; fi
    if grep -q XKB_DEFAULT_LAYOUT $UFILE ; then sed -i s/XKB_DEFAULT_LAYOUT.*/XKB_DEFAULT_LAYOUT=$LAYOUT/ $UFILE ; else echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE ; fi
    if grep -q XKB_DEFAULT_VARIANT $UFILE ; then sed -i s/XKB_DEFAULT_VARIANT.*/XKB_DEFAULT_VARIANT=$VARIANT/ $UFILE ; else echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE ; fi
    if grep -q XKB_DEFAULT_OPTIONS $UFILE ; then sed -i s/XKB_DEFAULT_OPTIONS.*/XKB_DEFAULT_OPTIONS=$OPTIONS/ $UFILE ; else echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE ; fi
  fi
  if is_labwc ; then
    kill -HUP `pgrep -x labwc`  # does the equivalent of labwc --reconfigure, but works as sudo...
  fi
}

update_squeekboard() {
  PREFIX=""
  if [ -n "$SUDO_USER" ] ; then
    PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
  fi
  LAYOUT1=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f1)
  VARIANT1=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f1)
  LAYOUT2=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f2 -s)
  VARIANT2=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f2 -s)
  GSET="[('xkb', '$LAYOUT1"
  if [ -z "$VARIANT1" ] ; then
    GSET=$GSET"')"
  else
    GSET=$GSET"+$VARIANT1')"
  fi
  if ! [ -z "$LAYOUT2" ] ; then
    GSET=$GSET", ('xkb', '$LAYOUT2"
    if [ -z "$VARIANT2" ] ; then
      GSET=$GSET"')"
    else
      GSET=$GSET"+$VARIANT2')"
    fi
  fi
  GSET=$GSET"]"
  if ! [ -e /etc/dconf/profile/user ] ; then
    mkdir -p "/etc/dconf/profile/"
    echo "user-db:user\nsystem-db:local" >> /etc/dconf/profile/user
  fi
  FILE=/etc/dconf/db/local.d/00_keyboard
  if [ -e $FILE ] ; then
    if grep -q "^sources" $FILE ; then
      sed $FILE -i -e "s/^sources=.*/sources=$GSET/"
    else
      if grep -q "\[org/gnome/desktop/input-sources\]" $FILE ; then
        sed $FILE -i -e "s#\[org/gnome/desktop/input-sources\]#\[org/gnome/desktop/input-sources\]\nsources=$GSET#" 
      else
        echo "[org/gnome/desktop/input-sources]\nsources=$GSET" >> $FILE
      fi
    fi
  else
    mkdir -p "/etc/dconf/db/local.d/"
    echo "[org/gnome/desktop/input-sources]\nsources=$GSET" > $FILE
  fi
  dconf update
  if [ "$1" = restart ] ; then
    if pgrep squeekboard > /dev/null ; then
      pkill squeekboard
      $PREFIX squeekboard > /dev/null 2> /dev/null &
    fi
  fi
}

do_configure_keyboard() {
  printf "Reloading keymap. This may take a short while\n"
  rm -f /etc/console-setup/cached_*
  if [ "$INTERACTIVE" = True ]; then
    dpkg-reconfigure keyboard-configuration
  else
    KEYMAP="$1"
    sed -i /etc/default/keyboard -e "s/^XKBLAYOUT.*/XKBLAYOUT=\"$KEYMAP\"/"
    dpkg-reconfigure -f noninteractive keyboard-configuration
  fi
  update_labwc_keyboard
  update_squeekboard restart
  if [ "$INIT" = "systemd" ]; then
    systemctl restart keyboard-setup
  fi
  setsid sh -c 'exec setupcon --save -k --force <> /dev/tty1 >&0 2>&1'
  udevadm trigger --subsystem-match=input --action=change
  return 0
}

do_change_keyboard_rc_gui () {
  grep -q XKBMODEL /etc/default/keyboard && sed -i "s/XKBMODEL=.*/XKBMODEL=\"$1\"/g" /etc/default/keyboard || echo "XKBMODEL=\"$1\"" >> /etc/default/keyboard
  grep -q XKBLAYOUT /etc/default/keyboard && sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"$2\"/g" /etc/default/keyboard || echo "XKBLAYOUT=\"$2\"" >> /etc/default/keyboard
  grep -q XKBVARIANT /etc/default/keyboard && sed -i "s/XKBVARIANT=.*/XKBVARIANT=\"$3\"/g" /etc/default/keyboard || echo "XKBVARIANT=\"$3\"" >> /etc/default/keyboard
  grep -q XKBOPTIONS /etc/default/keyboard && sed -i "s/XKBOPTIONS=.*/XKBOPTIONS=\"$4\"/g" /etc/default/keyboard || echo "XKBOPTIONS=\"$4\"" >> /etc/default/keyboard
  update_labwc_keyboard
  update_squeekboard restart
  if ! is_wayland ; then
    invoke-rc.d keyboard-setup start
  fi
  setsid sh -c 'exec setupcon -k --force <> /dev/tty1 >&0 2>&1'
  if ! is_wayland ; then
    udevadm trigger --subsystem-match=input --action=change
    udevadm settle
    KBSTR="-model $1 -layout $2"
    if [ -n "$3" ] ; then
      KBSTR="$KBSTR -variant $3"
    fi
    if [ -n "$4" ] ; then
      KBSTR="$KBSTR -option -option $4"
    fi
    setxkbmap "$KBSTR"
  fi
}

do_change_locale() {
  if [ "$INTERACTIVE" = True ]; then
    dpkg-reconfigure locales
  else
    if ! LOCALE_LINE="$(grep -E "^$1( |$)" /usr/share/i18n/SUPPORTED)"; then
      return 1
    fi
    export LC_ALL=C
    export LANG=C
    LG="/etc/locale.gen"
    NEW_LANG="$(echo $LOCALE_LINE | cut -f1 -d " ")"
    [ -L "$LG" ] && [ "$(readlink $LG)" = "/usr/share/i18n/SUPPORTED" ] && rm -f "$LG"
    echo "$LOCALE_LINE" > /etc/locale.gen
    update-locale --no-checks LANG
    update-locale --no-checks "LANG=$NEW_LANG"
    dpkg-reconfigure -f noninteractive locales
  fi
}

do_change_locale_rc_gui() {
  sed -i "s/^\([^#].*\)/# \1/g" /etc/locale.gen
  if grep -q "$1 " /etc/locale.gen ; then
    LOC="$1"
  else
    LOC="$1.UTF-8"
  fi
  sed -i "s/^# \($LOC\s\)/\1/g" /etc/locale.gen
  locale-gen
  LC_ALL=$LOC LANG=$LOC LANGUAGE=$LOC update-locale LANG=$LOC LC_ALL=$LOC LANGUAGE=$LOC
}

do_change_timezone() {
  if [ "$INTERACTIVE" = True ]; then
    dpkg-reconfigure tzdata
  else
    TIMEZONE="$1"
    if [ ! -f "/usr/share/zoneinfo/$TIMEZONE" ]; then
      return 1;
    fi
    rm /etc/localtime
    echo "$TIMEZONE" > /etc/timezone
    dpkg-reconfigure -f noninteractive tzdata 2> /dev/null
  fi
}

do_change_timezone_rc_gui() {
  echo $1 | tee /etc/timezone
  rm /etc/localtime
  dpkg-reconfigure --frontend noninteractive tzdata
}

get_wifi_country() {
  CODE=${1:-0}
  if is_installed crda && [ -e /etc/default/crda ]; then
    . /etc/default/crda
  elif grep -q "cfg80211.ieee80211_regdom=" "$CMDLINE"; then
    REGDOMAIN="$(sed -n 's/.*cfg80211.ieee80211_regdom=\(\S*\).*/\1/p' "$CMDLINE")"
  elif systemctl -q is-active dhcpcd; then
    REGDOMAIN="$(wpa_cli get country | tail -n 1)"
  else
    REGDOMAIN="$(iw reg get | sed -n "0,/country/s/^country \(.\+\):.*$/\1/p")"
  fi
  if [ -z "$REGDOMAIN" ] \
     || ! grep -q "^${REGDOMAIN}[[:space:]]" /usr/share/zoneinfo/iso3166.tab; then
    return 1
  fi
  if [ "$CODE" = 0 ]; then
    echo "$REGDOMAIN"
  fi
  return 0
}

do_wifi_country() {
  if [ "$INTERACTIVE" = True ]; then
    value=$(hexdump -C /lib/firmware/regulatory.db | grep -oE '[A-Z]{2}' | sort -u | sed 's/^/^/;s/$/\t/' | grep -f- /usr/share/zoneinfo/iso3166.tab | tr '\t\n' '/')
    oIFS="$IFS"
    IFS="/"
    #shellcheck disable=2086
    REGDOMAIN=$(whiptail --menu "Select the country in which the Pi is to be used" 20 60 10 ${value} 3>&1 1>&2 2>&3)
    IFS="$oIFS"
  else
    REGDOMAIN=$1
  fi
  if ! grep -q "^${REGDOMAIN}[[:space:]]" /usr/share/zoneinfo/iso3166.tab; then
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "$REGDOMAIN is not a valid ISO/IEC 3166-1 alpha2 code" 20 60
    fi
    return 1
  fi
  sed -i \
    -e "s/\s*cfg80211.ieee80211_regdom=\S*//" \
    -e "s/\(.*\)/\1 cfg80211.ieee80211_regdom=$REGDOMAIN/" \
    "$CMDLINE"
  if is_installed crda && [ -e /etc/default/crda ]; then
    # This mechanism has been removed from Bookworm and should no longer be used
    rm -f /etc/default/crda
  fi
  if ! ischroot; then
    iw reg set "$REGDOMAIN"
  fi

  IFACE="$(list_wlan_interfaces | head -n 1)"
  if [ "$INIT" = "systemd" ] && [ -n "$IFACE" ] && systemctl -q is-active dhcpcd; then
    wpa_cli -i "$IFACE" set country "$REGDOMAIN" > /dev/null 2>&1
    wpa_cli -i "$IFACE" save_config > /dev/null 2>&1
  fi

  if [ "$INIT" = "systemd" ] && ! ischroot && systemctl -q is-active NetworkManager; then
    nmcli radio wifi on
  elif hash rfkill 2> /dev/null; then
    rfkill unblock wifi
    if [ -f /var/lib/NetworkManager/NetworkManager.state ]; then
      sed -i 's/^WirelessEnabled=.*/WirelessEnabled=true/' /var/lib/NetworkManager/NetworkManager.state
    fi
  fi
  if is_pi; then
    for filename in /var/lib/systemd/rfkill/*:wlan ; do
      if ! [ -e "$filename" ]; then
        continue
      fi
      echo 0 > "$filename"
    done
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Wireless LAN country set to $REGDOMAIN" 20 60 1
  fi
  if ! ischroot; then
    if pgrep -x wf-panel-pi > /dev/null; then
      wfpanelctl netman cset
    elif pgrep -x lxpanel-pi > /dev/null; then
      lxpanelctl-pi command netman cset
    elif pgrep -x lxpanel > /dev/null; then
      lxpanelctl command netman cset
    fi
  fi
}

get_hostname() {
  HOSTNAME_FILE="${MOCK_HOSTNAME_FILE:-/etc/hostname}"
  # skip comments and empty lines, return first valid hostname with whitespace stripped
  grep -v '^[[:space:]]*\(#\|$\)' "$HOSTNAME_FILE" | head -n1 | xargs
}

do_hostname() {
  HOSTNAME_FILE="${MOCK_HOSTNAME_FILE:-/etc/hostname}"
  HOSTS_FILE="${MOCK_HOSTS_FILE:-/etc/hosts}"

  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "\
Please note: RFCs mandate that a hostname's labels \
may contain only the ASCII letters 'a' through 'z' (case-insensitive),
the digits '0' through '9', and the hyphen.
Hostname labels cannot begin or end with a hyphen.
No other symbols, punctuation characters, or blank spaces are permitted.\
" 20 70 1
  fi
  CURRENT_HOSTNAME=$(get_hostname)
  if [ "$INTERACTIVE" = True ]; then
    NEW_HOSTNAME=$(whiptail --inputbox "Please enter a hostname" 20 60 "$CURRENT_HOSTNAME" 3>&1 1>&2 2>&3)
    RET=$?
  else
    NEW_HOSTNAME="$1"
    RET=0
  fi
  if [ $RET -eq 0 ]; then
    if [ "$INIT" != "systemd" ] || \
       ! systemctl -q is-active dbus || \
       ischroot || \
       ! hostnamectl hostname "$NEW_HOSTNAME" 2> /dev/null; then
      echo "$NEW_HOSTNAME" > "$HOSTNAME_FILE"
    fi
    if [ -f "$HOSTS_FILE" ]; then
      sed -i "s/^[[:space:]]*127\.0\.1\.1[[:space:]].*/127.0.1.1\t$NEW_HOSTNAME/" "$HOSTS_FILE"
    fi
    if [ "$CURRENT_HOSTNAME" != "$NEW_HOSTNAME" ]; then
      ASK_TO_REBOOT=1
    fi
  fi
}

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 systemctl -q is-enabled ssh; then
    echo 0
  else
    echo 1
  fi
}

do_ssh() {
  DEFAULT=--defaultno
  if [ "$(get_ssh)" -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno \
      "Would you like the SSH server to be enabled?\n\nCaution: Default and weak passwords are a security risk when SSH is enabled!" \
      $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ "$RET" -eq 0 ]; then
    ssh-keygen -A &&
    update-rc.d ssh enable &&
    invoke-rc.d ssh start &&
    STATUS=enabled
  elif [ "$RET" -eq 1 ]; then
    update-rc.d ssh disable &&
    invoke-rc.d ssh stop &&
    STATUS=disabled
  else
    return "$RET"
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "The SSH server is $STATUS" 20 60 1
  fi
}

get_vnc() {
  if is_wayland; then
    if systemctl status wayvnc.service | grep -q -w active; then
      echo 0
    else
      echo 1
    fi
  else
    if systemctl status vncserver-x11-serviced.service | grep -q -w active; then
      echo 0
    else
      echo 1
    fi
  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 wayvnc; then
      wayvnc_version="$(get_package_version wayvnc)"
      if dpkg --compare-versions "$wayvnc_version" lt 0.8; then
        whiptail --msgbox "WayVNC version 0.8 or greater is required (have $wayvnc_version)" 20 60 1
        return 1
      fi

      systemctl stop wayvnc.service

      # In case wayvnc is already running via older xdg-autostart machanism
      if [ -e /etc/xdg/autostart/wayvnc.desktop ] ; then
        rm /etc/xdg/autostart/wayvnc.desktop
      fi
    fi
    if is_installed realvnc-vnc-server; then
      systemctl disable vncserver-x11-serviced.service
      systemctl stop vncserver-x11-serviced.service
    fi
    if is_wayland; then
      if is_installed wayvnc; then
        systemctl enable wayvnc.service &&
        systemctl start wayvnc.service &&
        STATUS=enabled
      else
        return 1
      fi
    else
      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
    fi
  elif [ $RET -eq 1 ]; then
    if is_installed wayvnc; then
      systemctl disable wayvnc.service
      systemctl stop wayvnc.service
    fi
    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_rpi_connect() {
  PREFIX=""
  if [ -n "$SUDO_USER" ] ; then
    PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
  fi
  if $PREFIX systemctl --user -q status rpi-connect.service | grep -q -w active; then
    echo 0
  else
    echo 1
  fi
}

do_rpi_connect() {
  PREFIX=""
  if [ -n "$SUDO_USER" ] ; then
    PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
  fi
  APT_GET_FLAGS=""
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable screen sharing over Raspberry Pi Connect?" --defaultno 20 60 2
    RET=$?
  else
    APT_GET_FLAGS="-y"
    RET=$1
  fi
  rpi_connect_version="$(get_package_version rpi-connect)"
  if [ $RET -eq 0 ]; then
    if is_installed rpi-connect || apt-get install "$APT_GET_FLAGS" rpi-connect; then
      if dpkg --compare-versions "$rpi_connect_version" lt 1.3; then
        $PREFIX systemctl --user -q enable rpi-connect.service rpi-connect-wayvnc.service
        $PREFIX systemctl --user -q start rpi-connect.service rpi-connect-wayvnc.service
      elif dpkg --compare-versions "$rpi_connect_version" lt 2.0; then
        $PREFIX systemctl --user -q enable rpi-connect.service rpi-connect-wayvnc.service rpi-connect-wayvnc-watcher.path
        $PREFIX systemctl --user -q start rpi-connect.service
      else
        $PREFIX rpi-connect on > /dev/null 2>&1
      fi
      STATUS="Screen sharing via Raspberry Pi Connect is enabled"
    else
      return 1
    fi
  elif [ $RET -eq 1 ]; then
    if [ "$INTERACTIVE" = True ]; then
      whiptail --yesno "Would you like to enable remote shell access over Raspberry Pi Connect?" --defaultno 20 60 2
      RET=$?
    fi
    if [ $RET -eq 0 ]; then
      if is_installed rpi-connect || is_installed rpi-connect-lite || apt-get install "$APT_GET_FLAGS" rpi-connect-lite; then
        if dpkg --compare-versions "$rpi_connect_version" lt 2.0; then
          $PREFIX systemctl --user -q enable rpi-connect.service
          $PREFIX systemctl --user -q start rpi-connect.service
        else
          $PREFIX rpi-connect on > /dev/null 2>&1
        fi
        STATUS="Remote shell access via Raspberry Pi Connect is enabled"
      else
        return 1
      fi
    elif [ $RET -eq 1 ]; then
      if dpkg --compare-versions "$rpi_connect_version" lt 1.3; then
        $PREFIX systemctl --user -q stop rpi-connect.service rpi-connect-wayvnc.service
        $PREFIX systemctl --user -q disable rpi-connect-wayvnc.service rpi-connect.service
      elif dpkg --compare-versions "$rpi_connect_version" lt 2.0; then
        $PREFIX systemctl --user -q stop rpi-connect.service
        $PREFIX systemctl --user -q disable rpi-connect.service rpi-connect-wayvnc.service rpi-connect-wayvnc-watcher.path
      else
        $PREFIX rpi-connect off > /dev/null 2>&1
      fi
      STATUS="Raspberry Pi Connect is disabled"
    else
      return $RET
    fi
  else
    return $RET
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "$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_cons() {
  if grep -q -E "console=(serial0|ttyAMA0|ttyS0)" $CMDLINE ; then
    echo 0
  else
    echo 1
  fi
}

get_serial_hw() {
  if is_pifive ; then
    if grep -q -E "dtparam=uart0=off" $CONFIG ; then
      echo 1
    elif grep -q -E "dtparam=uart0" $CONFIG ; then
      echo 0
    else
      echo 1
    fi
  else
    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
  fi
}

do_serial_cons() {
  if [ $1 -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
  else
    sed -i $CMDLINE -e "s/console=ttyAMA0,[0-9]\+ //"
    sed -i $CMDLINE -e "s/console=serial0,[0-9]\+ //"
  fi
}

do_serial_hw() {
  if [ $1 -eq 0 ] ; then
    if is_pifive ; then
      set_config_var dtparam=uart0 on $CONFIG
    else
      set_config_var enable_uart 1 $CONFIG
    fi
  else
    if is_pifive ; then
      sed $CONFIG -i -e "/dtparam=uart0.*/d"
    else
      set_config_var enable_uart 0 $CONFIG
    fi
  fi
}

do_serial() {
  DEFAULTS=--defaultno
  DEFAULTH=--defaultno
  CURRENTS=0
  CURRENTH=0
  if [ $(get_serial_cons) -eq 0 ]; then
    DEFAULTS=
    CURRENTS=1
  fi
  if [ $(get_serial_hw) -eq 0 ]; then
    DEFAULTH=
    CURRENTH=1
  fi
  whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULTS 20 60 2
  RET=$?
  if [ $RET -eq $CURRENTS ]; then
    ASK_TO_REBOOT=1
  fi
  if [ $RET -eq 0 ]; then
    do_serial_cons 0
    SSTATUS=enabled
    do_serial_hw 0
    HSTATUS=enabled
  elif [ $RET -eq 1 ]; then
    do_serial_cons 1
    SSTATUS=disabled
    whiptail --yesno "Would you like the serial port hardware to be enabled?" $DEFAULTH 20 60 2
    RET=$?
    if [ $RET -eq $CURRENTH ]; then
      ASK_TO_REBOOT=1
    fi
    if [ $RET -eq 0 ]; then
      do_serial_hw 0
      HSTATUS=enabled
    elif [ $RET -eq 1 ]; then
      do_serial_hw 1
      HSTATUS=disabled
    else
      return $RET
    fi
  else
    return $RET
  fi
  whiptail --msgbox "The serial login shell is $SSTATUS\nThe serial interface is $HSTATUS" 20 60 1
}

do_serial_pi5() {
  DEFAULTS=--defaultno
  DEFAULTH=--defaultno
  CURRENTS=0
  CURRENTH=0
  if [ $(get_serial_cons) -eq 0 ]; then
    DEFAULTS=
    CURRENTS=1
  fi
  if [ $(get_serial_hw) -eq 0 ]; then
    DEFAULTH=
    CURRENTH=1
  fi
  whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULTS 20 60 2
  RET=$?
  if [ $RET -eq $CURRENTS ]; then
    ASK_TO_REBOOT=1
  fi
  if [ $RET -eq 0 ]; then
    do_serial_cons 0
    SSTATUS=enabled
  elif [ $RET -eq 1 ]; then
    do_serial_cons 1
    SSTATUS=disabled
  else
    return $RET
  fi
  whiptail --yesno "Would you like the serial port hardware to be enabled?" $DEFAULTH 20 60 2
  RET=$?
  if [ $RET -eq $CURRENTH ]; then
    ASK_TO_REBOOT=1
  fi
  if [ $RET -eq 0 ]; then
    do_serial_hw 0
    HSTATUS=enabled
  elif [ $RET -eq 1 ]; then
    do_serial_hw 1
    HSTATUS=disabled
  else
    return $RET
  fi
  whiptail --msgbox "The serial login shell is $SSTATUS\nThe serial interface is $HSTATUS" 20 60 1
}

get_pci() {
  if grep -q -E "^dtparam=pciex1_gen=3$" $CONFIG; then
    echo 0
  else
    echo 1
  fi
}

do_pci() {
  DEFAULT=--defaultno
  CURRENT=1
  if [ $(get_pci) -eq 0 ]; then
    DEFAULT=
    CURRENT=0
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like PCIe Gen 3 to be enabled?" $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ $RET -eq 0 ]; then
    set_config_var dtparam=pciex1_gen 3 $CONFIG
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    clear_config_var dtparam=pciex1_gen $CONFIG
    STATUS=disabled
  else
    return $RET
  fi
  if [ $RET -ne $CURRENT ]; then
    ASK_TO_REBOOT=1
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "PCIe Gen 3 is $STATUS" 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
    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
    fi
    telinit q
  fi
}

get_boot_cli() {
  if [ "$(basename $(readlink -f /etc/systemd/system/default.target))" = 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_autologin_cli() {
  if [ -e /etc/systemd/system/getty@tty1.service.d/autologin.conf ] ; then
    echo 0
  else
    echo 1
  fi
}

get_autologin_desktop() {
  if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then
    echo 0
  else
    echo 1
  fi
}

get_pi4video () {
  if grep -q "^hdmi_enable_4kp60=1" $CONFIG ; then
    echo 0
  else
    echo 1
  fi
}

do_pi4video() {
  CURRENT=$(get_pi4video)
  DEFAULT=--defaultno
  if [ $CURRENT -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable 4Kp60 output on HDMI0?" $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ $RET -eq 0 ]; then
    sed $CONFIG -i -e "s/^#\?hdmi_enable_4kp60=.*/hdmi_enable_4kp60=1/"
    if ! grep -q "hdmi_enable_4kp60" $CONFIG ; then
      sed $CONFIG -i -e "\$ahdmi_enable_4kp60=1"
    fi
    sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/"
    sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/"
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    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=disabled
  else
    return $RET
  fi
  if [ $RET -ne $CURRENT ]; then
    ASK_TO_REBOOT=1
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "4Kp60 is $STATUS" 20 60 1
  fi
}

get_composite() {
  if grep -q "^dtoverlay=vc4-kms-v3d,composite" $CONFIG ; then
    echo 0
  else
    echo 1
  fi
}

do_composite() {
  if ! has_composite_video; then
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "This model of Raspberry Pi doesn't have composite video output" 20 60 1
    fi
    return 1
  fi
  CURRENT=$(get_composite)
  DEFAULT=--defaultno
  if [ $CURRENT -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    if is_pifive; then
      QUESTION="Would you like composite video output to be enabled?"
    else
      QUESTION="Would you like composite video output to be enabled? Warning - this will disable the HDMI outputs."
    fi
    whiptail --yesno "$QUESTION" $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/"
    sed $CONFIG -i -e "s/^#\?enable_tvout=.*/enable_tvout=1/"
    sed $CONFIG -i -e "s/^hdmi_enable_4kp60=/#hdmi_enable_4kp60=/"
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/"
    sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/"
    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 [ ! -e /sys/class/leds/ACT/trigger ] ; then
    echo -1
  elif grep -q "\\[actpwr\\]" /sys/class/leds/ACT/trigger ; then
    echo 0
  elif grep -q "\\[default-on\\]" /sys/class/leds/ACT/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/ACT/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() {
  if is_pihundred; then
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "This model of Raspberry Pi doesn't have a GPIO case fan" 20 60 1
    fi
    return 1
  fi
  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 [ $? -ne 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 Celsius 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 [ $? -ne 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 Celsius" 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
}

get_browser() {
  echo $(LC_ALL=C update-alternatives --display x-www-browser | grep currently | cut -d " " -f 7 | cut -d / -f 4)
}

do_browser() {
  if [ "$INTERACTIVE" = True ]; then
    RES=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select Browser" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "1" "Chromium" \
      "2" "Firefox" \
      3>&1 1>&2 2>&3)
  else
    RES=""
    BROWSER=$1
    true
  fi
  if [ $? -eq 0 ]; then
    if [ "$RES" = "1" ] ; then
      BROWSER="chromium"
      BSTRING="Chromium"
    elif [ "$RES" = "2" ] ; then
      BROWSER="firefox"
      BSTRING="Firefox"
    fi
    update-alternatives --set x-www-browser /usr/bin/$BROWSER > /dev/null
    if [ -z $2 ] ; then
      sudo -u $USER xdg-settings set default-web-browser $BROWSER.desktop
    else
      sudo -u $2 xdg-settings set default-web-browser $BROWSER.desktop
    fi
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "Default browser set to $BSTRING" 20 60 1
    fi
  fi
}

do_journald_storage() {
  if [ "$INTERACTIVE" = True ]; then
    RES=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select Log Location" "$WT_HEIGHT" "$WT_WIDTH" "$WT_MENU_HEIGHT" \
      "1" "Default" \
      "2" "Volatile" \
      "3" "Persistent" \
      "4" "Auto" \
      "5" "None" \
      3>&1 1>&2 2>&3)
  else
    RES=""
    true
  fi
  # shellcheck disable=SC2181
  if [ $? -eq 0 ]; then
    case $RES in
      2) JSTRING="volatile"
      ;;
      3) JSTRING="persistent"
      ;;
      4) JSTRING="auto"
      ;;
      5) JSTRING="none"
      ;;
      *) JSTRING=""
      ;;
    esac

    # Restore any previous configuration in base configuration file to
    # commented-out systemd default as we now use drop-in configuration
    sed -i -E 's/^(Storage)=.*/#\1=auto/' /etc/systemd/journald.conf 2>/dev/null || true

    CONFIG_FILE="/etc/systemd/journald.conf.d/80-raspi-config-journal-storage.conf"

    if [ -n "$JSTRING" ]; then
      # Create directory if it doesn't exist
      mkdir -p /etc/systemd/journald.conf.d
      # Create config file with the setting
      cat > "$CONFIG_FILE" << EOF
# Created/managed by raspi-config

[Journal]
Storage=$JSTRING
EOF
    else
      # Remove our config file if it exists
      if [ -e "$CONFIG_FILE" ]; then
        rm -f "$CONFIG_FILE"
        # Try to remove directory if empty
        rmdir --ignore-fail-on-non-empty /etc/systemd/journald.conf.d 2>/dev/null
      fi
    fi

    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "Logging location set to ${JSTRING:-default}" 20 60 1
    fi
  fi
}

do_boot_target(){
  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" \
      "B2 Desktop" "Desktop GUI" \
      3>&1 1>&2 2>&3)
  else
    BOOTOPT=$1
    true
  fi
  if [ $? -eq 0 ]; then
    case "$BOOTOPT" in # Handle default target
      B1*) # Console
        systemctl --quiet set-default multi-user.target
        ;;
      B2*) # Desktop
        if [ -e /etc/init.d/lightdm ]; then
          systemctl --quiet set-default graphical.target
        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
  fi
  ASK_TO_REBOOT=1
}

do_autologin(){
  if [ -z "$USER" ]; then
    echo "Can't configure autologin: USER unset" >&2
    return 0
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to automatically log in to the console?" $DEFAULT 20 60 2
    RET=$?
  else
    if [ $1 -eq 1 ] || [ $1 -eq 3 ] ; then
      RET=0
    else
      RET=1
    fi
  fi
  if [ $RET -eq 0 ] ; then
        mkdir -p /etc/systemd/system/getty@tty1.service.d
        cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
EOF
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
        if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then
          rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf
          rmdir --ignore-fail-on-non-empty /etc/systemd/system/getty@tty1.service.d
        fi
    STATUS=disabled
  else
    return $RET
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Console autologin is $STATUS" 20 60 1
    if [ $(get_boot_cli) -eq 0 ]; then
      return 0
    fi
    whiptail --yesno "Would you like to automatically log in to the desktop?" $DEFAULT 20 60 2
    RET=$?
  else
    if [ $1 -eq 2 ] || [ $1 -eq 3 ] ; then
      RET=0
    else
      RET=1
    fi
  fi
  if [ $RET -eq 0 ] ; then
    sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/"
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/"
    STATUS=disabled
  else
    return $RET
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Desktop autologin is $STATUS" 20 60 1
  fi
  ASK_TO_REBOOT=1
}

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 # Handle default target
      B1*|B2*) # Console
        systemctl --quiet set-default multi-user.target
        ;;
      B3*|B4*) # Desktop
        if [ -e /etc/init.d/lightdm ]; then
          systemctl --quiet set-default graphical.target
        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
    case "$BOOTOPT" in # Handle autologin
      B1*|B3*) # Autologin disabled
        if [ -z "${BOOTOPT%%B3*}" ]; then
          sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/"
        fi
        if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then
          rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf
          rmdir --ignore-fail-on-non-empty /etc/systemd/system/getty@tty1.service.d
        fi
        ;;
      B2*|B4*) # Autologin enabled
        if [ -z "$USER" ]; then
          echo "Can't configure autologin: USER unset" >&2
          return 0
        fi
        if [ -z "${BOOTOPT%%B4*}" ]; then
          sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/"
        fi
        mkdir -p /etc/systemd/system/getty@tty1.service.d
        cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
EOF
        ;;
    esac
    if [ "$INIT" = "systemd" ]; then
      systemctl daemon-reload
    fi
    ASK_TO_REBOOT=1
  fi
}

get_bootloader_filename() {
   CURDATE=$(date -d "$(vcgencmd bootloader_version |  head -n 1)" +%Y%m%d)
   FILNAME=""
   EEBASE=$(rpi-eeprom-update | grep RELEASE | sed 's/.*(//g' | sed 's/[^\/]*)//g')
   if grep FIRMWARE_RELEASE_STATUS /etc/default/rpi-eeprom-update | egrep -Eq "stable|latest"; then
      EEPATH="${EEBASE}/latest/pieeprom*.bin"
   else
      EEPATH="${EEBASE}/default/pieeprom*.bin"
   fi
   EXACT_MATCH=0
   for filename in $(find $EEPATH -name "pieeprom*.bin" 2>/dev/null | sort); do
      FILDATE=$(date -d "$(echo $filename | sed 's/.*\///g' | cut -d - -f 2- | cut -d . -f 1)" +%Y%m%d)
      FILNAME=$filename
      if [ $FILDATE -eq $CURDATE ]; then
         EXACT_MATCH=1
         break
      fi
   done
   if [ $EXACT_MATCH != 1 ]; then
      if [ "$INTERACTIVE" = True ]; then
         whiptail --yesno "Current EEPROM version $(date -d $CURDATE +%Y-%m-%d) or newer not found.\n\nTry updating the rpi-eeprom APT package.\n\nInstall latest local $(basename $FILNAME) anyway?" 20 70 3
         DEFAULTS=$?
         if [ "$DEFAULTS" -ne 0 ]; then
            FILNAME="none" # no
         fi
      fi
   fi
}

do_network_install_ui() {
  if [ "$INTERACTIVE" = True ]; then
    BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Bootloader network install UI" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "B1 Always" "Always display the UI for a few seconds after power on." \
      "B2 On demand" "Display the UI if the SHIFT key is pressed or if an error occurs." \
      3>&1 1>&2 2>&3)
  else
    BOOTOPT=$1
    true
  fi

  if [ $? -eq 0 ]; then
    get_bootloader_filename
    if [ "${FILNAME}" = "none" ]; then
       if [ "$INTERACTIVE" = True ]; then
          return 0
       else
          return 1
       fi
    fi
    EECFG=$(mktemp)
    rpi-eeprom-config > $EECFG
    sed $EECFG -i -e "/NET_INSTALL_AT_POWER_ON/d"
    case "$BOOTOPT" in
      B1*)
         echo "NET_INSTALL_AT_POWER_ON=1" >> $EECFG
         ;;
      B2*)
         # NET_INSTALL_AT_POWER_ON default value is 0
         true
         ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
        return 1
        ;;
    esac
    rpi-eeprom-config --apply $EECFG $FILNAME
    ASK_TO_REBOOT=1
  fi
 }

get_ab_firmware() {
  SPIDEV="spi10"
  if grep -q "^dtoverlay=no$SPIDEV" "$CONFIG" ; then
    echo 0
  else
    echo 1
  fi
}

do_ab_firmware() {
  if ! is_pifive ; then
    return 1
  fi
  SPIDEV="spi10"
  if [ "$(get_ab_firmware)" -eq 0 ]; then
    CURRENT="B1"
  else
    CURRENT="B2"
  fi
  if [ "$INTERACTIVE" = True ]; then
    RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --default-item "$CURRENT" \
      --menu "AB firmware updates" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "B1" "Enable AB firmware updates (warning: Flashrom cannot be used for firmware updates)" \
      "B2" "Disable AB firmware updates" \
      3>&1 1>&2 2>&3)
  else
    RET=$1
    true
  fi
  if [ $? -eq 0 ]; then
    case "$RET" in
      B1*)
        if [ "$CURRENT" = "B2" ]; then
          ASK_TO_REBOOT=1
        fi
        sed -i -e "s/^#dtoverlay=no$SPIDEV.*/dtoverlay=no$SPIDEV/" "$CONFIG"
        if ! grep -q "^dtoverlay=no$SPIDEV" "$CONFIG"; then
          if ! tail -1 "$CONFIG" | grep -q "\\[all\\]" ; then
            printf "[all]\n" >> "$CONFIG"
          fi
          printf 'dtoverlay=no%s\n' "$SPIDEV" >> "$CONFIG"
        fi
        STATUS=enabled
        ;;
      B2*)
        if [ "$CURRENT" = "B1" ]; then
          ASK_TO_REBOOT=1
        fi
        sed -i -e "s/^dtoverlay=no$SPIDEV.*/#dtoverlay=no$SPIDEV/" "$CONFIG"
        STATUS=disabled
        ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised option" 20 60 2
        return 1
        ;;
    esac
  else
    return 0
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "AB firmware updates are $STATUS" 20 60 1
  fi
}

# shellcheck disable=SC2120
do_power_off_on_halt() {
  if [ "$INTERACTIVE" = True ]; then
    BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Configure shutdown behaviour." "$WT_HEIGHT" "$WT_WIDTH" "$WT_MENU_HEIGHT" \
      "B1 Full power off" "Switch off Pi power management (PMIC) outputs on Pi4 / Pi5 (recommended)." \
      "B2 VPU sleep mode" "Compatibility mode for HATs (e.g. POE HAT) and GPIO power buttons (Pi4)." \
      3>&1 1>&2 2>&3)
  else
    BOOTOPT=$1
    true
  fi

  # shellcheck disable=SC2181
  if [ $? -eq 0 ]; then
    get_bootloader_filename
    if [ "${FILNAME}" = "none" ]; then
       if [ "$INTERACTIVE" = True ]; then
          return 0
       else
          return 1
       fi
    fi
    EECFG=$(mktemp)
    rpi-eeprom-config > "$EECFG"
    sed "$EECFG" -i -e "/POWER_OFF_ON_HALT/d"
    sed "$EECFG" -i -e "/WAKE_ON_GPIO/d"
    case "$BOOTOPT" in
      B1*)
         echo "POWER_OFF_ON_HALT=1" >> "$EECFG"
         echo "WAKE_ON_GPIO=0" >> "$EECFG"
         ;;
      B2*)
         echo "POWER_OFF_ON_HALT=0" >> "$EECFG"
         echo "WAKE_ON_GPIO=1" >> "$EECFG"
         true
         ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
        return 1
        ;;
    esac
    rpi-eeprom-config --apply "$EECFG" "$FILNAME"
    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 before trying NVMe and then USB (RECOMMENDED)" \
      "B2 NVMe/USB Boot" "Boot from NVMe before trying USB and then SD Card" \
      "B3 Network Boot " "Boot from Network unless overridden by SD Card" \
      3>&1 1>&2 2>&3)
  else
    BOOTOPT=$1
    true
  fi
  if [ $? -eq 0 ]; then
    EECFG=$(mktemp)
    rpi-eeprom-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 has_nvme; then
           ORD=0xf461
        else
           ORD=0xf41
        fi
        if ! grep -q "BOOT_ORDER" $EECFG ; then
          sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=${ORD}"
        else
          sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=${ORD}/"
        fi
        STATUS="SD Card"
        ;;
      B2*)
        if has_nvme; then
           ORD=0xf146
        else
           ORD=0xf14
        fi
        if ! grep -q "BOOT_ORDER" $EECFG ; then
          sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=${ORD}"
        else
          sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=${ORD}/"
        fi
        STATUS="NVMe/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
    get_bootloader_filename
    if [ "${FILNAME}" = "none" ]; then
       if [ "$INTERACTIVE" = True ]; then
          return 0
       else
          return 1
       fi
    fi
    rpi-eeprom-config --apply $EECFG $FILNAME
    ASK_TO_REBOOT=1
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "$STATUS is default boot device" 20 60 1
    fi
  fi
}

do_beta_mode() {
  DVER=$(lsb_release -c | cut -f 2)

  if [ "$INTERACTIVE" = True ]; then
    BETAOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Beta Access" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "B1 Beta Software" "Use the beta repository and latest bootloader image" \
      "B2 Release Software" "Use the release software repository" \
      3>&1 1>&2 2>&3)
  else
    BETAOPT=$1
    true
  fi
  if [ $? -eq 0 ]; then
    case "$BETAOPT" in
      B1*)
        if is_pifour || is_pifive ; then
          sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"latest\"/"
        fi
        cat > /etc/apt/sources.list.d/beta.list << EOF
deb http://archive.raspberrypi.com/debian/ $DVER beta
#deb-src http://archive.raspberrypi.com/debian/ $DVER beta
EOF
        BETA="Beta"
        ;;
      B2*)
        rm -f /etc/apt/sources.list.d/beta.list
        BETA="Release"
        ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised option" 20 60 2
        return 1
        ;;
    esac
    if [ "$INTERACTIVE" = True ]; then
         whiptail --msgbox "$BETA software enabled. Please use sudo apt update to refresh the repository." 20 60 2
    fi
     ASK_TO_REBOOT=1
  fi
}


do_boot_rom() {
  if [ "$INTERACTIVE" = True ]; then
    BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Bootloader Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "E1 Latest" "Use the latest bootloader image" \
      "E2 Default" "Use the factory default bootloader image" \
      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=\"latest\"/"
        EETYPE="Latest version"
        ;;
      E2*)
        sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"default\"/"
        EETYPE="Factory default"
        ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised bootloader option" 20 60 2
        return 1
        ;;
    esac
    if [ "$INTERACTIVE" = True ]; then
      whiptail --yesno "$EETYPE bootloader selected - will be loaded at next reboot.\n\nReset bootloader to default configuration?" 20 60 2
      DEFAULTS=$?
    else
      DEFAULTS=$2
    fi
    if [ "$DEFAULTS" -eq 0 ]; then # yes
      get_bootloader_filename
      if [ "${FILNAME}" = "none" ]; then
         if [ "$INTERACTIVE" = True ]; then
            return 0
         else
            return 1
         fi
      fi
      rpi-eeprom-update -d -f $FILNAME
      if [ "$INTERACTIVE" = True ]; then
         whiptail --msgbox "Bootloader reset to default configuration" 20 60 2
      fi
    else
      if [ "$INTERACTIVE" = True ]; then
        whiptail --msgbox "Bootloader not reset to defaults" 20 60 2
      fi
    fi
    ASK_TO_REBOOT=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_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${FIRMWARE}/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${FIRMWARE}/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() {
  if [ "$INTERACTIVE" = True ]; then
    RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Wayland Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
        "W1 X11" "Openbox window manager with X11 backend" \
        "W2 Labwc" "Labwc window manager with Wayland backend" \
        3>&1 1>&2 2>&3)
  else
    RET=$1
    true
  fi
  if [ $? -eq 0 ]; then
    if [ -f /usr/share/xsessions/rpd-x.desktop ] || [ -f /usr/share/wayland-sessions/rpd-labwc.desktop ]; then
      XSESSION=rpd-x
      WSESSION=rpd-labwc
      XGSESSION=pi-greeter-x
      WGSESSION=pi-greeter-labwc
    else
      XSESSION=LXDE-pi-x
      WSESSION=LXDE-pi-labwc
      XGSESSION=pi-greeter
      WGSESSION=pi-greeter-labwc
    fi
    case "$RET" in
      W1*)
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=$XSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=$XSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=$XGSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-test.*/#fallback-test=/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-session.*/#fallback-session=/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-greeter.*/#fallback-greeter=/"
        if [ -e "/var/lib/AccountsService/users/$USER" ] ; then
          sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=$XSESSION/"
        fi
        STATUS="Openbox on X11"
        ;;
      W2*)
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=$WSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=$WSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=$WGSESSION/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-test.*/#fallback-test=/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-session.*/#fallback-session=/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-greeter.*/#fallback-greeter=/"
        if [ -e "/var/lib/AccountsService/users/$USER" ] ; then
          sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=$WSESSION/"
        fi
        STATUS="Labwc on Wayland"
        ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
        return 1
        ;;
    esac
    ASK_TO_REBOOT=1
  else
    return 0
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "$STATUS is active" 20 60 1
  fi
}

get_net_names() {
  if grep -q "net.ifnames=0" $CMDLINE || \
    ( [ "$(readlink -f /etc/systemd/network/99-default.link)" = "/dev/null" ] && \
      [ "$(readlink -f /etc/systemd/network/73-usb-net-by-mac.link)" = "/dev/null" ] ); then
    echo 1
  else
    echo 0
  fi
}

do_net_names () {
  DEFAULT=--defaultno
  CURRENT=0
  if [ "$(get_net_names)" -eq 0 ]; then
    DEFAULT=
    CURRENT=1
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable predictable network interface names?" $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 -i "$CMDLINE" -e "s/net.ifnames=0 *//"
    rm -f /etc/systemd/network/99-default.link
    rm -f /etc/systemd/network/73-usb-net-by-mac.link
    STATUS=enabled
  elif [ "$RET" -eq 1 ]; then
    ln -sf /dev/null /etc/systemd/network/99-default.link
    ln -sf /dev/null /etc/systemd/network/73-usb-net-by-mac.link
    STATUS=disabled
  else
    return "$RET"
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Predictable network interface names are $STATUS" 20 60 1
  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
    whiptail --msgbox "raspi-config cannot configure audio when PulseAudio or PipeWire are in use.\n\nThese can be controlled with the taskbar plugin." 20 60 1
    return 0
  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 ] && [ -n "$AUDIO_OUT" ]; then
        amixer cset numid=3 "$AUDIO_OUT"
      fi
    else
      ASPATH=$(getent passwd $USER | cut -d : -f 6)/.asoundrc
      if [ "$INTERACTIVE" = True ]; then
        n=0
        array=""
        while [ $n -le 9 ]
        do
          CARD=$(LC_ALL=C aplay -l | grep "card $n" | cut -d [ -f 2 | cut -d ] -f 1)
          if [ -z "$CARD" ] ; then
            break
          else
            if [ -z "$array" ] ; then
              array=$n"/"$CARD
            else
              #shellcheck disable=2027
              array=$array"/"$n"/"$CARD
            fi
          fi
          n=$(( n+1 ))
        done
        if [ $n -eq 0 ] ; then
          whiptail --msgbox "No audio devices found" 20 60 1
          false
        else
          oIFS="$IFS"
          IFS="/"
          AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${array} 3>&1 1>&2 2>&3)
          IFS="$oIFS"
        fi
      else
        AUDIO_OUT=$1
      fi
      if [ "$?" -eq 0 ] && [ -n "$AUDIO_OUT" ]; 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
    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
      IFACE="$(basename "$(dirname "$dir")")"
      if wpa_cli -i "$IFACE" status > /dev/null 2>&1; then
        echo "$IFACE"
      fi
    fi
  done
}

do_wifi_ssid_passphrase() {
  RET=0
  if [ "$INTERACTIVE" = True ] && [ -z "$(get_wifi_country)" ]; then
    do_wifi_country
  fi

  if systemctl -q is-active dhcpcd; then
    IFACE="$(list_wlan_interfaces | head -n 1)"

    if [ -z "$IFACE" ]; then
      if [ "$INTERACTIVE" = True ]; then
        whiptail --msgbox "No wireless interface found" 20 60
      fi
      return 1
    fi

    if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then
      if [ "$INTERACTIVE" = True ]; then
        whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60
      fi
      return 1
    fi
  elif ! systemctl -q is-active NetworkManager; then
    if [ "$INTERACTIVE" = True ]; then
        whiptail --msgbox "No supported network connection manager found" 20 60
      fi
      return 1
  fi

  SSID="$1"
  while [ -z "$SSID" ] && [ "$INTERACTIVE" = True ]; do
    if ! SSID=$(whiptail --inputbox "Please enter SSID" 20 60 3>&1 1>&2 2>&3); then
      return 0
    elif [ -z "$SSID" ]; then
      whiptail --msgbox "SSID cannot be empty. Please try again." 20 60
    fi
  done

  PASSPHRASE="$2"
  while [ "$INTERACTIVE" = True ]; do
    if ! PASSPHRASE=$(whiptail --passwordbox "Please enter passphrase. Leave it empty if none." 20 60 3>&1 1>&2 2>&3); then
      return 0
    else
      break
    fi
  done

  # Escape special characters for embedding in regex below
  ssid="$(echo "$SSID" \
   | sed 's;\\;\\\\;g' \
   | sed -e 's;\.;\\\.;g' \
         -e 's;\*;\\\*;g' \
         -e 's;\+;\\\+;g' \
         -e 's;\?;\\\?;g' \
         -e 's;\^;\\\^;g' \
         -e 's;\$;\\\$;g' \
         -e 's;\/;\\\/;g' \
         -e 's;\[;\\\[;g' \
         -e 's;\];\\\];g' \
         -e 's;{;\\{;g'   \
         -e 's;};\\};g'   \
         -e 's;(;\\(;g'   \
         -e 's;);\\);g'   \
         -e 's;";\\\\\";g')"

  HIDDEN=${3:-0}
  PLAIN=${4:-1}

  if systemctl -q is-active dhcpcd; then
    wpa_cli -i "$IFACE" list_networks \
     | tail -n +2 | cut -f -2 | grep -P "\t$ssid$" | cut -f1 \
     | while read -r ID; do
      wpa_cli -i "$IFACE" remove_network "$ID" > /dev/null 2>&1
    done

    ID="$(wpa_cli -i "$IFACE" add_network)"
    wpa_cli -i "$IFACE" set_network "$ID" ssid "\"$SSID\"" 2>&1 | grep -q "OK"
    RET=$((RET + $?))

    if [ -z "$PASSPHRASE" ]; then
      wpa_cli -i "$IFACE" set_network "$ID" key_mgmt NONE 2>&1 | grep -q "OK"
      RET=$((RET + $?))
    else
      if [ "$PLAIN" = 1 ]; then
        PASSPHRASE="\"$PASSPHRASE\""
      fi
      wpa_cli -i "$IFACE" set_network "$ID" psk "$PASSPHRASE" 2>&1 | grep -q "OK"
      RET=$((RET + $?))
    fi
    if [ "$HIDDEN" -ne 0 ]; then
      wpa_cli -i "$IFACE" set_network "$ID" scan_ssid 1 2>&1 | grep -q "OK"
      RET=$((RET + $?))
    fi
    if [ $RET -eq 0 ]; then
      wpa_cli -i "$IFACE" enable_network "$ID" > /dev/null 2>&1
    else
      wpa_cli -i "$IFACE" remove_network "$ID" > /dev/null 2>&1
      if [ "$INTERACTIVE" = True ]; then
        whiptail --msgbox "Failed to set SSID or passphrase" 20 60
      fi
    fi
    wpa_cli -i "$IFACE" save_config > /dev/null 2>&1
    echo "$IFACE_LIST" | while read -r IFACE; do
      wpa_cli -i "$IFACE" reconfigure > /dev/null 2>&1
    done
  else
    IFACE="$(list_wlan_interfaces | head -n 1)"
    if [ "$HIDDEN" -ne 0 ]; then
      nmcli device wifi connect "$SSID" password "$PASSPHRASE" ifname "${IFACE}" hidden true | grep -q "activated"
    else
      nmcli device wifi connect "$SSID" password "$PASSPHRASE" ifname "${IFACE}" | grep -q "activated"
    fi
    RET=$((RET + $?))
  fi

  return "$RET"
}

get_wifi_power_save() {
  # Check if the configuration file exists (simpler approach)
  if [ -f /etc/NetworkManager/conf.d/default-wifi-powersave-off.conf ]; then
    echo 0  # Power saving is disabled
  else
    echo 1  # Power saving is enabled (default)
  fi
}

# shellcheck disable=SC2120
do_wifi_power_save() {
  DEFAULT=
  CURRENT=0
  if [ "$(get_wifi_power_save)" -eq 0 ]; then
    DEFAULT=--defaultno
    CURRENT=1
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable WLAN power saving?\n\nNote: Disabling power saving may improve connection stability but increase power consumption." $DEFAULT 20 70 2
    RET=$?
  else
    RET=$1
  fi

  # Create NetworkManager conf.d directory if it doesn't exist
  mkdir -p /etc/NetworkManager/conf.d

  if [ "$RET" -eq 0 ]; then
    # Enable power saving - remove the configuration file
    rm -f /etc/NetworkManager/conf.d/default-wifi-powersave-off.conf
    STATUS="enabled"
  elif [ "$RET" -eq 1 ]; then
    # Disable power saving - create configuration file
    cat > /etc/NetworkManager/conf.d/default-wifi-powersave-off.conf << EOF
[connection]
wifi.powersave = 2
EOF
    STATUS="disabled"
  else
    return "$RET"
  fi

  # Reload NetworkManager configuration for persistence
  if systemctl -q is-active NetworkManager; then
    systemctl reload NetworkManager 2>/dev/null || true
  fi

  # Apply the change immediately to current interface
  IFACE="$(list_wlan_interfaces | head -n 1)"
  if [ -n "$IFACE" ] && command -v iw >/dev/null 2>&1; then
    if [ "$RET" -eq 0 ]; then
      iw dev "$IFACE" set power_save on 2>/dev/null || true
    else
      iw dev "$IFACE" set power_save off 2>/dev/null || true
    fi
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "WLAN power saving is $STATUS\n\nThe change has been applied immediately and made persistent for future connections." 20 75 1
  fi
}

get_link_local_fallback() {
  # Check if the configuration file exists
  if [ -f /etc/NetworkManager/conf.d/link-local.conf ]; then
    echo 1  # Link-local fallback is enabled
  else
    echo 0  # Link-local fallback is disabled (default)
  fi
}

# shellcheck disable=SC2120
do_link_local_fallback() {
  DEFAULT=--defaultno
  CURRENT=$(get_link_local_fallback)
  if [ "$CURRENT" -eq 1 ]; then
    DEFAULT=
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like to enable link-local fallback?\n\nNote: This assigns a 169.254.x.x address immediately, before trying DHCP. Enable only if you understand this behavior." $DEFAULT 20 75 2
    RET=$?
  else
    RET=$1
  fi

  if [ "$RET" -eq 0 ]; then
    STATUS="enabled"
  else
    STATUS="disabled"
  fi

  # Only make changes if the setting is actually changing
  if [ "$RET" -eq 0 ] && [ "$CURRENT" -eq 0 ]; then
    # Enable link-local fallback
    mkdir -p /etc/NetworkManager/conf.d
    cat > /etc/NetworkManager/conf.d/link-local.conf << EOF
# Created/managed by raspi-config
[connection]
ipv4.link-local=4
EOF
    ASK_TO_REBOOT=1
  elif [ "$RET" -eq 1 ] && [ "$CURRENT" -eq 1 ]; then
    # Disable link-local fallback
    rm -f /etc/NetworkManager/conf.d/link-local.conf
    ASK_TO_REBOOT=1
  fi

  # Reload NetworkManager configuration for persistence
  if systemctl -q is-active NetworkManager; then
    systemctl reload NetworkManager 2>/dev/null || true
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Link-local fallback is $STATUS" 20 60 1
  fi
}

do_finish() {
  disable_raspi_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
      sync
      reboot
    fi
  fi
  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 "overlayroot=tmpfs" /proc/cmdline
  echo $?
}

get_overlay_conf() {
  grep -q "overlayroot=tmpfs" $CMDLINE
  echo $?
}

get_bootro_now() {
  findmnt /boot${FIRMWARE} | grep -q " ro,"
  echo $?
}

get_bootro_conf() {
  grep /boot${FIRMWARE} /etc/fstab | grep -q "defaults.*,ro[ ,]"
  echo $?
}

is_uname_current() {
  test -d "/lib/modules/$(uname -r)"
}

enable_overlayfs() {
  if [ "$(awk '/MemTotal/{print $2; exit}' /proc/meminfo)" -le 262144 ]; then
    if [ "$INTERACTIVE" = True ]; then
      whiptail --msgbox "At least 512MB of RAM is recommended for overlay filesystem" 20 60 1
    else
      echo "At least 512MB of RAM is recommended for overlay filesystem"
    fi
    return 1
  fi
  is_installed overlayroot || apt-get install -y overlayroot
  # mount the boot partition as writable if it isn't already
  if [ $(get_bootro_now) -eq 0 ] ; then
    if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then
      echo "Unable to mount boot partition as writable - cannot enable"
      return 1
    fi
    BOOTRO=yes
  else
    BOOTRO=no
  fi

  # modify command line
  if ! grep -q "overlayroot=tmpfs" $CMDLINE ; then
    sed -i $CMDLINE -e "s/^/overlayroot=tmpfs /"
  fi

  if [ "$BOOTRO" = "yes" ] ; then
    if ! mount -o remount,ro /boot${FIRMWARE} 2>/dev/null ; then
      echo "Unable to remount boot partition as read-only"
    fi
  fi
}

disable_overlayfs() {
  # mount the boot partition as writable if it isn't already
  if [ $(get_bootro_now) -eq 0 ] ; then
    if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then
      echo "Unable to mount boot partition as writable - cannot disable"
      return 1
    fi
    BOOTRO=yes
  else
    BOOTRO=no
  fi

  # modify command line
  sed -i $CMDLINE -e "s/\(.*\)overlayroot=tmpfs \(.*\)/\1\2/"

  if [ "$BOOTRO" = "yes" ] ; then
    if ! mount -o remount,ro /boot${FIRMWARE} 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$FIRMWARE.*\)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$FIRMWARE.*\)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
}

get_usb_current() {
  USB=$(get_config_var usb_max_current_enable $CONFIG)
  if [ $USB -eq 1 ]; then
    echo 0
  else
    echo 1
  fi
}

do_usb_current() {
  DEFAULT=--defaultno
  if [ $(get_usb_current) -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like the USB current limit to be disabled?" $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ $RET -eq 0 ]; then
    set_config_var usb_max_current_enable 1 $CONFIG &&
    STATUS=disabled
  elif [ $RET -eq 1 ]; then
    sed $CONFIG -i -e "/usb_max_current_enable.*/d"
    STATUS=enabled
  else
    return $RET
  fi


  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "The USB current limit is $STATUS" 20 60 1
  fi
}

get_squeekboard() {
  if ! is_installed squeekboard ; then
    echo 2
  elif [ -e /etc/xdg/autostart/squeekboard.desktop ] ; then
    if grep -q sbtest /etc/xdg/autostart/squeekboard.desktop ; then
      echo 1
    else
      echo 0
    fi
  else
    echo 2
  fi
}

do_squeekboard() {
  if [ "$INTERACTIVE" = True ]; then
    OPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "On-screen Keyboard" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      "S1 Always On" "On-screen keyboard always enabled" \
      "S2 Autodetect" "On-screen keyboard enabled if touch device found" \
      "S3 Always Off" "On-screen keyboard disabled" \
      3>&1 1>&2 2>&3)
  else
    OPT=$1
    true
  fi
  GFILE="/etc/xdg/labwc-greeter/autostart"
  if [ ! -e $GFILE ] ; then
    GFILE="/usr/share/labwc/autostart"
  fi
  case "$OPT" in
    S1*)
      is_installed squeekboard || apt-get install -y squeekboard
      cat > /etc/xdg/autostart/squeekboard.desktop << EOF
[Desktop Entry]
Name=Squeekboard
Comment=Launch the on-screen keyboard
Exec=/usr/bin/sbout
Terminal=false
Type=Application
NoDisplay=true
EOF
      sed -i '/sbtest/d' $GFILE
      if ! grep -q sbout $GFILE ; then
        echo "/usr/bin/sbout &" >> $GFILE
      fi
      PREFIX=""
      if [ -n "$SUDO_USER" ] ; then
        PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
      fi
      $PREFIX sbout > /dev/null 2> /dev/null &
      STATUS="enabled"
      ;;
    S2*)
      is_installed squeekboard || apt-get install -y squeekboard
      cat > /etc/xdg/autostart/squeekboard.desktop << EOF
[Desktop Entry]
Name=Squeekboard
Comment=Launch the on-screen keyboard
Exec=/usr/bin/sbtest
Terminal=false
Type=Application
NoDisplay=true
EOF
      sed -i '/sbout/d' $GFILE
      if ! grep -q sbtest $GFILE ; then
        echo "/usr/bin/sbtest &" >> $GFILE
      fi
      PREFIX=""
      if [ -n "$SUDO_USER" ] ; then
        PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
      fi
      pkill squeekboard
      $PREFIX sbtest > /dev/null 2> /dev/null &
      STATUS="using autodetect"
      ;;
    S3*)
      pkill squeekboard
      rm -f /etc/xdg/autostart/squeekboard.desktop
      sed -i '/sbout/d' $GFILE
      sed -i '/sbtest/d' $GFILE
      STATUS="disabled"
      ;;
    *)
      return $OPT
      ;;
  esac
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "The onscreen keyboard is $STATUS" 20 60 1
  fi
}

get_squeek_output (){
  if [ -e /usr/share/squeekboard/output ] ; then
    echo `grep SQUEEKBOARD_PREFERRED_OUTPUT /usr/share/squeekboard/output | cut -d = -f 2`
  else
    echo ""
  fi
}

do_squeek_output() {
  PREFIX=""
  if [ -n "$SUDO_USER" ] ; then
    PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus "
  fi
  if [ "$INTERACTIVE" = True ]; then
    menu=$($PREFIX wlr-randr | grep -v ^' ' | cut -d ' ' -f 1 | tr '\n' '/' | sed 's#/#//#g')
    oIFS="$IFS"
    IFS="/"
    OPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select where the on-screen keyboard is to be shown" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
      ${menu} \
      3>&1 1>&2 2>&3)
    IFS="$oIFS"
  else
    OPT=$1
    true
  fi
  mkdir -p /usr/share/squeekboard/
  echo "#!/bin/sh\nexport SQUEEKBOARD_PREFERRED_OUTPUT=$OPT" > /usr/share/squeekboard/output
  chmod a+x /usr/share/squeekboard/output
  if pgrep sbtest > /dev/null ; then
    pkill squeekboard
    $PREFIX sbtest > /dev/null 2> /dev/null &
  elif pgrep squeekboard > /dev/null ; then
    pkill squeekboard
    $PREFIX sbout > /dev/null 2> /dev/null &
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "The onscreen keyboard is on $OPT" 20 60 1
  fi
}

get_sudo_pass() {
  if sudo -l -n -U $USER 2> /dev/null | grep -q "(ALL) NOPASSWD: ALL" 2> /dev/null ; then
    echo 1
  else
    echo 0
  fi
}

do_sudo_pass() {
  PSFILE="/etc/sudoers.d/010_$USER-nopasswd"
  GPSFILE="/etc/sudoers.d/010_pi-nopasswd"
  CIFILE="/etc/sudoers.d/90-cloud-init-users"
  DEFAULT=--defaultno
  if [ "$(get_sudo_pass)" -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno \
      "Would you like the admin (sudo) password to be enabled?" \
      $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ "$RET" -eq 0 ]; then
    if [ -e $PSFILE ] ; then rm $PSFILE ; fi
    if [ -e $GPSFILE ] ; then rm $GPSFILE ; fi
    if [ -e $CIFILE ] ; then rm $CIFILE ; fi
    STATUS=enabled
  elif [ "$RET" -eq 1 ]; then
    if [ -e $GPSFILE ] ; then rm $GPSFILE ; fi
    if [ -e $CIFILE ] ; then rm $CIFILE ; fi
      cat > $PSFILE << EOF
$USER ALL=(ALL) NOPASSWD: ALL
EOF
    STATUS=disabled
  else
    return "$RET"
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "The admin password is $STATUS" 20 60 1
  fi
}

nonint() {
  "$@"
}

batch() {
  for cmd in "$@"
  do
    echo "$cmd" $($cmd)
  done
}

#
# Command line options for non-interactive use
#
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
    printf "Please reboot\n"
    exit 0
    ;;
  --apply-os-config)
    INTERACTIVE=False
    do_apply_os_config
    exit $?
    ;;
  nonint | batch)
    INTERACTIVE=False
    #echo "$@"
    "$@"
    exit $?
    ;;
  *)
    # unknown option
    ;;
  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" "Select boot into desktop or to command line" \
      "S6 Auto Login" "Enable auto login to desktop or to command line" \
      "S7 Splash Screen" "Choose graphical splash screen or text boot" \
      "S8 Power LED" "Set behaviour of power LED" \
      "S9 Browser" "Choose default web browser" \
      "S10 Admin Password" "Enable or disable sudo password" \
      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" "Select boot into desktop or to command line" \
      "S6 Auto Login" "Enable auto login to desktop or to command line" \
      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" "Select boot into desktop or to command line" \
      "S6 Auto Login" "Enable auto login to desktop or to command line" \
      "S7 Splash Screen" "Choose graphical splash screen or text boot" \
      "S10 Admin Password" "Enable or disable sudo password" \
      3>&1 1>&2 2>&3)
  fi
  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_target ;;
      S6\ *) do_autologin ;;
      S7\ *) do_boot_splash ;;
      S8\ *) do_leds ;;
      S9\ *) do_browser ;;
      S10\ *) do_sudo_pass ;;
      *) 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_wayland; then
      if is_pifour; 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 Screen Blanking" "Enable/disable screen blanking" \
          "D4 Composite" "Enable/disable composite output" \
          "D5 4Kp60 HDMI" "Enable 4Kp60 resolution on HDMI0" \
          "D6 Onscreen Keyboard" "Enable on-screen keyboard" \
          "D7 Keyboard Output" "Select monitor used for on-screen keyboard" \
          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 \
          "D2 Screen Blanking" "Enable/disable screen blanking" \
          "D4 Composite" "Enable/disable composite output" \
          "D6 Onscreen Keyboard" "Enable on-screen keyboard" \
          "D7 Keyboard Output" "Select monitor used for on-screen keyboard" \
          3>&1 1>&2 2>&3)
      fi
    else
      if is_pifour; 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 \
          "D1 Underscan" "Remove black border around screen" \
          "D2 Screen Blanking" "Enable/disable screen blanking" \
          "D3 VNC Resolution" "Set resolution for headless use" \
          "D4 Composite" "Enable/disable composite output" \
          "D5 4Kp60 HDMI" "Enable 4Kp60 resolution on HDMI0" \
          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 Underscan" "Remove black border around screen" \
          "D2 Screen Blanking" "Enable/disable screen blanking" \
          "D3 VNC Resolution" "Set resolution for headless use" \
          "D4 Composite" "Enable/disable composite output" \
          3>&1 1>&2 2>&3)
      fi
    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 \
      "D1 Underscan" "Remove black border around screen" \
      "D2 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_overscan_kms ;;
      D2\ *) do_blanking ;;
      D3\ *) do_vnc_resolution ;;
      D4\ *) do_composite ;;
      D5\ *) do_pi4video ;;
      D6\ *) do_squeekboard ;;
      D7\ *) do_squeek_output ;;
      *) 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 SSH" "Enable/disable remote command line access using SSH" \
      "I2 RPi Connect" "Enable/disable Raspberry Pi Connect" \
      "I3 VNC" "Enable/disable graphical remote desktop access" \
      "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" \
      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_ssh ;;
      I2\ *) do_rpi_connect ;;
      I3\ *) do_vnc ;;
      I4\ *) do_spi ;;
      I5\ *) do_i2c ;;
      I6\ *) if is_pifive ; then do_serial_pi5 ; else do_serial ; fi ;;
      I7\ *) do_onewire ;;
      *) 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() {
  case "$(get_pi_type)" in
    [03]) 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 \
          "P2 Overlay File System" "Enable/disable read-only file system" \
          3>&1 1>&2 2>&3) ;;
    [12]) 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 Overlay File System" "Enable/disable read-only file system" \
          3>&1 1>&2 2>&3) ;;
    4) 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 \
          "P2 Overlay File System" "Enable/disable read-only file system" \
          "P3 Fan" "Set behaviour of GPIO case fan" \
          3>&1 1>&2 2>&3) ;;
    *) 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 \
          "P2 Overlay File System" "Enable/disable read-only file system" \
          "P4 USB Current" "Set USB current limit" \
          3>&1 1>&2 2>&3) ;;
  esac
  RET=$?
  if [ $RET -eq 1 ]; then
    return 0
  elif [ $RET -eq 0 ]; then
    case "$FUN" in
      P1\ *) do_overclock ;;
      P2\ *) do_overlayfs ;;
      P3\ *) do_fan ;;
      P4\ *) do_usb_current ;;
      *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
    esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
  fi
}

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=$?
  if [ $RET -eq 1 ]; then
    return 0
  elif [ $RET -eq 0 ]; then
    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
  fi
}

do_advanced_menu() {
  if is_pifive ; 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 Network Interface Names" "Enable/disable predictable network i/f names" \
      "A3 Network Proxy Settings" "Configure network proxy settings" \
      "A4 Boot Order" "Choose boot device priority (SD/net/USB/NVMe)" \
      "A5 Bootloader Version" "Selects the latest or the factory default bootloader" \
      "A6 Beta Access" "Select beta or release software repository" \
      "A7 Wayland" "Switch between X and Wayland backends" \
      "A8 PCIe Speed" "Set PCIe x1 port speed" \
      "A9 Network Install UI" "Select display of bootloader network install UI" \
      "A10 Shutdown Behaviour" "Configure shutdown behavior" \
      "A11 Logging" "Set storage location for logs" \
      "A12 WLAN Power Save" "Enable/disable WLAN power saving" \
      "A13 Link-local Fallback" "Enable/disable link-local address fallback" \
      "A14 AB Firmware" "Enable/disable AB firmware updates" \
      3>&1 1>&2 2>&3)
  elif 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" \
      "A2 Network Interface Names" "Enable/disable predictable network i/f names" \
      "A3 Network Proxy Settings" "Configure network proxy settings" \
      "A4 Boot Order" "Choose boot device priority (SD/net/USB/NVMe)" \
      "A5 Bootloader Version" "Selects the latest or the factory default bootloader" \
      "A6 Beta Access" "Select beta or release software repository" \
      "A7 Wayland" "Switch between X and Wayland backends" \
      "A9 Network Install UI" "Select display of bootloader network install UI" \
      "A10 Shutdown Behaviour" "Configure shutdown behavior" \
      "A11 Logging" "Set storage location for logs" \
      "A12 WLAN Power Save" "Enable/disable WLAN power saving" \
      "A13 Link-local Fallback" "Enable/disable link-local address fallback" \
      3>&1 1>&2 2>&3)
  elif is_pi ; 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 Network Interface Names" "Enable/disable predictable network i/f names" \
      "A3 Network Proxy Settings" "Configure network proxy settings" \
      "A6 Beta Access" "Select beta or release software repository" \
      "A7 Wayland" "Switch between X and Wayland backends" \
      "A11 Logging" "Set storage location for logs" \
      "A12 WLAN Power Save" "Enable/disable WLAN power saving" \
      "A13 Link-local Fallback" "Enable/disable link-local address fallback" \
      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 \
      "A2 Network Interface Names" "Enable/disable predictable network i/f names" \
      "A3 Network Proxy Settings" "Configure network proxy settings" \
      "A6 Beta Access" "Select beta or release software repository" \
      "A7 Wayland" "Switch between X and Wayland backends" \
      "A11 Logging" "Set storage location for logs" \
      "A12 WLAN Power Save" "Enable/disable WLAN power saving" \
      "A13 Link-local Fallback" "Enable/disable link-local address fallback" \
      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_net_names ;;
      A3\ *) do_proxy_menu ;;
      A4\ *) do_boot_order ;;
      A5\ *) do_boot_rom ;;
      A6\ *) do_beta_mode ;;
      A7\ *) do_wayland ;;
      A8\ *) do_pci ;;
      A9\ *) do_network_install_ui ;;
      A10\ *) do_power_off_on_halt ;;
      A11\ *) do_journald_storage ;;
      A12\ *) do_wifi_power_save ;;
      A13\ *) do_link_local_fallback ;;
      A14\ *) do_ab_firmware ;;
      *) 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" \
    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;;
      *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
    esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
  fi
}

#
# Interactive use loop
#
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
      return 0
    fi
  done
  while true; do
    if is_pi ; then
      MEMSIZE=$(vcgencmd get_config total_mem|cut -d= -f2)
      if [ $MEMSIZE -lt 1024 ]; then
        FMEMSIZE="${MEMSIZE}MB"
      else
        FMEMSIZE="$(expr $MEMSIZE / 1024)GB"
      fi
      FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --backtitle "$(cat /proc/device-tree/model), ${FMEMSIZE}" --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
    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
    else
      exit 1
    fi
  done
fi

Filemanager

Name Type Size Permission Actions
X11 Folder 0755
7z File 38 B 0755
7za File 39 B 0755
7zr File 39 B 0755
HTMLLinker File 71.49 KB 0755
JxrDecApp File 66.24 KB 0755
JxrEncApp File 67.63 KB 0755
RTIMULibCal File 66.55 KB 0755
RTIMULibDrive11 File 66.34 KB 0755
X File 274 B 0755
Xorg File 274 B 0755
Xvnc File 1.54 MB 4755
Xvnc-core File 11.77 MB 0755
Xwayland File 2.34 MB 0755
[ File 66.34 KB 0755
aa-enabled File 66.17 KB 0755
aa-exec File 66.36 KB 0755
aa-features-abi File 66.38 KB 0755
aarch64-linux-gnu-addr2line File 67.08 KB 0755
aarch64-linux-gnu-ar File 67.09 KB 0755
aarch64-linux-gnu-as File 454.99 KB 0755
aarch64-linux-gnu-c++filt File 66.47 KB 0755
aarch64-linux-gnu-cpp File 1.07 MB 0755
aarch64-linux-gnu-cpp-14 File 1.07 MB 0755
aarch64-linux-gnu-elfedit File 66.98 KB 0755
aarch64-linux-gnu-g++ File 1.07 MB 0755
aarch64-linux-gnu-g++-14 File 1.07 MB 0755
aarch64-linux-gnu-gcc File 1.07 MB 0755
aarch64-linux-gnu-gcc-14 File 1.07 MB 0755
aarch64-linux-gnu-gcc-ar File 66.52 KB 0755
aarch64-linux-gnu-gcc-ar-14 File 66.52 KB 0755
aarch64-linux-gnu-gcc-nm File 66.52 KB 0755
aarch64-linux-gnu-gcc-nm-14 File 66.52 KB 0755
aarch64-linux-gnu-gcc-ranlib File 66.52 KB 0755
aarch64-linux-gnu-gcc-ranlib-14 File 66.52 KB 0755
aarch64-linux-gnu-gcov File 516 KB 0755
aarch64-linux-gnu-gcov-14 File 516 KB 0755
aarch64-linux-gnu-gcov-dump File 387.93 KB 0755
aarch64-linux-gnu-gcov-dump-14 File 387.93 KB 0755
aarch64-linux-gnu-gcov-tool File 452.03 KB 0755
aarch64-linux-gnu-gcov-tool-14 File 452.03 KB 0755
aarch64-linux-gnu-gprof File 132.26 KB 0755
aarch64-linux-gnu-ld File 2.38 MB 0755
aarch64-linux-gnu-ld.bfd File 2.38 MB 0755
aarch64-linux-gnu-lto-dump File 28.02 MB 0755
aarch64-linux-gnu-lto-dump-14 File 28.02 MB 0755
aarch64-linux-gnu-nm File 67.93 KB 0755
aarch64-linux-gnu-objcopy File 199.7 KB 0755
aarch64-linux-gnu-objdump File 394.74 KB 0755
aarch64-linux-gnu-pkg-config File 67.96 KB 0755
aarch64-linux-gnu-pkgconf File 67.96 KB 0755
aarch64-linux-gnu-python3-config File 3.07 KB 0755
aarch64-linux-gnu-python3.13-config File 3.07 KB 0755
aarch64-linux-gnu-ranlib File 67.09 KB 0755
aarch64-linux-gnu-readelf File 779.66 KB 0755
aarch64-linux-gnu-run File 3.07 MB 0755
aarch64-linux-gnu-size File 66.8 KB 0755
aarch64-linux-gnu-strings File 66.93 KB 0755
aarch64-linux-gnu-strip File 199.71 KB 0755
ab File 66.31 KB 0755
aconnect File 66.24 KB 0755
acyclic File 66.44 KB 0755
addr2line File 67.08 KB 0755
agnostics File 67.13 KB 0755
airscan-discover File 195.26 KB 0755
alsabat File 66.29 KB 0755
alsaloop File 131.18 KB 0755
alsamixer File 132.1 KB 0755
alsatplg File 130.24 KB 0755
alsaucm File 66.69 KB 0755
amidi File 66.25 KB 0755
amixer File 66.3 KB 0755
aplay File 130.29 KB 0755
aplaymidi File 66.24 KB 0755
aplaymidi2 File 66.25 KB 0755
apropos File 67.12 KB 0755
apt File 66.24 KB 0755
apt-cache File 130.38 KB 0755
apt-cdrom File 66.32 KB 0755
apt-config File 66.24 KB 0755
apt-extracttemplates File 66.32 KB 0755
apt-ftparchive File 258.33 KB 0755
apt-get File 66.32 KB 0755
apt-listchanges File 230 B 0755
apt-mark File 66.32 KB 0755
apt-sortpkgs File 66.25 KB 0755
ar File 67.09 KB 0755
arch File 66.46 KB 0755
arecord File 130.29 KB 0755
arecordmidi File 66.26 KB 0755
arecordmidi2 File 66.27 KB 0755
aria_chk File 5.52 MB 0755
aria_dump_log File 5.33 MB 0755
aria_ftdump File 5.33 MB 0755
aria_pack File 5.4 MB 0755
aria_read_log File 5.52 MB 0755
ark File 259.2 KB 0755
arpaname File 66.16 KB 0755
arping File 66.63 KB 0755
as File 454.99 KB 0755
aseqdump File 66.24 KB 0755
aseqnet File 66.28 KB 0755
aseqsend File 66.24 KB 0755
aspell File 194.37 KB 0755
aspell-import File 2 KB 0755
attr File 66.16 KB 0755
autogsdoc File 453.64 KB 0755
autotouch File 1.28 KB 0755
awk File 776.39 KB 0755
axfer File 130.34 KB 0755
b2sum File 66.46 KB 0755
base32 File 66.45 KB 0755
base64 File 66.45 KB 0755
basename File 66.45 KB 0755
basenc File 66.45 KB 0755
bash File 1.35 MB 0755
bashbug File 6.8 KB 0755
bc File 130.68 KB 0755
bcomps File 66.58 KB 0755
bdftopcf File 66.6 KB 0755
bdftruncate File 66.41 KB 0755
bluemoon File 66.23 KB 0755
bluetoothctl File 654.75 KB 0755
btattach File 66.23 KB 0755
btfdiff File 1.29 KB 0755
btmgmt File 194.34 KB 0755
btmon File 1.07 MB 0755
bunzip2 File 66.23 KB 0755
busctl File 130.46 KB 0755
busybox File 898.71 KB 0755
bwrap File 130.3 KB 0755
bzcat File 66.23 KB 0755
bzcmp File 2.17 KB 0755
bzdiff File 2.17 KB 0755
bzegrep File 3.69 KB 0755
bzexe File 4.78 KB 0755
bzfgrep File 3.69 KB 0755
bzgrep File 3.69 KB 0755
bzip2 File 66.23 KB 0755
bzip2recover File 66.16 KB 0755
bzless File 1.27 KB 0755
bzmore File 1.27 KB 0755
c++ File 1.07 MB 0755
c++filt File 66.47 KB 0755
c89 File 428 B 0755
c89-gcc File 428 B 0755
c99 File 454 B 0755
c99-gcc File 454 B 0755
c_rehash File 6.76 KB 0755
camera-bug-report File 5.37 KB 0755
cancel File 66.16 KB 0755
cancel-rename File 2.04 KB 0755
captoinfo File 130.28 KB 0755
cat File 66.49 KB 0755
catdoc File 67.76 KB 0755
catman File 66.6 KB 0755
catppt File 67.23 KB 0755
cc File 1.07 MB 0755
ccomps File 66.68 KB 0755
cd-create-profile File 66.16 KB 0755
cd-fix-profile File 66.16 KB 0755
cd-iccdump File 66.16 KB 0755
cd-it8 File 66.16 KB 0755
cec-compliance File 324.31 KB 0755
cec-ctl File 393.61 KB 0755
cec-follower File 194.93 KB 0755
certbot File 959 B 0755
certtool File 259.34 KB 0755
cgi-fcgi File 66.02 KB 0755
chacl File 66.16 KB 0755
chage File 138.9 KB 2755
chardet File 221 B 0755
chardetect File 221 B 0755
chattr File 66.17 KB 0755
chcon File 130.45 KB 0755
check-language-support File 2.71 KB 0755
checkgid File 66.17 KB 0755
chfn File 69.1 KB 4755
chgrp File 130.46 KB 0755
chmod File 66.46 KB 0755
choom File 130.32 KB 0755
chown File 130.46 KB 0755
chromium File 5.78 KB 0755
chrt File 130.32 KB 0755
chsh File 67.6 KB 4755
chvt File 66.66 KB 0755
cifscreds File 66.52 KB 0755
ciptool File 66.32 KB 0755
circo File 66.43 KB 0755
ckbcomp File 147.15 KB 0755
cksum File 130.48 KB 0755
classes File 67.95 KB 0755
clear File 66.17 KB 0755
clear_console File 66.09 KB 0755
cloud-id File 967 B 0755
cloud-init File 971 B 0755
cloud-init-per File 2.06 KB 0755
cluster File 600.55 KB 0755
cmp File 66.91 KB 0755
cmstart File 84 B 0755
codepage File 66.29 KB 0755
codiff File 194.8 KB 0755
col File 66.32 KB 0755
colcrt File 66.32 KB 0755
colormgr File 66.2 KB 0755
colrm File 66.32 KB 0755
column File 66.32 KB 0755
comm File 66.47 KB 0755
compose File 18.57 KB 0755
con2fbmap File 66.01 KB 0755
convert-dtsv0 File 66.27 KB 0755
corelist File 15.01 KB 0755
cp File 194.48 KB 0755
cpan File 8.16 KB 0755
cpan5.40-aarch64-linux-gnu File 8.19 KB 0755
cpio File 198.73 KB 0755
cpp File 1.07 MB 0755
cpp-14 File 1.07 MB 0755
create_xauth File 104 B 0755
crontab File 66.59 KB 2755
csplit File 66.46 KB 0755
ctracer File 194.76 KB 0755
ctstat File 66.59 KB 0755
cupstestppd File 66.24 KB 0755
curl File 322.34 KB 0755
cut File 66.46 KB 0755
cvlc File 45 B 0755
cvtenc File 68.46 KB 0755
cvtsudoers File 397.23 KB 0755
cx18-ctl File 66.47 KB 0755
danetool File 195.34 KB 0755
dash File 194.59 KB 0755
date File 130.46 KB 0755
dbilogstrip File 1.35 KB 0755
dbiprof File 6.06 KB 0755
dbiproxy File 5.27 KB 0755
dbus-cleanup-sockets File 66.16 KB 0755
dbus-daemon File 258.48 KB 0755
dbus-launch File 66.01 KB 0755
dbus-monitor File 66.16 KB 0755
dbus-run-session File 66.16 KB 0755
dbus-send File 66.16 KB 0755
dbus-update-activation-environment File 66.16 KB 0755
dbus-uuidgen File 66.16 KB 0755
dbwrap_tool File 66.38 KB 0755
dconf File 66.09 KB 0755
dd File 130.5 KB 0755
ddcmon File 12.75 KB 0755
deallocvt File 66.62 KB 0755
deb-systemd-helper File 23.79 KB 0755
deb-systemd-invoke File 6.97 KB 0755
debconf File 2.8 KB 0755
debconf-apt-progress File 11.57 KB 0755
debconf-communicate File 623 B 0755
debconf-copydb File 1.68 KB 0755
debconf-escape File 668 B 0755
debconf-get-selections File 1.72 KB 0755
debconf-getlang File 6.94 KB 0755
debconf-loadtemplate File 944 B 0755
debconf-mergetemplate File 5.09 KB 0755
debconf-set-selections File 3.14 KB 0755
debconf-show File 1.78 KB 0755
debugapp File 985 B 0755
decode-dimms File 106.79 KB 0755
decode-edid File 5.24 KB 0755
decode-vaio File 6.15 KB 0755
decode_tm6000 File 66.52 KB 0755
defaults File 68.82 KB 0755
delaunay File 67.3 KB 0755
delv File 69.15 KB 0755
desktop-file-edit File 132.33 KB 0755
desktop-file-install File 132.33 KB 0755
desktop-file-validate File 132.6 KB 0755
df File 130.94 KB 0755
dh_bash-completion File 4.42 KB 0755
dh_installxmlcatalogs File 9.22 KB 0755
dh_numpy3 File 3.51 KB 0755
dh_perl_dbi File 1.17 KB 0755
diff File 195.52 KB 0755
diff3 File 131.05 KB 0755
diffimg File 66.45 KB 0755
dig File 194.72 KB 0755
dijkstra File 66.61 KB 0755
dir File 194.9 KB 0755
dircolors File 66.46 KB 0755
dirmngr File 646.59 KB 0755
dirmngr-client File 130.75 KB 0755
dirname File 66.45 KB 0755
dm-tool File 66.16 KB 0755
dmesg File 132.63 KB 0755
dmypy File 234 B 0755
dnsdomainname File 66.09 KB 0755
dnssec-cds File 67.13 KB 0755
dnssec-dsfromkey File 66.25 KB 0755
dnssec-importkey File 66.24 KB 0755
dnssec-keyfromlabel File 66.26 KB 0755
dnssec-keygen File 66.26 KB 0755
dnssec-ksr File 66.26 KB 0755
dnssec-revoke File 66.25 KB 0755
dnssec-settime File 66.25 KB 0755
dnssec-signzone File 130.29 KB 0755
dnssec-verify File 66.26 KB 0755
dnstap-read File 66.19 KB 0755
docutils File 216 B 0755
domainname File 66.09 KB 0755
dos2unix File 74.17 KB 0755
dot File 66.43 KB 0755
dot2gxl File 67.05 KB 0755
dot_builtins File 66.54 KB 0755
dotty File 2.04 KB 0755
dpkg File 386.9 KB 0755
dpkg-architecture File 14.84 KB 0755
dpkg-buildapi File 1.79 KB 0755
dpkg-buildflags File 8.14 KB 0755
dpkg-buildpackage File 30.32 KB 0755
dpkg-buildtree File 2.12 KB 0755
dpkg-checkbuilddeps File 7.45 KB 0755
dpkg-deb File 194.59 KB 0755
dpkg-distaddfile File 2.72 KB 0755
dpkg-divert File 194.67 KB 0755
dpkg-genbuildinfo File 18.69 KB 0755
dpkg-genchanges File 17.51 KB 0755
dpkg-gencontrol File 14.62 KB 0755
dpkg-gensymbols File 10.66 KB 0755
dpkg-maintscript-helper File 20.63 KB 0755
dpkg-mergechangelogs File 8.7 KB 0755
dpkg-name File 6.58 KB 0755
dpkg-parsechangelog File 4.83 KB 0755
dpkg-query File 194.66 KB 0755
dpkg-realpath File 66.32 KB 0755
dpkg-scanpackages File 8.45 KB 0755
dpkg-scansources File 9.15 KB 0755
dpkg-shlibdeps File 32.59 KB 0755
dpkg-source File 23.18 KB 0755
dpkg-split File 194.44 KB 0755
dpkg-statoverride File 130.47 KB 0755
dpkg-trigger File 130.45 KB 0755
dpkg-vendor File 3.18 KB 0755
driverless File 66.18 KB 0755
driverless-fax File 537 B 0755
dtagnames File 194.74 KB 0755
dtc File 199.87 KB 0755
dtdiff File 680 B 0755
dtmerge File 66.5 KB 0755
dtoverlay File 66.98 KB 0755
dtparam File 66.98 KB 0755
du File 130.47 KB 0755
dump_xsettings File 66.35 KB 0755
dumpkeys File 195.07 KB 0755
dumpmscat File 66.16 KB 0755
dvipdf File 1007 B 0755
eatmydata File 2.74 KB 0755
ec2metadata File 8.38 KB 0755
echo File 66.45 KB 0755
ed File 66.41 KB 0755
edgepaint File 472.24 KB 0755
edit File 18.57 KB 0755
editor File 324.81 KB 0755
eepdump File 66.5 KB 0755
eepflash.sh File 4.31 KB 0755
eepmake File 66.46 KB 0755
egrep File 41 B 0755
eject File 130.16 KB 0755
elfedit File 66.98 KB 0755
enc2xs File 40.97 KB 0755
encguess File 2.99 KB 0755
enchant-2 File 66.16 KB 0755
enchant-lsmod-2 File 66.16 KB 0755
env File 66.86 KB 0755
envsubst File 66.25 KB 0755
eom File 514.24 KB 0755
eps2eps File 639 B 0755
eqn File 265.28 KB 0755
evince File 515.63 KB 0755
evince-previewer File 66.62 KB 0755
evince-thumbnailer File 66.25 KB 0755
ex File 1.79 MB 0755
expand File 66.47 KB 0755
expiry File 66.45 KB 2755
expr File 66.45 KB 0755
f2py File 216 B 0755
f2py3 File 216 B 0755
f2py3.13 File 249 B 0755
factor File 130.46 KB 0755
faked-sysv File 66.74 KB 0755
faked-tcp File 66.78 KB 0755
fakeroot File 3.91 KB 0755
fakeroot-sysv File 3.91 KB 0755
fakeroot-tcp File 3.9 KB 0755
fallocate File 66.32 KB 0755
false File 66.45 KB 0755
fastfetch File 1.51 MB 0755
fbcli File 66.24 KB 0755
fbd-theme-validate File 194.24 KB 0755
fbset File 66.16 KB 0755
fbtest File 66.25 KB 0755
fc-cache File 66.24 KB 0755
fc-cat File 66.24 KB 0755
fc-conflist File 66.24 KB 0755
fc-list File 66.24 KB 0755
fc-match File 66.24 KB 0755
fc-pattern File 66.24 KB 0755
fc-query File 66.24 KB 0755
fc-scan File 66.24 KB 0755
fc-validate File 66.24 KB 0755
fcgistarter File 66.17 KB 0755
fdp File 66.43 KB 0755
fdtdump File 66.25 KB 0755
fdtget File 66.25 KB 0755
fdtoverlay File 66.25 KB 0755
fdtput File 66.25 KB 0755
ffmpeg File 386.45 KB 0755
ffplay File 194.62 KB 0755
ffprobe File 265.73 KB 0755
fgconsole File 66.64 KB 0755
fgrep File 41 B 0755
filan File 131.97 KB 0755
file File 66.48 KB 0755
file2brl File 66.09 KB 0755
filezilla File 4.38 MB 0755
find File 259.49 KB 0755
findmnt File 131.82 KB 0755
fio File 1.82 MB 0755
fio-btrace2fio File 66.23 KB 0755
fio-dedupe File 66.32 KB 0755
fio-genzipf File 66.28 KB 0755
fio-verify-state File 66.16 KB 0755
fio2gnuplot File 21.73 KB 0755
fio_generate_plots File 4.09 KB 0755
fio_jsonplus_clat2csv File 12.92 KB 0755
firefox File 848 B 0755
flock File 66.38 KB 0755
fmt File 66.45 KB 0755
fold File 66.45 KB 0755
fonttosfnt File 66.62 KB 0755
foomatic-rip File 143.23 KB 0755
free File 66.23 KB 0755
fsnotifywait File 66.24 KB 0755
fsnotifywatch File 66.24 KB 0755
fullcircle File 1.39 KB 0755
funzip File 66.43 KB 0755
fuser File 67.7 KB 0755
fusermount File 66.24 KB 4755
fusermount3 File 66.24 KB 4755
fzputtygen File 322.09 KB 0755
fzsftp File 706.54 KB 0755
g++ File 1.07 MB 0755
g++-14 File 1.07 MB 0755
galculator File 200.4 KB 0755
galera_new_cluster File 922 B 0755
galera_recovery File 3.29 KB 0755
gamma4scanimage File 66.16 KB 0755
gapplication File 66.24 KB 0755
gatttool File 130.34 KB 0755
gawk File 776.39 KB 0755
gawkbug File 6.64 KB 0755
gc File 66.51 KB 0755
gcc File 1.07 MB 0755
gcc-14 File 1.07 MB 0755
gcc-ar File 66.52 KB 0755
gcc-ar-14 File 66.52 KB 0755
gcc-nm File 66.52 KB 0755
gcc-nm-14 File 66.52 KB 0755
gcc-ranlib File 66.52 KB 0755
gcc-ranlib-14 File 66.52 KB 0755
gcore File 3.62 KB 0755
gcov File 516 KB 0755
gcov-14 File 516 KB 0755
gcov-dump File 387.93 KB 0755
gcov-dump-14 File 387.93 KB 0755
gcov-tool File 452.03 KB 0755
gcov-tool-14 File 452.03 KB 0755
gcr-viewer File 66.23 KB 0755
gcr-viewer-gtk4 File 66.23 KB 0755
gdb File 11.51 MB 0755
gdb-add-index File 4.55 KB 0755
gdbtui File 126 B 0755
gdbus File 66.25 KB 0755
gdk-pixbuf-csource File 66.2 KB 0755
gdk-pixbuf-pixdata File 66.18 KB 0755
gdk-pixbuf-thumbnailer File 66.26 KB 0755
gdm-control File 66.16 KB 0755
gdnc File 73.79 KB 0755
gdomap File 66.02 KB 0755
geany File 66.27 KB 0755
gencat File 66.23 KB 0755
genfio File 8.63 KB 0755
geoiplookup File 66.16 KB 0755
geoiplookup6 File 66.16 KB 0755
geqn File 265.28 KB 0755
get-edid File 66.23 KB 0755
getcifsacl File 66.16 KB 0755
getconf File 66.16 KB 0755
getent File 66.49 KB 0755
getfacl File 66.28 KB 0755
getfattr File 66.25 KB 0755
getkeycodes File 66.59 KB 0755
getopt File 66.32 KB 0755
gettext File 66.25 KB 0755
gettext.sh File 5.05 KB 0755
ghostscript File 66.22 KB 0755
gio File 130.29 KB 0755
gio-querymodules File 66.17 KB 0755
git File 3.89 MB 0755
git-receive-pack File 3.89 MB 0755
git-shell File 2.22 MB 0755
git-upload-archive File 3.89 MB 0755
git-upload-pack File 3.89 MB 0755
glib-compile-schemas File 66.4 KB 0755
gmake File 327.8 KB 0755
gml2gv File 66.88 KB 0755
gnome-keyring File 66.38 KB 0755
gnome-keyring-3 File 66.38 KB 0755
gnome-keyring-daemon File 1.2 MB 0755
gnome-www-browser File 5.78 KB 0755
gnutls-cli File 202.79 KB 0755
gnutls-cli-debug File 194.77 KB 0755
gnutls-serv File 130.25 KB 0755
gp-archive File 67.11 KB 0755
gp-collect-app File 67.15 KB 0755
gp-display-html File 630.35 KB 0755
gp-display-src File 66.7 KB 0755
gp-display-text File 197.34 KB 0755
gpasswd File 134.27 KB 4755
gpg File 1.21 MB 0755
gpg-agent File 453.38 KB 0755
gpg-connect-agent File 195.16 KB 0755
gpg-mail-tube File 130.73 KB 0755
gpg-wks-client File 259.26 KB 0755
gpgconf File 199.4 KB 0755
gpgparsemail File 66.24 KB 0755
gpgsm File 649.3 KB 0755
gpgsplit File 130.48 KB 0755
gpgtar File 131.69 KB 0755
gpgv File 580.24 KB 0755
gpic File 260.19 KB 0755
gpiodetect File 66.23 KB 0755
gpioget File 66.23 KB 0755
gpioinfo File 66.23 KB 0755
gpiomon File 66.16 KB 0755
gpionotify File 66.16 KB 0755
gpioset File 66.23 KB 0755
gprof File 132.26 KB 0755
gprofng File 66.49 KB 0755
gprofng-archive File 67.11 KB 0755
gprofng-collect-app File 67.15 KB 0755
gprofng-display-html File 630.35 KB 0755
gprofng-display-src File 66.7 KB 0755
gprofng-display-text File 197.34 KB 0755
graphml2gv File 66.74 KB 0755
grep File 194.3 KB 0755
gresource File 66.17 KB 0755
grim File 66.23 KB 0755
groff File 137.39 KB 0755
grog File 18.75 KB 0755
grops File 201.78 KB 0755
grotty File 201.39 KB 0755
groups File 66.45 KB 0755
growpart File 29.19 KB 0755
gs File 66.22 KB 0755
gsbj File 350 B 0755
gsdj File 352 B 0755
gsdj500 File 352 B 0755
gsettings File 66.17 KB 0755
gslj File 353 B 0755
gslp File 350 B 0755
gsnd File 277 B 0755
gspath File 66.92 KB 0755
gstack File 2.97 KB 0755
gtbl File 194.37 KB 0755
gtf File 66.38 KB 0755
gtk-update-icon-cache File 66.4 KB 0755
gtk4-update-icon-cache File 66.4 KB 0755
gts-config File 2.69 KB 0755
gts2dxf File 66.41 KB 0755
gts2oogl File 67.61 KB 0755
gts2stl File 66.54 KB 0755
gts2xyz File 66.38 KB 0755
gtscheck File 66.49 KB 0755
gtscompare File 66.92 KB 0755
gtstemplate File 5.97 KB 0755
gui-pkinst File 66.48 KB 0755
gui-runcmd File 66.95 KB 0755
gui-updater File 66.53 KB 0755
gunzip File 2.28 KB 0755
gv2gml File 66.55 KB 0755
gv2gxl File 67.05 KB 0755
gvcolor File 76.77 KB 0755
gvgen File 66.38 KB 0755
gvmap File 600.56 KB 0755
gvmap.sh File 2.13 KB 0755
gvpack File 66.94 KB 0755
gvpr File 66.28 KB 0755
gxl2dot File 67.05 KB 0755
gxl2gv File 67.05 KB 0755
gzexe File 6.29 KB 0755
gzip File 131.66 KB 0755
h2ph File 28.15 KB 0755
h2xs File 59.51 KB 0755
hardlink File 66.41 KB 0755
hciattach File 68.3 KB 0755
hciconfig File 194.56 KB 0755
hcitool File 197.91 KB 0755
hd File 66.33 KB 0755
head File 66.46 KB 0755
helpztags File 2.46 KB 0755
hex2hcd File 66.23 KB 0755
hexdump File 66.33 KB 0755
host File 130.73 KB 0755
hostid File 66.45 KB 0755
hostname File 66.09 KB 0755
hostnamectl File 66.32 KB 0755
hp-align File 9.14 KB 0755
hp-check File 39.2 KB 0755
hp-clean File 7.05 KB 0755
hp-colorcal File 9.08 KB 0755
hp-config_usb_printer File 6.98 KB 0755
hp-doctor File 12.69 KB 0755
hp-firmware File 6.47 KB 0755
hp-info File 6.26 KB 0755
hp-levels File 6.85 KB 0755
hp-logcapture File 12.15 KB 0755
hp-makeuri File 5.6 KB 0755
hp-pkservice File 3.13 KB 0755
hp-plugin File 13.62 KB 0755
hp-probe File 7.98 KB 0755
hp-query File 4.94 KB 0755
hp-scan File 86.9 KB 0755
hp-setup File 37.25 KB 0755
hp-testpage File 5.98 KB 0755
hp-timedate File 3.31 KB 0755
htcacheclean File 66.18 KB 0755
htdbm File 66.17 KB 0755
htdigest File 66.17 KB 0755
htop File 390.13 KB 0755
htpasswd File 66.17 KB 0755
httpx File 204 B 0755
iceauth File 66.73 KB 0755
iconv File 66.27 KB 0755
id File 66.46 KB 0755
iecset File 66.24 KB 0755
infocmp File 66.24 KB 0755
infotocap File 130.28 KB 0755
innochecksum File 4.64 MB 0755
innotop File 445.72 KB 0755
inotifywait File 66.24 KB 0755
inotifywatch File 66.24 KB 0755
install File 194.5 KB 0755
instmodsh File 4.27 KB 0755
ionice File 66.32 KB 0755
ip File 731.48 KB 0755
ipa_verify File 66.26 KB 0755
ipcmk File 66.39 KB 0755
ipcrm File 130.32 KB 0755
ipcs File 130.32 KB 0755
ippfind File 66.26 KB 0755
ipptool File 130.17 KB 0755
ir-ctl File 66.26 KB 0755
ischroot File 66.32 KB 0755
ispell-wrapper File 7.05 KB 0755
ivtv-ctl File 66.54 KB 0755
join File 66.5 KB 0755
journalctl File 131.05 KB 0755
json-patch-jsondiff File 1004 B 0755
json_pp File 4.9 KB 0755
jsondiff File 1004 B 0755
jsonpatch File 3.77 KB 0755
jsonpointer File 1.79 KB 0755
jsonschema File 213 B 0755
kanshi File 66.18 KB 0755
kbd_mode File 66.77 KB 0755
kbdinfo File 66.62 KB 0755
kbookmarkmerger File 66.26 KB 0755
kbuildsycoca6 File 66.1 KB 0755
kbxutil File 194.7 KB 0755
kcmshell6 File 66.55 KB 0755
kde-geo-uri-handler File 66.1 KB 0755
kded6 File 130.72 KB 0755
kdtc File 5.6 KB 0755
keditbookmarks File 454.16 KB 0755
kernel-install File 66.59 KB 0755
keyctl File 66.3 KB 0755
kiconfinder6 File 66.27 KB 0755
kill File 66.23 KB 0755
killall File 67.9 KB 0755
kmod File 194.29 KB 0755
kmsblank File 66.33 KB 0755
kmsprint File 66.36 KB 0755
kmstest File 259.42 KB 0755
kquitapp6 File 66.1 KB 0755
kreadconfig6 File 66.26 KB 0755
ktelnetservice6 File 66.25 KB 0755
ktrash6 File 66.25 KB 0755
kwallet-query File 66.44 KB 0755
kwalletd6 File 581.92 KB 0755
kwriteconfig6 File 66.26 KB 0755
l2ping File 66.17 KB 0755
l2test File 66.48 KB 0755
lab-sensible-terminal File 837 B 0755
labnag File 66.76 KB 0755
labwc File 579.05 KB 0755
labwc-pi File 391 B 0755
laptop-detect File 3.74 KB 0755
ld File 2.38 MB 0755
ld.bfd File 2.38 MB 0755
ld.so File 196.63 KB 0755
ldd File 5.19 KB 0755
lefty File 339.02 KB 0755
less File 275.29 KB 0755
lessecho File 66.18 KB 0755
lessfile File 8.83 KB 0755
lesskey File 66.25 KB 0755
lesspipe File 8.83 KB 0755
letsencrypt File 959 B 0755
lexgrog File 131.36 KB 0755
libcamera-bug-report File 2.96 KB 0755
libcamerify File 844 B 0755
libinput File 67.58 KB 0755
libnetcfg File 15.41 KB 0755
link File 66.45 KB 0755
linux-check-removal File 4.6 KB 0755
linux-run-hooks File 3.52 KB 0755
linux-update-symlinks File 6.38 KB 0755
linux-version File 2.67 KB 0755
linux32 File 130.58 KB 0755
linux64 File 130.58 KB 0755
ln File 130.47 KB 0755
lneato File 1.51 KB 0755
lnstat File 66.59 KB 0755
loadkeys File 259.52 KB 0755
loadunimap File 66.96 KB 0755
locale File 73.41 KB 0755
localectl File 66.3 KB 0755
localedef File 331.2 KB 0755
logger File 66.88 KB 0755
logilab-pytest File 134 B 0755
login File 130.43 KB 0755
loginctl File 66.51 KB 0755
logname File 66.45 KB 0755
logresolve File 66.18 KB 0755
look File 66.32 KB 0755
lowntfs-3g File 130.84 KB 0755
lp File 66.16 KB 0755
lp-connection-editor File 777.7 KB 0755
lpoptions File 66.24 KB 0755
lpstat File 66.45 KB 0755
ls File 194.9 KB 0755
lsar File 3.02 MB 0755
lsattr File 66.17 KB 0755
lsb_release File 2.77 KB 0755
lsblk File 322.32 KB 0755
lscpu File 194.32 KB 0755
lsinitramfs File 735 B 0755
lsipc File 130.32 KB 0755
lslocks File 130.73 KB 0755
lslogins File 130.34 KB 0755
lsmem File 130.32 KB 0755
lsmod File 194.29 KB 0755
lsns File 130.32 KB 0755
lsof File 195.9 KB 0755
lspci File 132.04 KB 0755
lspgpot File 1.06 KB 0755
lsusb File 258.27 KB 0755
lto-dump File 28.02 MB 0755
lto-dump-14 File 28.02 MB 0755
lua File 259.18 KB 0755
lua5.1 File 259.18 KB 0755
luac File 194.68 KB 0755
luac5.1 File 194.68 KB 0755
luajit File 578.95 KB 0755
lwrespawn File 135 B 0755
lxclipboard File 66.24 KB 0755
lxpanel-pi File 329.37 KB 0755
lxpanelctl-pi File 66.41 KB 0755
lxpolkit File 66.09 KB 0755
lxsession File 322.32 KB 0755
lxsession-db File 66.24 KB 0755
lxsession-default File 9 KB 0755
lxsession-default-terminal File 1019 B 0755
lxsession-logout File 66.24 KB 0755
lxsession-xdg-autostart File 66.24 KB 0755
lxtask File 66.01 KB 0755
lxterminal File 133.7 KB 0755
lynx File 1.98 MB 0755
lzcat File 130.76 KB 0755
lzcmp File 7.41 KB 0755
lzdiff File 7.41 KB 0755
lzegrep File 10.17 KB 0755
lzfgrep File 10.17 KB 0755
lzgrep File 10.17 KB 0755
lzless File 2.33 KB 0755
lzma File 130.76 KB 0755
lzmainfo File 66.24 KB 0755
lzmore File 2.18 KB 0755
mac2unix File 74.17 KB 0755
make File 327.8 KB 0755
make-first-existing-target File 4.79 KB 0755
make_strings File 75.09 KB 0755
man File 133.25 KB 0755
man-recode File 67.23 KB 0755
mandb File 195.51 KB 0755
manpath File 66.63 KB 0755
mapscrn File 66.97 KB 0755
mariadb File 5.18 MB 0755
mariadb-access File 109.46 KB 0755
mariadb-admin File 4.9 MB 0755
mariadb-analyze File 4.9 MB 0755
mariadb-binlog File 5.15 MB 0755
mariadb-check File 4.9 MB 0755
mariadb-conv File 4.64 MB 0755
mariadb-convert-table-format File 4.28 KB 0755
mariadb-dump File 5.03 MB 0755
mariadb-dumpslow File 8.19 KB 0755
mariadb-find-rows File 3.35 KB 0755
mariadb-fix-extensions File 1.31 KB 0755
mariadb-hotcopy File 34.67 KB 0755
mariadb-import File 5.02 MB 0755
mariadb-install-db File 22.35 KB 0755
mariadb-optimize File 4.9 MB 0755
mariadb-plugin File 4.64 MB 0755
mariadb-repair File 4.9 MB 0755
mariadb-report File 49.02 KB 0755
mariadb-secure-installation File 14.06 KB 0755
mariadb-service-convert File 2.45 KB 0755
mariadb-setpermission File 17.7 KB 0755
mariadb-show File 4.9 MB 0755
mariadb-slap File 4.9 MB 0755
mariadb-tzinfo-to-sql File 4.58 MB 0755
mariadb-upgrade File 5.02 MB 0755
mariadb-waitpid File 4.57 MB 0755
mariadbcheck File 4.9 MB 0755
mariadbd-multi File 26.83 KB 0755
mariadbd-safe File 30.59 KB 0755
mariadbd-safe-helper File 4.57 MB 0755
markdown-it File 221 B 0755
markdown_py File 215 B 0755
mate-polkit File 61 B 0755
mawk File 194.59 KB 0755
mcookie File 66.39 KB 0755
md5sum File 66.46 KB 0755
mdig File 66.27 KB 0755
media-ctl File 66.95 KB 0755
mesa-overlay-control.py File 5.59 KB 0755
meson File 903 B 0755
migrate-pubring-from-classic-gpg File 3 KB 0755
mingle File 472.55 KB 0755
mk_modmap File 15.78 KB 0755
mkdir File 130.45 KB 0755
mkfifo File 130.45 KB 0755
mkfontdir File 65 B 0755
mkfontscale File 67.24 KB 0755
mknod File 130.45 KB 0755
mktemp File 66.45 KB 0755
mkvextract File 3.89 MB 0755
mkvinfo File 2.82 MB 0755
mkvmerge File 6.64 MB 0755
mkvpropedit File 3.38 MB 0755
mm2gv File 130.84 KB 0755
modeline2fb File 4.31 KB 0755
more File 66.32 KB 0755
mount File 130.31 KB 4755
mountpoint File 66.31 KB 0755
mousepad File 66.16 KB 0755
mpris-proxy File 130.43 KB 0755
msql2mysql File 1.41 KB 0755
mt File 131.48 KB 0755
mt-gnu File 131.48 KB 0755
mv File 194.48 KB 0755
mvxattr File 66.16 KB 0755
my_print_defaults File 4.58 MB 0755
myisam_ftdump File 4.89 MB 0755
myisamchk File 5.02 MB 0755
myisamlog File 4.89 MB 0755
myisampack File 4.96 MB 0755
mypy File 230 B 0755
mypyc File 213 B 0755
mysql File 5.18 MB 0755
mysql_install_db File 22.35 KB 0755
mysql_upgrade File 5.02 MB 0755
mysqladmin File 4.9 MB 0755
mysqld_safe File 30.59 KB 0755
mysqldump File 5.03 MB 0755
mytop File 72.03 KB 0755
named-checkconf File 66.23 KB 0755
named-checkzone File 66.24 KB 0755
named-compilezone File 66.24 KB 0755
named-journalprint File 66.16 KB 0755
named-nzd2nzf File 66.16 KB 0755
named-rrchecker File 66.16 KB 0755
namei File 66.32 KB 0755
nano File 324.81 KB 0755
nawk File 776.39 KB 0755
nc File 66.49 KB 0755
nc.openbsd File 66.49 KB 0755
ncdu File 130.15 KB 0755
neato File 66.43 KB 0755
neqn File 913 B 0755
net File 1.08 MB 0755
netcat File 66.49 KB 0755
netstat File 199.42 KB 0755
networkctl File 130.81 KB 0755
newgrp File 66.31 KB 4755
ngettext File 66.25 KB 0755
nhlt-dmic-info File 66.33 KB 0755
nice File 66.45 KB 0755
ninja File 323.64 KB 0755
nisdomainname File 66.09 KB 0755
nl File 66.55 KB 0755
nm File 67.93 KB 0755
nm-online File 66.16 KB 0755
nmblookup File 194.34 KB 0755
nmcli File 1.05 MB 0755
nmtui File 872.9 KB 0755
nmtui-connect File 872.9 KB 0755
nmtui-edit File 872.9 KB 0755
nmtui-hostname File 872.9 KB 0755
nohup File 66.45 KB 0755
nop File 66.41 KB 0755
normalizer File 227 B 0755
nproc File 66.45 KB 0755
nroff File 5.58 KB 0755
nsec3hash File 66.17 KB 0755
nsenter File 130.56 KB 0755
nslookup File 130.7 KB 0755
nstat File 146.43 KB 0755
nsupdate File 130.35 KB 0755
ntfs-3g File 194.88 KB 4755
ntfs-3g.probe File 66.23 KB 0755
ntfscat File 66.27 KB 0755
ntfscluster File 66.27 KB 0755
ntfscmp File 66.27 KB 0755
ntfsdecrypt File 66.28 KB 0755
ntfsfallocate File 66.27 KB 0755
ntfsfix File 66.37 KB 0755
ntfsinfo File 66.28 KB 0755
ntfsls File 67.32 KB 0755
ntfsmove File 66.27 KB 0755
ntfsrecover File 130.36 KB 0755
ntfssecaudit File 130.74 KB 0755
ntfstruncate File 66.2 KB 0755
ntfsusermap File 66.2 KB 0755
ntfswipe File 66.79 KB 0755
ntlm_auth File 130.23 KB 0755
numfmt File 130.51 KB 0755
numpy-config File 216 B 0755
nvlc File 47 B 0755
oLschema2ldif File 66.16 KB 0755
obamenu File 6.78 KB 0755
obexctl File 130.24 KB 0755
objcopy File 199.7 KB 0755
objdump File 394.74 KB 0755
obxprop File 66.16 KB 0755
ocsptool File 130.24 KB 0755
od File 130.47 KB 0755
open File 31.53 KB 0755
openapp File 10.69 KB 0755
openbox File 451.63 KB 0755
openbox-rpd File 76 B 0755
openbox-session File 595 B 0755
openocd File 4.16 MB 0755
openssl File 1.09 MB 0755
opentool File 5.71 KB 0755
openvt File 67.06 KB 0755
osage File 66.43 KB 0755
otpset File 5.79 KB 0755
overlaycheck File 29.76 KB 0755
ovmerge File 47.22 KB 0755
p11-kit File 258.52 KB 0755
p11tool File 387.66 KB 0755
p7zip File 4.64 KB 0755
pager File 275.29 KB 0755
pahole File 259.44 KB 0755
paper File 66.74 KB 0755
paperconf File 66.46 KB 0755
parse-edid File 73.81 KB 0755
partx File 194.32 KB 0755
passwd File 139.09 KB 4755
paste File 66.46 KB 0755
pastebinit File 18.19 KB 0755
patch File 195.45 KB 0755
patchwork File 66.43 KB 0755
pathchk File 66.45 KB 0755
pbget File 2.51 KB 0755
pbput File 2.51 KB 0755
pbputs File 2.51 KB 0755
pcilmr File 66.49 KB 0755
pcmanfm File 327.81 KB 0755
pcmanfm-pi File 145 B 0755
pcre2-config File 1.95 KB 0755
pdb3 File 88.79 KB 0755
pdb3.13 File 88.79 KB 0755
pdbedit File 66.16 KB 0755
pdf2dsc File 705 B 0755
pdf2ps File 909 B 0755
pdfattach File 66.24 KB 0755
pdfdetach File 66.32 KB 0755
pdffonts File 66.33 KB 0755
pdfimages File 66.33 KB 0755
pdfinfo File 66.34 KB 0755
pdfseparate File 66.24 KB 0755
pdfsig File 66.73 KB 0755
pdftocairo File 194.44 KB 0755
pdftohtml File 130.31 KB 0755
pdftoppm File 66.44 KB 0755
pdftops File 66.5 KB 0755
pdftotext File 66.34 KB 0755
pdfunite File 66.24 KB 0755
pdwtags File 194.88 KB 0755
pear File 793 B 0755
peardev File 814 B 0755
pecl File 727 B 0755
peekfd File 66.71 KB 0755
perl File 3.64 MB 0755
perl5.40-aarch64-linux-gnu File 66.37 KB 0755
perl5.40.1 File 3.64 MB 0755
perlbug File 44.52 KB 0755
perldoc File 125 B 0755
perlivp File 10.61 KB 0755
perlthanks File 44.52 KB 0755
perror File 4.79 MB 0755
pf2afm File 498 B 0755
pfbtopfa File 516 B 0755
pfunct File 194.82 KB 0755
pglobal File 194.88 KB 0755
pgrep File 66.32 KB 0755
pgzrun File 212 B 0755
phar File 14.88 KB 0755
phar.phar File 14.88 KB 0755
phar.phar8.4 File 14.88 KB 0755
phar8.4 File 14.88 KB 0755
phar8.4.phar File 14.88 KB 0755
php File 5.76 MB 0755
php8.4 File 5.76 MB 0755
pi-gpk-dbus-service File 196.63 KB 0755
pi-gpk-install-local-file File 131.27 KB 0755
pi-gpk-log File 131.62 KB 0755
pi-gpk-prefs File 131.59 KB 0755
pi-gpk-update-viewer File 196.95 KB 0755
pi-packages File 197.38 KB 0755
pic File 260.19 KB 0755
piclone File 66.88 KB 0755
pico File 324.81 KB 0755
piconv File 8.16 KB 0755
pidof File 66.29 KB 0755
pidwait File 66.32 KB 0755
pinctrl File 66.55 KB 0755
pinentry File 130.52 KB 0755
pinentry-curses File 130.52 KB 0755
pinentry-gnome3 File 130.52 KB 0755
pinentry-x11 File 130.52 KB 0755
ping File 208.45 KB 0755
ping4 File 208.45 KB 0755
ping6 File 208.45 KB 0755
pinky File 66.5 KB 0755
pinout File 960 B 0755
pintest File 962 B 0755
pip File 222 B 0755
pip3 File 222 B 0755
pipewire File 66.24 KB 0755
pipewire-aes67 File 66.24 KB 0755
pipewire-avb File 66.24 KB 0755
pipewire-pulse File 66.24 KB 0755
pishutdown File 66.65 KB 0755
piwiz File 131.8 KB 0755
pkaction File 66.23 KB 0755
pkcheck File 66.23 KB 0755
pkexec File 66.21 KB 4755
pkg-config File 67.96 KB 0755
pkgconf File 67.96 KB 0755
pkill File 66.32 KB 0755
pkttyagent File 66.23 KB 0755
pl File 67.5 KB 0755
pl2link File 68.54 KB 0755
pl2pm File 4.43 KB 0755
plasma-activities-cli6 File 66.17 KB 0755
pldd File 66.15 KB 0755
pldes File 67.2 KB 0755
plget File 67.24 KB 0755
plmerge File 67.54 KB 0755
plog File 146 B 0755
plparse File 67.53 KB 0755
plser File 67.76 KB 0755
plutil File 71.54 KB 0755
plymouth File 66.79 KB 0755
pmap File 66.27 KB 0755
pod2html File 3.95 KB 0755
pod2man File 18.46 KB 0755
pod2text File 12.8 KB 0755
pod2usage File 4.01 KB 0755
podchecker File 3.64 KB 0755
poff File 2.77 KB 0755
pon File 1.33 KB 0755
ppdc File 130.38 KB 0755
ppdhtml File 130.38 KB 0755
ppdi File 130.38 KB 0755
ppdmerge File 66.24 KB 0755
ppdpo File 130.38 KB 0755
pphs File 404 B 0755
pprompt.sh File 336 B 0755
pr File 130.52 KB 0755
precat File 5.52 KB 0755
preconv File 66.37 KB 0755
prefcnt File 194.74 KB 0755
preunzip File 5.52 KB 0755
prezip File 5.52 KB 0755
prezip-bin File 66.16 KB 0755
print File 18.57 KB 0755
printafm File 395 B 0755
printenv File 66.45 KB 0755
printf File 66.45 KB 0755
prlimit File 66.82 KB 0755
procan File 131.93 KB 0755
profiles File 66.16 KB 0755
prove File 13.36 KB 0755
proxy File 66.01 KB 0755
prtstat File 66.63 KB 0755
prune File 66.54 KB 0755
ps File 194.86 KB 0755
ps2ascii File 494 B 0755
ps2epsi File 1.27 KB 0755
ps2pdf File 272 B 0755
ps2pdf12 File 257 B 0755
ps2pdf13 File 257 B 0755
ps2pdf14 File 257 B 0755
ps2pdfwr File 1.05 KB 0755
ps2ps File 647 B 0755
ps2ps2 File 669 B 0755
ps2txt File 494 B 0755
psfaddtable File 66.59 KB 0755
psfgettable File 66.59 KB 0755
psfstriptable File 66.59 KB 0755
psfxtable File 66.59 KB 0755
psktool File 66.24 KB 0755
pslog File 66.42 KB 0755
pstree File 67.66 KB 0755
pstree.x11 File 67.66 KB 0755
ptar File 3.48 KB 0755
ptardiff File 2.58 KB 0755
ptargrep File 4.29 KB 0755
ptx File 66.5 KB 0755
pv File 133.87 KB 0755
pw-cat File 130.24 KB 0755
pw-cli File 130.34 KB 0755
pw-config File 66.24 KB 0755
pw-container File 66.24 KB 0755
pw-dot File 66.24 KB 0755
pw-dsdplay File 130.24 KB 0755
pw-dump File 130.31 KB 0755
pw-encplay File 130.24 KB 0755
pw-link File 66.24 KB 0755
pw-loopback File 66.24 KB 0755
pw-metadata File 66.24 KB 0755
pw-mididump File 66.24 KB 0755
pw-midiplay File 130.24 KB 0755
pw-midirecord File 130.24 KB 0755
pw-mon File 130.27 KB 0755
pw-play File 130.24 KB 0755
pw-profiler File 66.24 KB 0755
pw-record File 130.24 KB 0755
pw-reserve File 66.24 KB 0755
pw-top File 66.24 KB 0755
pwd File 66.45 KB 0755
pwdx File 66.23 KB 0755
pwrkey File 170 B 0755
py3clean File 7.59 KB 0755
py3compile File 12.99 KB 0755
py3versions File 12.52 KB 0755
pyav File 210 B 0755
pybabel File 956 B 0755
pybabel-python3 File 956 B 0755
pydoc File 80 B 0755
pydoc3 File 80 B 0755
pydoc3.13 File 80 B 0755
pygettext3 File 23.87 KB 0755
pygettext3.13 File 23.87 KB 0755
pygmentize File 215 B 0755
pylint File 217 B 0755
pylint-config File 233 B 0755
pyreverse File 223 B 0755
pyserial-miniterm File 975 B 0755
pyserial-ports File 969 B 0755
python File 6.36 MB 0755
python3 File 6.36 MB 0755
python3-config File 3.07 KB 0755
python3.13 File 6.36 MB 0755
python3.13-config File 3.07 KB 0755
pzstd File 706.49 KB 0755
qcam File 322.92 KB 0755
qt-faststart File 66.16 KB 0755
qt5ct File 642.33 KB 0755
qt6ct File 643.85 KB 0755
qvlc File 42 B 0755
ranlib File 67.09 KB 0755
raspi-config File 124.61 KB 0755
raspinfo File 7.51 KB 0755
rbash File 1.35 MB 0755
rctest File 66.19 KB 0755
rdma File 210.61 KB 0755
rds-ctl File 131.22 KB 0755
readelf File 779.66 KB 0755
readlink File 66.45 KB 0755
realpath File 66.46 KB 0755
red File 89 B 0755
rename-user File 2.56 KB 0755
rename.ul File 66.31 KB 0755
renice File 66.31 KB 0755
replace File 4.57 MB 0755
reset File 66.17 KB 0755
resolve_stack_dump File 4.57 MB 0755
resolveip File 4.57 MB 0755
rev File 66.31 KB 0755
rfcomm File 66.57 KB 0755
rgrep File 30 B 0755
rm File 130.46 KB 0755
rmdir File 66.45 KB 0755
rnano File 324.81 KB 0755
rotatelogs File 66.24 KB 0755
routel File 1.62 KB 0755
rp-bookshelf File 67.38 KB 0755
rp-prefapps File 67.52 KB 0755
rpcc File 67.15 KB 0755
rpcgen File 130.91 KB 0755
rpcinfo File 66.54 KB 0755
rpi-bootloader-key-convert File 1.37 KB 0755
rpi-bootloader-version File 1.5 KB 0755
rpi-connect File 7.75 MB 0755
rpi-connect-env File 216 B 0755
rpi-connectd File 13 MB 0755
rpi-eeprom-ab File 66.39 KB 0755
rpi-eeprom-config File 25.59 KB 0755
rpi-eeprom-digest File 5.12 KB 0755
rpi-eeprom-update File 42.28 KB 0755
rpi-fw-crypto File 66.36 KB 0755
rpi-gui-nop File 386.38 KB 0755
rpi-imager File 39.24 MB 0755
rpi-keyboard-config File 1013 B 0755
rpi-keyboard-fw-update File 10.41 KB 0755
rpi-otp-private-key File 6.08 KB 0755
rpi-sign-bootcode File 14.45 KB 0755
rpi-systemd-config File 12.66 KB 0755
rpi-update File 18.33 KB 0755
rpi-usb-gadget File 11.38 KB 0755
rpicam-hello File 66.68 KB 0755
rpicam-jpeg File 131.18 KB 0755
rpicam-raw File 195.23 KB 0755
rpicam-still File 195.47 KB 0755
rpicam-vid File 195.26 KB 0755
rrsync File 12.7 KB 0755
rst-buildhtml File 12.63 KB 0755
rst2html File 220 B 0755
rst2html4 File 222 B 0755
rst2html5 File 222 B 0755
rst2latex File 222 B 0755
rst2man File 218 B 0755
rst2odt File 218 B 0755
rst2odt_prepstyles File 596 B 0755
rst2pseudoxml File 230 B 0755
rst2s5 File 216 B 0755
rst2xetex File 222 B 0755
rst2xml File 218 B 0755
rstpep2html File 678 B 0755
rsync File 594.02 KB 0755
rsync-ssl File 5.01 KB 0755
rtstat File 66.59 KB 0755
run-mailcap File 18.57 KB 0755
run-parts File 66.67 KB 0755
run-with-aspell File 57 B 0755
run0 File 130.92 KB 0755
runcon File 66.45 KB 0755
rview File 1.79 MB 0755
rvlc File 42 B 0755
samba-log-parser File 200 B 0755
samba-regedit File 131.19 KB 0755
samba-tool File 1.23 KB 0755
sane-find-scanner File 195.36 KB 0755
savelog File 10.24 KB 0755
sbout File 113 B 0755
sbtest File 186 B 0755
scalar File 2.29 MB 0755
scanimage File 67.13 KB 0755
sccmap File 66.58 KB 0755
scncopy File 66.33 KB 0755
scp File 258.56 KB 0755
scp-dbus-service File 90 B 0755
screendump File 66.53 KB 0755
script File 130.32 KB 0755
scriptlive File 66.32 KB 0755
scriptreplay File 66.32 KB 0755
scrot File 66.43 KB 0755
sdiff File 67.05 KB 0755
sdptool File 136.13 KB 0755
sed File 131.47 KB 0755
see File 18.57 KB 0755
select-default-iwrap File 474 B 0755
select-editor File 2.62 KB 0755
send2trash File 218 B 0755
sensible-browser File 1.06 KB 0755
sensible-editor File 1.51 KB 0755
sensible-pager File 824 B 0755
sensible-terminal File 1.08 KB 0755
seq File 66.45 KB 0755
sessreg File 66.48 KB 0755
setarch File 130.58 KB 0755
setcifsacl File 66.16 KB 0755
setfacl File 66.23 KB 0755
setfattr File 66.24 KB 0755
setfont File 67.22 KB 0755
setkeycodes File 66.61 KB 0755
setleds File 66.59 KB 0755
setlogcons File 66.62 KB 0755
setmetamode File 66.72 KB 0755
setpci File 66.33 KB 0755
setpriv File 130.32 KB 0755
setsid File 66.31 KB 0755
setterm File 66.32 KB 0755
setup_env File 561 B 0755
setupcon File 35.9 KB 0755
setvtrgb File 66.7 KB 0755
setxkbmap File 66.96 KB 0755
sfdp File 66.43 KB 0755
sfparse File 67.68 KB 0755
sftp File 258.54 KB 0755
sg File 66.31 KB 4755
sh File 194.59 KB 0755
sha1sum File 66.46 KB 0755
sha224sum File 66.46 KB 0755
sha256sum File 66.46 KB 0755
sha384sum File 66.46 KB 0755
sha512sum File 66.46 KB 0755
sharesec File 66.23 KB 0755
shasum File 9.75 KB 0755
showconsolefont File 66.72 KB 0755
showkey File 66.75 KB 0755
showrgb File 66.36 KB 0755
shred File 130.46 KB 0755
shuf File 66.45 KB 0755
size File 66.8 KB 0755
skill File 66.27 KB 0755
slabtop File 66.29 KB 0755
sleep File 66.45 KB 0755
slurp File 66.63 KB 0755
smb2-quota File 6.3 KB 0755
smbcontrol File 66.45 KB 0755
smbinfo File 29.47 KB 0755
smbpasswd File 66.25 KB 0755
smbstatus File 130.23 KB 0755
snice File 66.27 KB 0755
socat File 518.27 KB 0755
socat-broker.sh File 3.04 KB 0755
socat-chain.sh File 8.02 KB 0755
socat-mux.sh File 4.38 KB 0755
socat1 File 518.27 KB 0755
soelim File 66.37 KB 0755
sort File 130.71 KB 0755
spa-acp-tool File 387.95 KB 0755
spa-inspect File 130.33 KB 0755
spa-json-dump File 66.24 KB 0755
spa-monitor File 66.33 KB 0755
spa-resample File 386.45 KB 0755
speaker-test File 66.3 KB 0755
splain File 19 KB 0755
split File 66.88 KB 0755
splitfont File 66.27 KB 0755
sq File 18.52 MB 0755
squeekboard File 16.38 MB 0755
squeekboard-restyled File 428 B 0755
sqv File 1.56 MB 0755
ss File 210.86 KB 0755
ssh File 1 MB 0755
ssh-add File 450.38 KB 0755
ssh-agent File 450.3 KB 2755
ssh-argv0 File 1.42 KB 0755
ssh-copy-id File 13.84 KB 0755
ssh-import-id File 986 B 0755
ssh-import-id-gh File 785 B 0755
ssh-import-id-lp File 785 B 0755
ssh-keygen File 578.49 KB 0755
ssh-keyscan File 578.7 KB 0755
startx File 5.26 KB 0755
startx-rpd File 657 B 0755
stat File 130.47 KB 0755
stdbuf File 66.45 KB 0755
stl2gts File 66.73 KB 0755
strace File 1.75 MB 0755
strace-log-merge File 1.83 KB 0755
streamzip File 7.87 KB 0755
strings File 66.93 KB 0755
strip File 199.71 KB 0755
stty File 130.47 KB 0755
stubgen File 211 B 0755
stubtest File 212 B 0755
su File 130.34 KB 4755
sudo File 327.31 KB 4755
sudoedit File 327.31 KB 4755
sudopwd File 66.42 KB 0755
sudoreplay File 131.83 KB 0755
sum File 66.46 KB 0755
svlc File 46 B 0755
swayidle File 66.19 KB 0755
swaylock File 132.06 KB 0755
symilar File 219 B 0755
sync File 66.45 KB 0755
syscse File 194.81 KB 0755
systemctl File 323.73 KB 0755
systemd-ac-power File 66.3 KB 0755
systemd-analyze File 259.07 KB 0755
systemd-ask-password File 66.45 KB 0755
systemd-cat File 66.31 KB 0755
systemd-cgls File 66.43 KB 0755
systemd-cgtop File 66.35 KB 0755
systemd-confext File 130.51 KB 0755
systemd-creds File 66.64 KB 0755
systemd-delta File 66.3 KB 0755
systemd-detect-virt File 66.3 KB 0755
systemd-escape File 66.3 KB 0755
systemd-firstboot File 66.74 KB 0755
systemd-hwdb File 66.3 KB 0755
systemd-id128 File 66.32 KB 0755
systemd-inhibit File 66.33 KB 0755
systemd-machine-id-setup File 66.48 KB 0755
systemd-mount File 66.65 KB 0755
systemd-notify File 66.57 KB 0755
systemd-path File 66.3 KB 0755
systemd-run File 130.92 KB 0755
systemd-socket-activate File 66.3 KB 0755
systemd-stdio-bridge File 66.31 KB 0755
systemd-sysext File 130.51 KB 0755
systemd-sysusers File 66.52 KB 0755
systemd-tmpfiles File 130.59 KB 0755
systemd-tty-ask-password-agent File 66.3 KB 0755
systemd-umount File 66.65 KB 0755
systemd-vpick File 66.52 KB 0755
systemsettings File 452.52 KB 0755
tabs File 66.16 KB 0755
tac File 66.45 KB 0755
tail File 130.48 KB 0755
tar File 463.3 KB 0755
taskset File 130.32 KB 0755
tbl File 194.37 KB 0755
tdbbackup File 66.16 KB 0755
tdbbackup.tdbtools File 66.16 KB 0755
tdbdump File 66.16 KB 0755
tdbrestore File 66.16 KB 0755
tdbtool File 66.65 KB 0755
tee File 66.46 KB 0755
tempfile File 66.41 KB 0755
test File 66.45 KB 0755
testparm File 66.21 KB 0755
thonny File 945 B 0755
tic File 130.28 KB 0755
timedatectl File 66.3 KB 0755
timeout File 66.87 KB 0755
tload File 66.25 KB 0755
toe File 66.16 KB 0755
top File 135.45 KB 0755
touch File 130.46 KB 0755
tput File 66.2 KB 0755
tqdm File 208 B 0755
tr File 66.45 KB 0755
transform File 66.92 KB 0755
tred File 66.49 KB 0755
troff File 879.8 KB 0755
true File 66.45 KB 0755
truncate File 66.45 KB 0755
trust File 258.52 KB 0755
tset File 66.17 KB 0755
tsort File 66.45 KB 0755
tty File 66.45 KB 0755
twopi File 66.43 KB 0755
tzselect File 21.37 KB 0755
ucf File 35.62 KB 0755
ucfq File 18.46 KB 0755
ucfr File 9.93 KB 0755
uclampset File 130.32 KB 0755
ucs2any File 66.5 KB 0755
udevadm File 643.43 KB 0755
udisksctl File 66.23 KB 0755
ul File 66.32 KB 0755
umax_pp File 195.32 KB 0755
umount File 66.31 KB 4755
uname File 66.46 KB 0755
unar File 2.95 MB 0755
uncompress File 2.28 KB 0755
unexpand File 66.47 KB 0755
unflatten File 66.49 KB 0755
unicode_start File 2.71 KB 0755
unicode_stop File 528 B 0755
uniq File 66.48 KB 0755
unix2dos File 74.17 KB 0755
unix2mac File 74.17 KB 0755
unlink File 66.45 KB 0755
unlzma File 130.76 KB 0755
unmkinitramfs File 66.49 KB 0755
unshare File 130.53 KB 0755
unxz File 130.76 KB 0755
unzip File 195.02 KB 0755
unzipsfx File 130.84 KB 0755
unzstd File 1.26 MB 0755
update-alternatives File 66.25 KB 0755
update-desktop-database File 66.25 KB 0755
update-mime-database File 130.25 KB 0755
upower File 66.16 KB 0755
uptime File 66.23 KB 0755
usb-devices File 4.84 KB 0755
usbhid-dump File 66.24 KB 0755
usbreset File 66.16 KB 0755
userguide-open File 941 B 0755
users File 66.48 KB 0755
uuid File 66.29 KB 0755
v4l2-compliance File 771.53 KB 0755
v4l2-ctl File 524.45 KB 0755
v4l2-sysfs-path File 66.31 KB 0755
varlinkctl File 66.45 KB 0755
vcgencmd File 66.38 KB 0755
vclog File 66.55 KB 0755
vcmailbox File 66.34 KB 0755
vcs-run File 6.75 KB 0755
vdir File 194.9 KB 0755
vi File 1.79 MB 0755
view File 1.79 MB 0755
vim.tiny File 1.79 MB 0755
vimdot File 1.06 KB 0755
vkcube File 387.62 KB 0755
vkcubepp File 457.55 KB 0755
vlc File 66.16 KB 0755
vlc-wrapper File 66.16 KB 0755
vmstat File 66.61 KB 0755
vncagent File 1.02 MB 0755
vncfopshelper File 824.33 KB 0755
vncinitconfig File 52.44 KB 0755
vnclicense File 1016.38 KB 0755
vnclicensewiz File 3.63 MB 0755
vncpamhelper File 720.35 KB 0755
vncpasswd File 648.23 KB 0755
vncserver File 581 B 0755
vncserver-virtual File 1.18 MB 0755
vncserver-virtuald File 3.07 MB 0755
vncserver-x11 File 1.54 MB 4755
vncserver-x11-core File 6.17 MB 0755
vncserver-x11-serviced File 624.28 KB 0755
vncserverui File 4.29 MB 0755
vsftpdwho File 54 B 0755
vulkaninfo File 771.27 KB 0755
w File 66.27 KB 0755
wall File 66.32 KB 0755
watch File 66.7 KB 0755
watchgnupg File 66.16 KB 0755
wayvnc File 202.07 KB 0755
wayvncctl File 69.54 KB 0755
wbinfo File 66.16 KB 0755
wc File 66.47 KB 0755
wcmgr File 65.98 KB 0755
wcurl File 10.98 KB 0755
wdctl File 130.32 KB 0755
webalizer File 212.18 KB 0755
webazolver File 212.18 KB 0755
wf-panel-pi File 711.09 KB 0755
wfpanelctl File 697 B 0755
wget File 467.16 KB 0755
whatis File 67.12 KB 0755
whereis File 66.31 KB 0755
which File 1.05 KB 0755
which.debianutils File 1.05 KB 0755
whiptail File 66.73 KB 0755
who File 66.5 KB 0755
whoami File 66.45 KB 0755
winexe File 194.25 KB 0755
wireplumber File 66.39 KB 0755
wlopm File 66.13 KB 0755
wlr-randr File 66.18 KB 0755
word-list-compress File 66.16 KB 0755
wordview File 8.97 KB 0755
wpa_passphrase File 130.25 KB 0755
wpctl File 66.44 KB 0755
wpexec File 66.3 KB 0755
wsrep_sst_backup File 2.39 KB 0755
wsrep_sst_common File 68.25 KB 0755
wsrep_sst_mariabackup File 51.98 KB 0755
wsrep_sst_mysqldump File 8.82 KB 0755
wsrep_sst_rsync File 29.85 KB 0755
wsrep_sst_rsync_wan File 29.85 KB 0755
www-browser File 1.98 MB 0755
x-session-manager File 657 B 0755
x-terminal-emulator File 133.7 KB 0755
x-window-manager File 451.63 KB 0755
x-www-browser File 848 B 0755
xarchiver File 323.38 KB 0755
xargs File 130.35 KB 0755
xauth File 67.45 KB 0755
xcmsdb File 66.57 KB 0755
xcompmgr File 66.16 KB 0755
xdg-desktop-icon File 22.29 KB 0755
xdg-desktop-menu File 43.17 KB 0755
xdg-email File 28.24 KB 0755
xdg-icon-resource File 31.47 KB 0755
xdg-mime File 46.62 KB 0755
xdg-open File 31.53 KB 0755
xdg-screensaver File 38.55 KB 0755
xdg-settings File 43.31 KB 0755
xdg-user-dir File 234 B 0755
xdg-user-dirs-update File 66.09 KB 0755
xfconf-query File 66.82 KB 0755
xgamma File 66.4 KB 0755
xhost File 66.58 KB 0755
xinit File 66.63 KB 0755
xinput File 67.41 KB 0755
xkbbell File 66.44 KB 0755
xkbcomp File 264.73 KB 0755
xkbevd File 66.73 KB 0755
xkbprint File 130.73 KB 0755
xkbvleds File 67.3 KB 0755
xkbwatch File 67.32 KB 0755
xkeystone File 16.58 KB 0755
xls2csv File 67.35 KB 0755
xml2-config File 1.4 KB 0755
xmlparse File 67.38 KB 0755
xmlstarlet File 130.11 KB 0755
xmodmap File 66.99 KB 0755
xrandr File 67.03 KB 0755
xrdb File 66.89 KB 0755
xrefresh File 66.51 KB 0755
xsel File 66.01 KB 0755
xset File 66.81 KB 0755
xsetmode File 66.38 KB 0755
xsetpointer File 66.4 KB 0755
xsetroot File 66.56 KB 0755
xsettingsd File 66.46 KB 0755
xstdcmap File 66.98 KB 0755
xsubpp File 5.05 KB 0755
xvidtune File 68.16 KB 0755
xwayland-xauth File 448 B 0755
xz File 130.76 KB 0755
xzcat File 130.76 KB 0755
xzcmp File 7.41 KB 0755
xzdiff File 7.41 KB 0755
xzegrep File 10.17 KB 0755
xzfgrep File 10.17 KB 0755
xzgrep File 10.17 KB 0755
xzless File 2.33 KB 0755
xzmore File 2.18 KB 0755
yes File 66.45 KB 0755
ypdomainname File 66.09 KB 0755
zcat File 1.93 KB 0755
zcmp File 1.64 KB 0755
zdiff File 6.3 KB 0755
zdump File 66.09 KB 0755
zegrep File 29 B 0755
zenity File 136.51 KB 0755
zenoty File 66.34 KB 0755
zfgrep File 29 B 0755
zforce File 2.03 KB 0755
zgrep File 8.01 KB 0755
zip File 264.14 KB 0755
zipcloak File 132.36 KB 0755
zipdetails File 231.06 KB 0755
zipgrep File 2.76 KB 0755
zipinfo File 195.02 KB 0755
zipnote File 132.05 KB 0755
zipsplit File 132.05 KB 0755
zless File 2.38 KB 0755
zmore File 1.79 KB 0755
znew File 4.46 KB 0755
zstd File 1.26 MB 0755
zstdcat File 1.26 MB 0755
zstdgrep File 3.78 KB 0755
zstdless File 197 B 0755
zstdmt File 1.26 MB 0755
Filemanager