__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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.216.148: ~ $
#!/bin/sh
# Part of raspi-config https://github.com/RPi-Distro/raspi-config
#
# See LICENSE file for copyright and license details

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)"
WAYFIRE_FILE="$HOMEDIR/.config/wayfire.ini"
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 and 0 all test for specific boards...

is_pione() {
  if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then
    return 0
  elif grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$" /proc/cpuinfo ; then
    return 0
  else
    return 1
  fi
}

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

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

# ...while tests for Pi 3 and 4 just test processor type, so will also find CM3, CM4, Zero 2 etc.

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

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

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 $?
}

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 $?
}

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_wayfire() {
  pgrep wayfire > /dev/null
  return $?
}

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

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

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

is_installed() {
  if [ "$(dpkg -l "$1" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then
    return 1
  else
    return 0
  fi
}

deb_ver () {
  ver=$(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() {
  lua - "$1" "$2" "$3" <<EOF > "$3.bak"
local key=assert(arg[1])
local value=assert(arg[2])
local fn=assert(arg[3])
local file=assert(io.open(fn))
local made_change=false
for line in file:lines() do
  if line:match("^#?%s*"..key.."=.*$") then
    line=key.."="..value
    made_change=true
  end
  print(line)
end

if not made_change then
  print(key.."="..value)
end
EOF
mv "$3.bak" "$3"
}

clear_config_var() {
  lua - "$1" "$2" <<EOF > "$2.bak"
local key=assert(arg[1])
local fn=assert(arg[2])
local file=assert(io.open(fn))
for line in file:lines() do
  if line:match("^%s*"..key.."=.*$") then
    line="#"..line
  end
  print(line)
end
EOF
mv "$2.bak" "$2"
}

get_config_var() {
  lua - "$1" "$2" <<EOF
local key=assert(arg[1])
local fn=assert(arg[2])
local file=assert(io.open(fn))
local found=false
for line in file:lines() do
  local val = line:match("^%s*"..key.."=(.*)$")
  if (val ~= nil) then
    print(val)
    found=true
    break
  end
end
if not found then
   print(0)
end
EOF
}

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_wayfire; then
    if ! grep -q dpms_timeout $WAYFIRE_FILE ; then
      echo 1
    elif ! grep -q "dpms_timeout.*-1" $WAYFIRE_FILE ; then
      echo 0
    else
      echo 1
    fi
  elif 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_wayfire; 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 0 ] ; then
      if grep -q dpms_timeout $WAYFIRE_FILE ; then
        sed -i 's/dpms_timeout.*/dpms_timeout=600/' $WAYFIRE_FILE
      else
        if grep -q "\[idle\]" $WAYFIRE_FILE ; then
          sed -i 's/\[idle]/[idle]\ndpms_timeout=600/' $WAYFIRE_FILE
        else
          echo '\n[idle]\ndpms_timeout=600' >> $WAYFIRE_FILE
          chown $USER:$USER $WAYFIRE_FILE
        fi
      fi
      STATUS=enabled
    elif [ "$RET" -eq 1 ]; then
      if grep -q dpms_timeout $WAYFIRE_FILE ; then
        sed -i 's/dpms_timeout.*/dpms_timeout=-1/' $WAYFIRE_FILE
      else
        if grep -q "\[idle\]" $WAYFIRE_FILE ; then
          sed -i 's/\[idle]/[idle]\ndpms_timeout=-1/' $WAYFIRE_FILE
        else
          echo '\n[idle]\ndpms_timeout=-1' >> $WAYFIRE_FILE
          chown $USER:$USER $WAYFIRE_FILE
        fi
      fi
      STATUS=disabled
    else
      return "$RET"
    fi
  elif 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_wayfire_keyboard() {
  if ! is_wayfire ; then
    return
  fi
  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=$WAYFIRE_FILE
  if [ ! -e $UFILE ] && [ -e /etc/wayfire/template.ini ] ; then
    CONFIG_DIR="$(dirname "$UFILE")"
    if ! [ -d "$CONFIG_DIR" ]; then
      install -o "$USER" -g "$USER" -d "$CONFIG_DIR"
    fi
    cp /etc/wayfire/template.ini $UFILE
    chown $USER:$USER $UFILE
  fi
  if [ -e $UFILE ] ; then
    grep -q "\\[input\\]" $UFILE || printf "\n[input]" >> $UFILE
    if grep -q xkb_model $UFILE ; then sed -i s/xkb_model.*/xkb_model=$MODEL/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_model=$MODEL/ $UFILE ; fi
    if grep -q xkb_layout $UFILE ; then sed -i s/xkb_layout.*/xkb_layout=$LAYOUT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_layout=$LAYOUT/ $UFILE ; fi
    if grep -q xkb_variant $UFILE ; then sed -i s/xkb_variant.*/xkb_variant=$VARIANT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_variant=$VARIANT/ $UFILE ; fi
    if grep -q xkb_options $UFILE ; then sed -i s/xkb_options.*/xkb_options=$OPTIONS/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_options=$OPTIONS/ $UFILE ; fi
  fi
  UFILE="/usr/share/greeter.ini"
  if [ ! -e $UFILE ] && [ -e /etc/wayfire/gtemplate.ini ] ; then
    cp /etc/wayfire/gtemplate.ini $UFILE
  fi
  if [ -e $UFILE ] ; then
    grep -q "\\[input\\]" $UFILE || printf "\n[input]" >> $UFILE
    if grep -q xkb_model $UFILE ; then sed -i s/xkb_model.*/xkb_model=$MODEL/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_model=$MODEL/ $UFILE ; fi
    if grep -q xkb_layout $UFILE ; then sed -i s/xkb_layout.*/xkb_layout=$LAYOUT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_layout=$LAYOUT/ $UFILE ; fi
    if grep -q xkb_variant $UFILE ; then sed -i s/xkb_variant.*/xkb_variant=$VARIANT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_variant=$VARIANT/ $UFILE ; fi
    if grep -q xkb_options $UFILE ; then sed -i s/xkb_options.*/xkb_options=$OPTIONS/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_options=$OPTIONS/ $UFILE ; fi
  fi
}

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_wayfire_keyboard
  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_wayfire_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=$(sed '/^#/d' /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() {
  tr -d " \t\n\r" < /etc/hostname
}

do_hostname() {
  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)
  else
    NEW_HOSTNAME="$1"
    true
  fi
  if [ $? -eq 0 ]; then
    if [ "$INIT" = "systemd" ] && systemctl -q is-active dbus && ! ischroot; then
      hostnamectl set-hostname "$NEW_HOSTNAME" 2> /dev/null
    else
      echo "$NEW_HOSTNAME" > /etc/hostname
    fi
    sed -i "s/127\.0\.1\.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts
    ASK_TO_REBOOT=1
  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 service ssh status | grep -q inactive; then
    echo 1
  else
    echo 0
  fi
}

do_ssh() {
  if [ -e /var/log/regen_ssh_keys.log ] && ! grep -q "^finished" /var/log/regen_ssh_keys.log; then
    whiptail --msgbox "Initial ssh key generation still running. Please wait and try again." 20 60 2
    return 1
  fi
  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() {
  CURRENT=$(get_composite)
  DEFAULT=--defaultno
  if [ $CURRENT -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like composite video output to be enabled? Warning - this will disable the HDMI outputs." $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() {
  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 $(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
  if [ $? -eq 0 ]; then
    case $RES in
      2) JSTRING="volatile"
      ;;
      3) JSTRING="persistent"
      ;;
      4) JSTRING="auto"
      ;;
      5) JSTRING="none"
      ;;
      *) JSTRING=""
      ;;
    esac
    REPLACEMENT="$([ ! -z $JSTRING ] && echo "Storage=$JSTRING" || echo "#Storage=auto")"
    sed --in-place -E "s/^#?Storage=.*/${REPLACEMENT}/" /etc/systemd/journald.conf
    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 [ "$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 "${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 presssed 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
 }

do_libliftoff() {
  if [ "$INTERACTIVE" = True ]; then
    RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "libliftoff Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
        "L1 Disable" "Disable libliftoff hardware overlays" \
        "L2 Enable" "Enable libliftoff hardware overlays" \
        3>&1 1>&2 2>&3)
  else
    RET=$1
    true
  fi
  if [ $? -eq 0 ]; then
    case "$RET" in
      L1*)
        LIBLIFTOFF_ENABLED=0
        STATUS="disabled"
        ;;
      L2*)
        LIBLIFTOFF_ENABLED=1
        STATUS="enabled"
        ;;
      *)
        whiptail --msgbox "Programmer error, unrecognised libliftoff option" 20 60 2
        return 1
        ;;
    esac

    # Create the config dir and/or environment file, if needed
    if [ -z $HOMEDIR ]; then
      whiptail --msgbox "Unknown user home directory" 20 60 2
      return 1
    fi
    LABWC_DIR="$HOMEDIR/.config/labwc"
    if [ ! -e $LABWC_DIR ]; then
      mkdir -p $LABWC_DIR
      chown $USER:$USER $HOMEDIR/.config $LABWC_DIR
    fi
    if [ ! -e $LABWCENV_FILE ]; then
      touch $LABWCENV_FILE
      chown $USER:$USER $LABWCENV_FILE
    fi

    # If there is already a libliftoff line in the env file, replace it.
    # Otherwise, add one.
    if grep -q WLR_DRM_FORCE_LIBLIFTOFF $LABWCENV_FILE; then
      sed -i "s/^.*WLR_DRM_FORCE_LIBLIFTOFF.*$/WLR_DRM_FORCE_LIBLIFTOFF=$LIBLIFTOFF_ENABLED/" $LABWCENV_FILE
    else
      echo "WLR_DRM_FORCE_LIBLIFTOFF=$LIBLIFTOFF_ENABLED" >>$LABWCENV_FILE
    fi

    ASK_TO_REBOOT=1
  else
    return 0
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "libliftoff is $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 override 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 is_pifive; 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 is_pifive; 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_rgpio() {
  if test -e /etc/systemd/system/pigpiod.service.d/public.conf; then
    echo 0
  else
    echo 1
  fi
}

do_rgpio() {
  DEFAULT=--defaultno
  if [ $(get_rgpio) -eq 0 ]; then
    DEFAULT=
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --yesno "Would you like the GPIO server to be accessible over the network?" $DEFAULT 20 60 2
    RET=$?
  else
    RET=$1
  fi
  if [ $RET -eq 0 ]; then
    mkdir -p /etc/systemd/system/pigpiod.service.d/
    cat > /etc/systemd/system/pigpiod.service.d/public.conf << EOF
[Service]
ExecStart=
ExecStart=/usr/bin/pigpiod
EOF
    STATUS=enabled
  elif [ $RET -eq 1 ]; then
    rm -f /etc/systemd/system/pigpiod.service.d/public.conf
    STATUS=disabled
  else
    return $RET
  fi
  systemctl daemon-reload
  if systemctl -q is-enabled pigpiod ; then
    systemctl restart pigpiod
  fi
  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "Remote access to the GPIO server is $STATUS" 20 60 1
  fi
}

get_camera() {
  if [ $(deb_ver) -le 10 ]; then
    CAM=$(get_config_var start_x $CONFIG)
    if [ $CAM -eq 1 ]; then
      echo 0
    else
      echo 1
    fi
  else
    if grep -q camera_auto_detect $CONFIG ; then
      CAM=$(get_config_var camera_auto_detect $CONFIG)
      if [ $CAM -eq 1 ]; then
        echo 0
      else
        echo 1
      fi
    else
      echo 0
    fi
  fi
}

do_camera() {
  if [ $(deb_ver) -le 10 ] && [ ! -e /boot${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
    if [ -f /usr/bin/labwc ]; 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 Wayfire" "Wayfire window manager with Wayland backend" \
          "W3 Labwc" "Labwc window manager with Wayland backend" \
          3>&1 1>&2 2>&3)
    else
      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 Wayfire" "Wayfire window manager with Wayland backend" \
          3>&1 1>&2 2>&3)
    fi
  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=LXDE-pi-wayfire/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=LXDE-pi-wayfire/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=pi-greeter-wayfire/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-test.*/fallback-test=\/usr\/bin\/xfallback.sh/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-session.*/fallback-session=LXDE-pi-x/"
        sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-greeter.*/fallback-greeter=pi-greeter/"
        if [ -e "/var/lib/AccountsService/users/$USER" ] ; then
          sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=LXDE-pi-wayfire/"
        fi
        STATUS="Wayfire on Wayland"
        ;;
      W3*)
        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
}

do_audioconf() {
  sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus systemctl --user -q is-enabled pipewire-pulse > /dev/null 2>&1
  PPENABLED=$?
  sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus systemctl --user -q is-enabled pulseaudio > /dev/null 2>&1
  PAENABLED=$?
  if [ "$INTERACTIVE" = True ]; then
    DEFAULT=1
    if [ "$PPENABLED" = 0 ] ; then
      DEFAULT=2
    fi
    if ! is_installed pulseaudio && ! is_installed pipewire-pulse ; then
      whiptail --msgbox "No audio systems installed" 20 60 1
      RET=1
    else
      if is_installed pulseaudio ; then
        OPTIONS="1 PulseAudio"
      fi
      if is_installed pipewire-pulse ; then
        OPTIONS="$OPTIONS 2 Pipewire"
      fi
      #shellcheck disable=2086
      PPOPT=$(whiptail --menu "Select the audio configuration to use" 20 60 10 $OPTIONS --default-item "$DEFAULT" 3>&1 1>&2 2>&3)
      RET="$?"
    fi
  else
    PPOPT="$1"
    RET=0
  fi
  if [ "$RET" -ne 0 ] ; then
    return
  fi

  if [ "$PPOPT" -eq 2 ] ; then # pipewire selected
    systemctl --global -q disable pulseaudio
    systemctl --global -q enable pipewire-pulse
    systemctl --global -q enable wireplumber
    if [ -e /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf ] ; then
      cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
    fi
    AUDCON="Pipewire"
    if [ "$PAENABLED" = 0 ] ; then
      ASK_TO_REBOOT=1
    fi
  else # pulse selected
    systemctl --global -q disable pipewire-pulse
    systemctl --global -q disable wireplumber
    systemctl --global -q enable pulseaudio
    if [ -e /etc/alsa/conf.d/99-pipewire-default.conf ] ; then
      rm /etc/alsa/conf.d/99-pipewire-default.conf
    fi
    AUDCON="PulseAudio"
    if [ "$PPENABLED" = 0 ] ; then
      ASK_TO_REBOOT=1
    fi
  fi

  if [ "$INTERACTIVE" = True ]; then
    whiptail --msgbox "$AUDCON 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
    oIFS="$IFS"
    if [ "$INTERACTIVE" = True ]; then
      list=$(sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID LANG=C pactl list sinks | grep -e "Sink #" -e "alsa.card_name" | sed s/*//g | sed s/^[' '\\t]*//g | sed s/'Sink #'//g | sed s/'alsa.card_name = '//g | sed s/'bcm2835 '//g | sed s/\"//g | tr '\n' '/')
      if [ -n "$list" ] ; then
        IFS="/"
        AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${list} 3>&1 1>&2 2>&3)
      else
        whiptail --msgbox "No internal audio devices found" 20 60 1
        return 1
      fi
    else
      AUDIO_OUT=$1
      true
    fi
    if [ $? -eq 0 ]; then
      sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-sink $AUDIO_OUT
    fi
    IFS="$oIFS"
  else
    if aplay -l | grep -q "bcm2835 ALSA"; then
      if [ "$INTERACTIVE" = True ]; then
        AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \
          "0" "Auto" \
          "1" "Force 3.5mm ('headphone') jack" \
          "2" "Force HDMI" \
          3>&1 1>&2 2>&3)
      else
        AUDIO_OUT=$1
      fi
      if [ "$?" -eq 0 ] && [ -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 is_wayfire ; then
    W=$(grep ^headless_width $WAYFIRE_FILE | grep -o "[0-9]*")
    H=$(grep ^headless_height $WAYFIRE_FILE | grep -o "[0-9]*")
    if [ -n "$W" ] && [ -n "$H" ] ; then
      echo $W"x"$H
    else
      echo "1280x720"
    fi
  else
    if [ -e /etc/xdg/autostart/vnc_xrandr.desktop ] ; then
      grep fb /etc/xdg/autostart/vnc_xrandr.desktop | cut -f 15 -d ' '
    else
      echo ""
    fi
  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
    if is_wayfire ; then
      W=$(echo "$FUN" | cut -d x -f 1)
      H=$(echo "$FUN" | cut -d x -f 2)
      if grep -q ^headless_width $WAYFIRE_FILE ; then
        sed -i "s/headless_width.*/headless_width = $W/" $WAYFIRE_FILE
        sed -i "s/headless_height.*/headless_height = $H/" $WAYFIRE_FILE
      else
        if grep -q "\[output\]" $WAYFIRE_FILE ; then
          sed -i "s/\[output]/[output]\nheadless_width = $W\nheadless_height = $H/" $WAYFIRE_FILE
        else
          printf '\n[output]\nheadless_width = %d\nheadless_height = %d\n' "$W" "$H" >> $WAYFIRE_FILE
        fi
      fi
    else
      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
    fi
    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"
}

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
}

nonint() {
  "$@"
}

#
# 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)
    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 Logging" "Set storage location for logs" \
      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" \
      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_journald_storage ;;
      *) 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" \
      "I8 Remote GPIO" "Enable/disable remote access to GPIO pins" \
      3>&1 1>&2 2>&3)
  else
    FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
      "I2 SSH" "Enable/disable remote command line access using SSH" \
      3>&1 1>&2 2>&3)
  fi
  RET=$?
  if [ $RET -eq 1 ]; then
    return 0
  elif [ $RET -eq 0 ]; then
    case "$FUN" in
      I1\ *) do_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 ;;
      I8\ *) do_rgpio ;;
      *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
    esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
  fi
}

do_performance_menu() {
  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 Audio Config" "Set audio control system" \
      "A9 PCIe Speed" "Set PCIe x1 port speed" \
      "A10 Network Install UI" "Select display of bootloader network install UI" \
      "A11 Libliftoff" "Enable/disable libliftoff hardware overlays" \
      "A12 Shutdown Behaviour" "Configure shutdown behavior" \
      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" \
      "A8 Audio Config" "Set audio control system" \
      "A10 Network Install UI" "Select display of bootloader network install UI" \
      "A11 Libliftoff" "Enable/disable libliftoff hardware overlays" \
      "A12 Shutdown Behaviour" "Configure shutdown behavior" \
      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" \
      "A8 Audio Config" "Set audio control system" \
      "A11 Libliftoff" "Enable/disable libliftoff hardware overlays" \
      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" \
      "A8 Audio Config" "Set audio control system" \
      "A11 Libliftoff" "Enable/disable libliftoff hardware overlays" \
      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_audioconf ;;
      A9\ *) do_pci ;;
      A10\ *) do_network_install_ui ;;
      A11\ *) do_libliftoff ;;
      A12\ *) do_power_off_on_halt ;;
      *) 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
411toppm File 65.8 KB 0755
7z File 39 B 0755
7za File 40 B 0755
7zr File 40 B 0755
GET File 15.82 KB 0755
HEAD File 15.82 KB 0755
HTMLLinker File 71.74 KB 0755
JxrDecApp File 22.16 KB 0755
JxrEncApp File 23.52 KB 0755
POST File 15.82 KB 0755
R File 8.75 KB 0755
RTIMULibCal File 66.47 KB 0755
RTIMULibDrive11 File 66.25 KB 0755
Rscript File 66.16 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.28 MB 0755
[ File 66.74 KB 0755
aa-enabled File 66.09 KB 0755
aa-exec File 66.28 KB 0755
aa-features-abi File 66.3 KB 0755
aarch64-linux-gnu-addr2line File 67 KB 0755
aarch64-linux-gnu-ar File 67.01 KB 0755
aarch64-linux-gnu-as File 454.76 KB 0755
aarch64-linux-gnu-c++filt File 66.39 KB 0755
aarch64-linux-gnu-cpp File 1.26 MB 0755
aarch64-linux-gnu-cpp-12 File 1.26 MB 0755
aarch64-linux-gnu-dwp File 1.82 MB 0755
aarch64-linux-gnu-elfedit File 66.9 KB 0755
aarch64-linux-gnu-g++ File 1.26 MB 0755
aarch64-linux-gnu-g++-12 File 1.26 MB 0755
aarch64-linux-gnu-gcc File 1.26 MB 0755
aarch64-linux-gnu-gcc-12 File 1.26 MB 0755
aarch64-linux-gnu-gcc-ar File 66.48 KB 0755
aarch64-linux-gnu-gcc-ar-12 File 66.48 KB 0755
aarch64-linux-gnu-gcc-nm File 66.48 KB 0755
aarch64-linux-gnu-gcc-nm-12 File 66.48 KB 0755
aarch64-linux-gnu-gcc-ranlib File 66.48 KB 0755
aarch64-linux-gnu-gcc-ranlib-12 File 66.48 KB 0755
aarch64-linux-gnu-gcov File 708.14 KB 0755
aarch64-linux-gnu-gcov-12 File 708.14 KB 0755
aarch64-linux-gnu-gcov-dump File 579.99 KB 0755
aarch64-linux-gnu-gcov-dump-12 File 579.99 KB 0755
aarch64-linux-gnu-gcov-tool File 580.07 KB 0755
aarch64-linux-gnu-gcov-tool-12 File 580.07 KB 0755
aarch64-linux-gnu-gfortran File 1.26 MB 0755
aarch64-linux-gnu-gfortran-12 File 1.26 MB 0755
aarch64-linux-gnu-gold File 5.26 MB 0755
aarch64-linux-gnu-gp-archive File 195.11 KB 0755
aarch64-linux-gnu-gp-collect-app File 195.16 KB 0755
aarch64-linux-gnu-gp-display-html File 578.29 KB 0755
aarch64-linux-gnu-gp-display-src File 194.71 KB 0755
aarch64-linux-gnu-gp-display-text File 261.28 KB 0755
aarch64-linux-gnu-gprof File 132.18 KB 0755
aarch64-linux-gnu-gprofng File 194.49 KB 0755
aarch64-linux-gnu-ld File 1.63 MB 0755
aarch64-linux-gnu-ld.bfd File 1.63 MB 0755
aarch64-linux-gnu-ld.gold File 5.26 MB 0755
aarch64-linux-gnu-lto-dump File 25.77 MB 0755
aarch64-linux-gnu-lto-dump-12 File 25.77 MB 0755
aarch64-linux-gnu-nm File 67.84 KB 0755
aarch64-linux-gnu-objcopy File 199.55 KB 0755
aarch64-linux-gnu-objdump File 394.5 KB 0755
aarch64-linux-gnu-pkg-config File 67.88 KB 0755
aarch64-linux-gnu-pkgconf File 67.88 KB 0755
aarch64-linux-gnu-python3-config File 3.01 KB 0755
aarch64-linux-gnu-python3.11-config File 3.01 KB 0755
aarch64-linux-gnu-ranlib File 67.01 KB 0755
aarch64-linux-gnu-readelf File 779.36 KB 0755
aarch64-linux-gnu-size File 66.71 KB 0755
aarch64-linux-gnu-strings File 66.84 KB 0755
aarch64-linux-gnu-strip File 199.56 KB 0755
ab File 66.23 KB 0755
aconnect File 66.16 KB 0755
addpart File 66.16 KB 0755
addr2line File 67 KB 0755
aggregate_profile File 1.84 KB 0755
agnostics File 66.77 KB 0755
airscan-discover File 195.01 KB 0755
alacarte File 1.01 KB 0755
alsabat File 66.2 KB 0755
alsaloop File 131.09 KB 0755
alsamixer File 132.02 KB 0755
alsatplg File 130.16 KB 0755
alsaucm File 66.6 KB 0755
amidi File 66.16 KB 0755
amixer File 66.22 KB 0755
animate File 66.09 KB 0755
animate-im6 File 66.09 KB 0755
animate-im6.q16 File 66.09 KB 0755
anytopnm File 12.26 KB 0755
apg File 274 B 0755
apgbfm File 22.3 KB 0755
aplay File 130.21 KB 0755
aplaymidi File 66.16 KB 0755
appres File 10.32 KB 0755
apropos File 67.03 KB 0755
apt File 66.16 KB 0755
apt-cache File 130.3 KB 0755
apt-cdrom File 66.31 KB 0755
apt-config File 66.16 KB 0755
apt-extracttemplates File 66.25 KB 0755
apt-file File 31.04 KB 0755
apt-ftparchive File 258.41 KB 0755
apt-get File 66.24 KB 0755
apt-key File 27.32 KB 0755
apt-listchanges File 11.96 KB 0755
apt-mark File 66.24 KB 0755
apt-sortpkgs File 66.17 KB 0755
ar File 67.01 KB 0755
arch File 66.81 KB 0755
arecord File 130.21 KB 0755
arecordmidi File 66.17 KB 0755
aria_chk File 5.46 MB 0755
aria_dump_log File 5.27 MB 0755
aria_ftdump File 5.27 MB 0755
aria_pack File 5.27 MB 0755
aria_read_log File 5.39 MB 0755
ark File 194.15 KB 0755
arpaname File 66.08 KB 0755
as File 454.76 KB 0755
asciitopgm File 65.8 KB 0755
aseqdump File 66.16 KB 0755
aseqnet File 66.2 KB 0755
atktopbm File 65.8 KB 0755
attr File 66.08 KB 0755
autogsdoc File 382.95 KB 0755
autotouch File 1.28 KB 0755
avstopam File 65.8 KB 0755
awk File 712.3 KB 0755
axfer File 130.26 KB 0755
b2sum File 66.95 KB 0755
base32 File 66.87 KB 0755
base64 File 66.87 KB 0755
basename File 66.8 KB 0755
basenc File 66.87 KB 0755
bash File 1.28 MB 0755
bashbug File 6.71 KB 0755
bc File 90.59 KB 0755
bdftopcf File 38.27 KB 0755
bdftruncate File 10.09 KB 0755
bioradtopgm File 65.8 KB 0755
bluemoon File 66.16 KB 0755
bluetooth-sendto File 66.16 KB 0755
bluetoothctl File 388.88 KB 0755
bmptopnm File 65.8 KB 0755
bmptoppm File 65.8 KB 0755
breeze-settings5 File 66.08 KB 0755
brushtopbm File 65.8 KB 0755
btattach File 66.16 KB 0755
bthelper File 1.52 KB 0755
btmgmt File 197.55 KB 0755
btmon File 1 MB 0755
btuart File 1010 B 0755
bunzip2 File 66.14 KB 0755
busctl File 130.35 KB 0755
busybox File 834.63 KB 0755
bwrap File 66.23 KB 0755
bzcat File 66.14 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.14 KB 0755
bzip2recover File 66.08 KB 0755
bzless File 1.27 KB 0755
bzmore File 1.27 KB 0755
c++ File 1.26 MB 0755
c++filt File 66.39 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
cacaclock File 66.53 KB 0755
cacademo File 322.51 KB 0755
cacafire File 66.36 KB 0755
cacaplay File 66.33 KB 0755
cacaserver File 66.43 KB 0755
cacaview File 66.6 KB 0755
cam File 322.25 KB 0755
camera-bug-report File 4.95 KB 0755
cameratopam File 129.88 KB 0755
canberra-gtk-play File 14 KB 0755
cancel File 66.09 KB 0755
cancel-rename File 1.62 KB 0755
captoinfo File 130.2 KB 0755
cat File 66.93 KB 0755
catdoc File 67.67 KB 0755
catman File 66.52 KB 0755
catppt File 67.14 KB 0755
cc File 1.26 MB 0755
cct File 66.27 KB 0755
cd-create-profile File 66.08 KB 0755
cd-fix-profile File 66.08 KB 0755
cd-iccdump File 66.08 KB 0755
cd-it8 File 66.08 KB 0755
cec-compliance File 324.2 KB 0755
cec-ctl File 393.31 KB 0755
cec-follower File 194.76 KB 0755
certbot File 958 B 0755
cgi-fcgi File 65.93 KB 0755
chacl File 66.08 KB 0755
chafa File 194.06 KB 0755
chage File 134.2 KB 2755
chardet File 221 B 0755
chardetect File 221 B 0755
chattr File 66.09 KB 0755
chcon File 67.09 KB 0755
check-language-support File 2.71 KB 0755
checkgid File 66.09 KB 0755
chfn File 68.96 KB 4755
chgrp File 67.01 KB 0755
chmod File 66.95 KB 0755
choom File 66.16 KB 0755
chown File 67.02 KB 0755
chromium File 6.02 KB 0755
chromium-browser File 6.02 KB 0755
chrt File 130.16 KB 0755
chsh File 67.45 KB 4755
chvt File 66.55 KB 0755
cifscreds File 66.41 KB 0755
ciptool File 66.25 KB 0755
cistopbm File 65.8 KB 0755
cjpeg File 66.18 KB 0755
ckbcomp File 147.14 KB 0755
cksum File 131.01 KB 0755
clear File 66.09 KB 0755
clear_console File 66.01 KB 0755
cmp File 66.83 KB 0755
cmuwmtopbm File 65.8 KB 0755
codepage File 66.29 KB 0755
col File 66.16 KB 0755
colcrt File 66.16 KB 0755
colormgr File 66.11 KB 0755
colrm File 66.16 KB 0755
column File 66.16 KB 0755
comm File 66.87 KB 0755
compare File 66.12 KB 0755
compare-im6 File 66.12 KB 0755
compare-im6.q16 File 66.12 KB 0755
compose File 18.06 KB 0755
composite File 66.09 KB 0755
composite-im6 File 66.09 KB 0755
composite-im6.q16 File 66.09 KB 0755
con2fbmap File 65.93 KB 0755
conjure File 66.09 KB 0755
conjure-im6 File 66.09 KB 0755
conjure-im6.q16 File 66.09 KB 0755
convert File 66.09 KB 0755
convert-dtsv0 File 66.18 KB 0755
convert-im6 File 66.09 KB 0755
convert-im6.q16 File 66.09 KB 0755
corelist File 15.01 KB 0755
cp File 195.57 KB 0755
cpan File 8.16 KB 0755
cpan5.36-aarch64-linux-gnu File 8.19 KB 0755
cpio File 198.34 KB 0755
cpp File 1.26 MB 0755
cpp-12 File 1.26 MB 0755
create_xauth File 104 B 0755
crontab File 66.44 KB 2755
cs2cs File 66.2 KB 0755
csplit File 131.1 KB 0755
ctstat File 66.43 KB 0755
cupstestppd File 66.16 KB 0755
curl File 322.16 KB 0755
cut File 66.91 KB 0755
cvlc File 45 B 0755
cvtenc File 68.55 KB 0755
cvtsudoers File 332.84 KB 0755
cx18-ctl File 66.39 KB 0755
dash File 130.51 KB 0755
date File 131 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.08 KB 0755
dbus-daemon File 258.4 KB 0755
dbus-launch File 65.92 KB 0755
dbus-monitor File 66.08 KB 0755
dbus-run-session File 66.08 KB 0755
dbus-send File 66.08 KB 0755
dbus-update-activation-environment File 66.08 KB 0755
dbus-uuidgen File 66.08 KB 0755
dbwrap_tool File 66.3 KB 0755
dc File 50.02 KB 0755
dconf File 66.01 KB 0755
dd File 131.1 KB 0755
ddbugtopbm File 65.8 KB 0755
ddcmon File 12.97 KB 0755
deallocvt File 66.51 KB 0755
deb-systemd-helper File 23.79 KB 0755
deb-systemd-invoke File 6.09 KB 0755
debconf File 2.79 KB 0755
debconf-apt-progress File 11.27 KB 0755
debconf-communicate File 608 B 0755
debconf-copydb File 1.68 KB 0755
debconf-escape File 647 B 0755
debconf-get-selections File 1.72 KB 0755
debconf-getlang File 6.94 KB 0755
debconf-loadtemplate File 933 B 0755
debconf-mergetemplate File 5.09 KB 0755
debconf-set-selections File 2.92 KB 0755
debconf-show File 1.78 KB 0755
debian-reference File 243 B 0755
debugapp File 985 B 0755
decode-dimms File 107 KB 0755
decode-edid File 5.47 KB 0755
decode-vaio File 6.38 KB 0755
decode_tm6000 File 66.44 KB 0755
defaults File 68.9 KB 0755
delpart File 66.16 KB 0755
delv File 69.04 KB 0755
derb File 66.65 KB 0755
desktop-file-edit File 92.2 KB 0755
desktop-file-install File 92.2 KB 0755
desktop-file-validate File 76.43 KB 0755
devdump File 199.88 KB 0755
df File 131.73 KB 0755
dh_bash-completion File 4.31 KB 0755
dh_installtex File 17.96 KB 0755
dh_installxmlcatalogs File 9.22 KB 0755
dh_numpy3 File 1.94 KB 0755
dh_perl_dbi File 1.17 KB 0755
dh_perl_openssl File 1.53 KB 0755
diff File 195.42 KB 0755
diff3 File 66.97 KB 0755
dig File 194.58 KB 0755
dillo File 903.02 KB 0755
dillo-install-hyphenation File 5.59 KB 0755
dir File 195.74 KB 0755
dircolors File 66.87 KB 0755
dirmngr File 582.19 KB 0755
dirmngr-client File 130.68 KB 0755
dirname File 66.8 KB 0755
dirsplit File 16.74 KB 0755
display File 66.09 KB 0755
display-im6 File 66.09 KB 0755
display-im6.q16 File 66.09 KB 0755
djpeg File 66.18 KB 0755
dm-tool File 66.09 KB 0755
dmesg File 138.4 KB 0755
dmypy File 234 B 0755
dnsdomainname File 66.01 KB 0755
dnssec-cds File 67.05 KB 0755
dnssec-dsfromkey File 66.16 KB 0755
dnssec-importkey File 66.16 KB 0755
dnssec-keyfromlabel File 66.16 KB 0755
dnssec-keygen File 66.16 KB 0755
dnssec-revoke File 66.16 KB 0755
dnssec-settime File 66.16 KB 0755
dnssec-signzone File 130.2 KB 0755
dnssec-verify File 66.17 KB 0755
dnstap-read File 66.1 KB 0755
docutils File 960 B 0755
domainname File 66.01 KB 0755
dos2unix File 54.09 KB 0755
dpkg File 322.48 KB 0755
dpkg-architecture File 14.85 KB 0755
dpkg-buildapi File 1.79 KB 0755
dpkg-buildflags File 8.14 KB 0755
dpkg-buildpackage File 34.13 KB 0755
dpkg-buildtree File 1.88 KB 0755
dpkg-checkbuilddeps File 7.45 KB 0755
dpkg-deb File 194.47 KB 0755
dpkg-distaddfile File 2.72 KB 0755
dpkg-divert File 194.4 KB 0755
dpkg-genbuildinfo File 18.54 KB 0755
dpkg-genchanges File 17.92 KB 0755
dpkg-gencontrol File 14.24 KB 0755
dpkg-gensymbols File 10.66 KB 0755
dpkg-maintscript-helper File 20.71 KB 0755
dpkg-mergechangelogs File 8.87 KB 0755
dpkg-name File 6.61 KB 0755
dpkg-parsechangelog File 4.83 KB 0755
dpkg-query File 194.4 KB 0755
dpkg-realpath File 4.09 KB 0755
dpkg-scanpackages File 8.45 KB 0755
dpkg-scansources File 9.1 KB 0755
dpkg-shlibdeps File 31.46 KB 0755
dpkg-source File 23.05 KB 0755
dpkg-split File 130.32 KB 0755
dpkg-statoverride File 130.2 KB 0755
dpkg-trigger File 130.33 KB 0755
dpkg-vendor File 3.18 KB 0755
driverless File 66.1 KB 0755
driverless-fax File 537 B 0755
dtc File 199.67 KB 0755
dtdiff File 680 B 0755
dtmerge File 66.41 KB 0755
dtoverlay File 66.9 KB 0755
dtparam File 66.9 KB 0755
du File 195.3 KB 0755
dump_xsettings File 22.27 KB 0755
dumpkeys File 194.99 KB 0755
dumpmscat File 66.08 KB 0755
dvdauthor File 195.59 KB 0755
dvddirdel File 876 B 0755
dvdunauthor File 130.16 KB 0755
dvgrab File 298.1 KB 0755
dvipdf File 1007 B 0755
dwp File 1.82 MB 0755
echo File 66.8 KB 0755
ed File 66.29 KB 0755
edit File 18.06 KB 0755
editor File 324.64 KB 0755
editres File 81.41 KB 0755
eepdump File 66.41 KB 0755
eepflash.sh File 4.31 KB 0755
eepmake File 66.38 KB 0755
egrep File 41 B 0755
eject File 130.01 KB 0755
elfedit File 66.9 KB 0755
enc2xs File 40.96 KB 0755
encguess File 3 KB 0755
env File 67.38 KB 0755
envsubst File 66.16 KB 0755
eom File 514.16 KB 0755
eps2eps File 639 B 0755
epstool File 259.23 KB 0755
epylint File 219 B 0755
eqn File 265.2 KB 0755
escp2topbm File 65.8 KB 0755
evince File 515.58 KB 0755
evince-previewer File 66.54 KB 0755
evince-thumbnailer File 66.16 KB 0755
ex File 1.65 MB 0755
exifautotran File 1.11 KB 0755
expand File 66.86 KB 0755
expiry File 66.29 KB 2755
expr File 131 KB 0755
eyuvtoppm File 65.8 KB 0755
f2py File 949 B 0755
f2py3 File 957 B 0755
f2py3.11 File 960 B 0755
f77 File 1.26 MB 0755
f95 File 1.26 MB 0755
faad File 67.48 KB 0755
factor File 131.15 KB 0755
faillog File 66.37 KB 0755
faked-sysv File 66.65 KB 0755
faked-tcp File 66.66 KB 0755
fakeroot File 3.9 KB 0755
fakeroot-sysv File 3.9 KB 0755
fakeroot-tcp File 3.9 KB 0755
fallocate File 66.16 KB 0755
false File 66.78 KB 0755
fbcli File 66.16 KB 0755
fbd-theme-validate File 130.16 KB 0755
fbset File 66.09 KB 0755
fbtest File 66.17 KB 0755
fc-cache File 66.47 KB 0755
fc-cat File 66.41 KB 0755
fc-conflist File 66.22 KB 0755
fc-list File 66.28 KB 0755
fc-match File 66.35 KB 0755
fc-pattern File 66.27 KB 0755
fc-query File 66.24 KB 0755
fc-scan File 66.3 KB 0755
fc-validate File 66.29 KB 0755
fcgistarter File 66.09 KB 0755
fdtdump File 66.17 KB 0755
fdtget File 66.17 KB 0755
fdtoverlay File 66.17 KB 0755
fdtput File 66.17 KB 0755
ffmpeg File 322.4 KB 0755
ffplay File 194.39 KB 0755
ffprobe File 198.91 KB 0755
fgconsole File 66.56 KB 0755
fgrep File 41 B 0755
fiascotopnm File 130.65 KB 0755
figlet File 22.91 KB 0755
figlet-toilet File 22.91 KB 0755
filan File 131.85 KB 0755
file File 66.33 KB 0755
file2brl File 66.01 KB 0755
filezilla File 4.19 MB 0755
fincore File 66.2 KB 0755
find File 259.41 KB 0755
findmnt File 131.43 KB 0755
fio File 1.73 MB 0755
fio-btrace2fio File 66.15 KB 0755
fio-dedupe File 66.24 KB 0755
fio-genzipf File 66.2 KB 0755
fio-verify-state File 66.08 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
fitstopnm File 65.8 KB 0755
flask File 948 B 0755
flock File 66.23 KB 0755
fmt File 66.87 KB 0755
fold File 66.87 KB 0755
fonttosfnt File 34.27 KB 0755
foomatic-rip File 143.14 KB 0755
free File 66.16 KB 0755
fstopgm File 65.8 KB 0755
funzip File 66.34 KB 0755
fuser File 67.6 KB 0755
fusermount File 66.16 KB 4755
fusermount3 File 66.16 KB 4755
fzputtygen File 322.01 KB 0755
fzsftp File 642.46 KB 0755
g++ File 1.26 MB 0755
g++-12 File 1.26 MB 0755
g3topbm File 66.63 KB 0755
galculator File 156.41 KB 0755
galera_new_cluster File 917 B 0755
galera_recovery File 3.29 KB 0755
gamma4scanimage File 66.09 KB 0755
gapplication File 66.16 KB 0755
gatttool File 131.35 KB 0755
gawk File 712.3 KB 0755
gawkbug File 6.55 KB 0755
gcc File 1.26 MB 0755
gcc-12 File 1.26 MB 0755
gcc-ar File 66.48 KB 0755
gcc-ar-12 File 66.48 KB 0755
gcc-nm File 66.48 KB 0755
gcc-nm-12 File 66.48 KB 0755
gcc-ranlib File 66.48 KB 0755
gcc-ranlib-12 File 66.48 KB 0755
gchempaint File 22.34 KB 0755
gchempaint-0.14 File 22.34 KB 0755
gcore File 3.43 KB 0755
gcov File 708.14 KB 0755
gcov-12 File 708.14 KB 0755
gcov-dump File 579.99 KB 0755
gcov-dump-12 File 579.99 KB 0755
gcov-tool File 580.07 KB 0755
gcov-tool-12 File 580.07 KB 0755
gcr-viewer File 66.15 KB 0755
gdb File 10.01 MB 0755
gdb-add-index File 4.52 KB 0755
gdbtui File 126 B 0755
gdbus File 66.16 KB 0755
gdialog File 9.01 KB 0755
gdk-pixbuf-csource File 66.11 KB 0755
gdk-pixbuf-pixdata File 66.09 KB 0755
gdk-pixbuf-thumbnailer File 66.17 KB 0755
gdm-control File 66.08 KB 0755
gdnc File 74.26 KB 0755
gdomap File 65.94 KB 0755
geany File 66.04 KB 0755
gemtopbm File 65.8 KB 0755
gemtopnm File 65.8 KB 0755
genbrk File 66.55 KB 0755
gencat File 66.48 KB 0755
gencfu File 66.5 KB 0755
gencnval File 66.41 KB 0755
gendict File 66.55 KB 0755
genfio File 8.63 KB 0755
genisoimage File 665.41 KB 0755
genrb File 195.79 KB 0755
geod File 66.1 KB 0755
geoiplookup File 66.09 KB 0755
geoiplookup6 File 66.09 KB 0755
geqn File 265.2 KB 0755
get-edid File 14.16 KB 0755
get_objgraph File 1.61 KB 0755
getcifsacl File 66.09 KB 0755
getconf File 66.25 KB 0755
geteltorito File 6.06 KB 0755
getent File 67.19 KB 0755
getfacl File 66.63 KB 0755
getfattr File 66.53 KB 0755
getkeycodes File 66.51 KB 0755
getopt File 66.16 KB 0755
gettext File 66.16 KB 0755
gettext.sh File 5.07 KB 0755
gfortran File 1.26 MB 0755
gfortran-12 File 1.26 MB 0755
ghb File 7.22 MB 0755
ghostscript File 66.12 KB 0755
gie File 66.2 KB 0755
giftopnm File 65.8 KB 0755
ginstall-info File 131.71 KB 0755
gio File 130.21 KB 0755
gio-querymodules File 66.09 KB 0755
git File 3.58 MB 0755
git-receive-pack File 3.58 MB 0755
git-shell File 2.09 MB 0755
git-upload-archive File 3.58 MB 0755
git-upload-pack File 3.58 MB 0755
gkbd-keyboard-display File 66.07 KB 0755
glib-compile-schemas File 66.31 KB 0755
gmake File 238.46 KB 0755
gnome-control-center File 3.07 MB 0755
gnome-help File 66.01 KB 0755
gnome-keyring File 66.29 KB 0755
gnome-keyring-3 File 66.29 KB 0755
gnome-keyring-daemon File 1.13 MB 0755
gnome-www-browser File 6.02 KB 0755
gnumeric File 66.16 KB 0755
gnuplot File 1.88 MB 0755
gnuplot-qt File 1.88 MB 0755
gold File 5.26 MB 0755
gouldtoppm File 65.8 KB 0755
gp-archive File 195.11 KB 0755
gp-collect-app File 195.16 KB 0755
gp-display-html File 578.29 KB 0755
gp-display-src File 194.71 KB 0755
gp-display-text File 261.28 KB 0755
gpasswd File 134.13 KB 4755
gpg File 1.08 MB 0755
gpg-agent File 453.05 KB 0755
gpg-connect-agent File 194.78 KB 0755
gpg-wks-server File 258.84 KB 0755
gpg-zip File 3.43 KB 0755
gpg2 File 1.08 MB 0755
gpgcompose File 901.96 KB 0755
gpgconf File 198.53 KB 0755
gpgparsemail File 66.16 KB 0755
gpgsm File 583.56 KB 0755
gpgsplit File 130.4 KB 0755
gpgtar File 195.36 KB 0755
gpgv File 514.83 KB 0755
gpic File 260.11 KB 0755
gpiodetect File 66.16 KB 0755
gpiofind File 66.16 KB 0755
gpioget File 66.16 KB 0755
gpioinfo File 66.16 KB 0755
gpiomon File 66.16 KB 0755
gpioset File 66.16 KB 0755
gprof File 132.18 KB 0755
gprofng File 194.49 KB 0755
grdctl File 66.17 KB 0755
grep File 194.22 KB 0755
gresource File 66.09 KB 0755
grim File 30.16 KB 0755
groff File 137.31 KB 0755
grog File 2.71 KB 0755
grops File 201.7 KB 0755
grotty File 137.33 KB 0755
groups File 66.86 KB 0755
gs File 66.12 KB 0755
gsbj File 350 B 0755
gsdj File 352 B 0755
gsdj500 File 352 B 0755
gsettings File 66.09 KB 0755
gslj File 353 B 0755
gslp File 350 B 0755
gsnd File 277 B 0755
gspath File 66.88 KB 0755
gtbl File 194.29 KB 0755
gtf File 66.3 KB 0755
gtk-nop File 66.05 KB 0755
gtk-update-icon-cache File 66.32 KB 0755
gtk4-broadwayd File 195.3 KB 0755
gtk4-builder-tool File 66.91 KB 0755
gtk4-encode-symbolic-svg File 8.27 MB 0755
gtk4-launch File 66.23 KB 0755
gtk4-query-settings File 66.09 KB 0755
gtk4-update-icon-cache File 66.48 KB 0755
gui-pkinst File 66.45 KB 0755
gui-updater File 66.52 KB 0755
gunzip File 2.29 KB 0755
gzexe File 6.3 KB 0755
gzip File 91.55 KB 0755
h2ph File 28.54 KB 0755
h2xs File 59.51 KB 0755
handbrake File 7.22 MB 0755
handbrake-gtk File 7.22 MB 0755
hardlink File 66.23 KB 0755
hciattach File 68.23 KB 0755
hciconfig File 200.13 KB 0755
hcitool File 199.66 KB 0755
hd File 66.17 KB 0755
hdifftopam File 65.8 KB 0755
hdmi-audio-select File 682 B 0755
head File 66.89 KB 0755
helpztags File 2.46 KB 0755
hex2hcd File 66.16 KB 0755
hexdump File 66.17 KB 0755
hipstopgm File 65.8 KB 0755
host File 130.56 KB 0755
hostid File 66.8 KB 0755
hostname File 66.01 KB 0755
hostnamectl File 66.23 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
hpcdtoppm File 799 B 0755
htcacheclean File 66.09 KB 0755
htdbm File 66.09 KB 0755
htdigest File 66.09 KB 0755
htop File 325.66 KB 0755
htpasswd File 66.09 KB 0755
httpx File 204 B 0755
iceauth File 66.64 KB 0755
icontopbm File 65.8 KB 0755
iconv File 66.87 KB 0755
icuexportdata File 69.05 KB 0755
icuinfo File 66.4 KB 0755
id File 66.95 KB 0755
identify File 66.1 KB 0755
identify-im6 File 66.1 KB 0755
identify-im6.q16 File 66.1 KB 0755
iecset File 66.16 KB 0755
ilbmtoppm File 65.88 KB 0755
imagetops File 1.21 KB 0755
img2sixel File 22.09 KB 0755
img2txt File 66.77 KB 0755
imgtoppm File 65.8 KB 0755
import File 66.09 KB 0755
import-im6 File 66.09 KB 0755
import-im6.q16 File 66.09 KB 0755
info File 334.5 KB 0755
infobrowser File 334.5 KB 0755
infocmp File 66.16 KB 0755
infotocap File 130.2 KB 0755
infotopam File 65.84 KB 0755
innochecksum File 4.57 MB 0755
innotop File 445.44 KB 0755
install File 195.73 KB 0755
install-info File 131.71 KB 0755
instmodsh File 4.27 KB 0755
invgeod File 66.1 KB 0755
invproj File 66.19 KB 0755
ionice File 66.16 KB 0755
ip File 729.26 KB 0755
ipa_verify File 66.17 KB 0755
ipcmk File 66.23 KB 0755
ipcrm File 66.16 KB 0755
ipcs File 130.16 KB 0755
ippfind File 66.18 KB 0755
ipptool File 130.09 KB 0755
iptables-xml File 132.77 KB 0755
ir-ctl File 66.17 KB 0755
ischroot File 66.18 KB 0755
isodump File 199.88 KB 0755
isoinfo File 342.2 KB 0755
isovfy File 199.84 KB 0755
ispell-wrapper File 7.05 KB 0755
ivtv-ctl File 66.46 KB 0755
java File 65.91 KB 0755
jbigtopnm File 76.63 KB 0755
jexec File 65.9 KB 0755
join File 66.95 KB 0755
journalctl File 130.49 KB 0755
jp2a File 70.53 KB 0755
jpackage File 65.92 KB 0755
jpeg2ktopam File 264.27 KB 0755
jpegexiforient File 66.09 KB 0755
jpegtopnm File 65.88 KB 0755
jpegtran File 66.11 KB 0755
json_pp File 4.88 KB 0755
jsonpointer File 1.79 KB 0755
jsonschema File 213 B 0755
kactivities-cli File 66.01 KB 0755
kanshi File 66.1 KB 0755
kazam File 6.28 KB 0755
kbd_mode File 66.69 KB 0755
kbdinfo File 66.54 KB 0755
kbookmarkmerger File 66.09 KB 0755
kbuildsycoca5 File 65.93 KB 0755
kbxutil File 194.61 KB 0755
kcookiejar5 File 66.15 KB 0755
kde-geo-uri-handler File 65.93 KB 0755
kdeconnect-app File 66.09 KB 0755
kdeconnect-cli File 66.09 KB 0755
kdeconnect-handler File 66.09 KB 0755
kdeconnect-indicator File 130.16 KB 0755
kdeconnect-settings File 66.09 KB 0755
kdeconnect-sms File 258.28 KB 0755
kded5 File 130.01 KB 0755
kdeinit5 File 66.12 KB 0755
kdeinit5_shutdown File 66.08 KB 0755
kdeinit5_wrapper File 66.08 KB 0755
kdenlive File 9 MB 0755
kdenlive_render File 130.16 KB 0755
kdtc File 5.51 KB 0755
keditbookmarks File 386.16 KB 0755
kernel-install File 12.75 KB 0755
keyctl File 66.22 KB 0755
keytool File 65.92 KB 0755
kglobalaccel5 File 66.09 KB 0755
kiconfinder5 File 66.09 KB 0755
kill File 66.16 KB 0755
killall File 67.81 KB 0755
kmod File 194.28 KB 0755
kmsblank File 66.25 KB 0755
kmsprint File 66.28 KB 0755
kmstest File 259.27 KB 0755
kpackagelauncherqml File 65.93 KB 0755
kpackagetool5 File 130.01 KB 0755
kquitapp5 File 65.93 KB 0755
kreadconfig5 File 66.09 KB 0755
kshell5 File 66.08 KB 0755
ktelnetservice5 File 66.08 KB 0755
ktrash5 File 66.08 KB 0755
kwallet-query File 66.16 KB 0755
kwalletd5 File 578.27 KB 0755
kwrapper5 File 66.08 KB 0755
kwriteconfig5 File 66.09 KB 0755
l2ping File 66.09 KB 0755
l2test File 66.41 KB 0755
labwc File 514.95 KB 0755
labwc-pi File 391 B 0755
labwc-prompt File 66.18 KB 0755
lame File 130.18 KB 0755
laptop-detect File 3.73 KB 0755
last File 66.16 KB 0755
lastb File 66.16 KB 0755
lastlog File 67.55 KB 0755
lc-compliance File 514.27 KB 0755
lcf File 7.6 KB 0755
ld File 1.63 MB 0755
ld.bfd File 1.63 MB 0755
ld.gold File 5.26 MB 0755
ld.so File 198.16 KB 0755
ldd File 5.19 KB 0755
leaftoppm File 65.8 KB 0755
less File 209.96 KB 0755
lessecho File 66.1 KB 0755
lessfile File 8.83 KB 0755
lesskey File 67.48 KB 0755
lesspipe File 8.83 KB 0755
letsencrypt File 958 B 0755
lexgrog File 131.28 KB 0755
libcamerify File 844 B 0755
libinput File 67.37 KB 0755
libnetcfg File 15.41 KB 0755
libpng-config File 2.41 KB 0755
libpng16-config File 2.41 KB 0755
libsixel-config File 1.81 KB 0755
link File 66.8 KB 0755
linux-check-removal File 4.56 KB 0755
linux-update-symlinks File 6.17 KB 0755
linux-version File 2.63 KB 0755
linux32 File 66.41 KB 0755
linux64 File 66.41 KB 0755
lispmtopgm File 65.8 KB 0755
listres File 14.69 KB 0755
ln File 67.05 KB 0755
lnstat File 66.43 KB 0755
loadkeys File 259.43 KB 0755
loadunimap File 66.88 KB 0755
locale File 73.91 KB 0755
localectl File 66.23 KB 0755
localedef File 331.92 KB 0755
logger File 66.73 KB 0755
logilab-pytest File 134 B 0755
login File 67.59 KB 0755
loginctl File 66.38 KB 0755
logname File 66.8 KB 0755
logresolve File 66.09 KB 0755
look File 66.16 KB 0755
lowntfs-3g File 130.77 KB 0755
lp File 66.09 KB 0755
lp-connection-editor File 841.9 KB 0755
lp_solve File 46.86 KB 0755
lpoptions File 66.16 KB 0755
lpstat File 66.37 KB 0755
ls File 195.74 KB 0755
lsar File 2.99 MB 0755
lsattr File 66.09 KB 0755
lsb_release File 2.59 KB 0755
lsblk File 258.16 KB 0755
lscpu File 130.16 KB 0755
lsfd File 132.14 KB 0755
lsinitramfs File 735 B 0755
lsipc File 130.16 KB 0755
lsirq File 66.33 KB 0755
lslocks File 130.54 KB 0755
lslogins File 130.19 KB 0755
lsmem File 130.16 KB 0755
lsmod File 194.28 KB 0755
lsns File 130.16 KB 0755
lsof File 203.44 KB 0755
lspci File 131.85 KB 0755
lspgpot File 1.06 KB 0755
lsusb File 295 KB 0755
lto-dump File 25.77 MB 0755
lto-dump-12 File 25.77 MB 0755
lua File 198.95 KB 0755
lua5.1 File 198.95 KB 0755
luac File 126.45 KB 0755
luac5.1 File 126.45 KB 0755
luajit File 578.96 KB 0755
luit File 48.78 KB 0755
lwp-download File 10.05 KB 0755
lwp-dump File 2.65 KB 0755
lwp-mirror File 2.36 KB 0755
lwp-request File 15.82 KB 0755
lwrespawn File 135 B 0755
lxappearance File 51.67 KB 0755
lxclipboard File 66.16 KB 0755
lxde-logout File 90 B 0755
lxhotkey File 17.93 KB 0755
lxpanel File 195.77 KB 0755
lxpanelctl File 65.93 KB 0755
lxpolkit File 66.01 KB 0755
lxrandr File 25.93 KB 0755
lxsession File 322.23 KB 0755
lxsession-db File 66.16 KB 0755
lxsession-default File 9 KB 0755
lxsession-default-terminal File 1019 B 0755
lxsession-edit File 65.93 KB 0755
lxsession-logout File 66.12 KB 0755
lxsession-xdg-autostart File 66.16 KB 0755
lxtask File 65.93 KB 0755
lxterminal File 133.39 KB 0755
lynx File 1.92 MB 0755
lzcat File 130.51 KB 0755
lzcmp File 7.25 KB 0755
lzdiff File 7.25 KB 0755
lzegrep File 10.09 KB 0755
lzfgrep File 10.09 KB 0755
lzgrep File 10.09 KB 0755
lzless File 1.77 KB 0755
lzma File 130.51 KB 0755
lzmainfo File 66.16 KB 0755
lzmore File 2.14 KB 0755
mac2unix File 54.09 KB 0755
macptopbm File 65.8 KB 0755
make File 238.46 KB 0755
make-first-existing-target File 4.79 KB 0755
make_strings File 75.7 KB 0755
makeconv File 66.85 KB 0755
makeinfo File 52.86 KB 0755
malcontent-client File 22.54 KB 0755
malcontent-control File 66.12 KB 0755
man File 133.16 KB 0755
man-recode File 67.14 KB 0755
mandb File 195.43 KB 0755
manpath File 66.55 KB 0755
mapscrn File 66.88 KB 0755
mariadb File 5.05 MB 0755
mariadb-access File 109.31 KB 0755
mariadb-admin File 4.83 MB 0755
mariadb-analyze File 4.83 MB 0755
mariadb-binlog File 5.09 MB 0755
mariadb-check File 4.83 MB 0755
mariadb-conv File 4.57 MB 0755
mariadb-convert-table-format File 4.12 KB 0755
mariadb-dump File 4.96 MB 0755
mariadb-dumpslow File 8.05 KB 0755
mariadb-find-rows File 3.21 KB 0755
mariadb-fix-extensions File 1.22 KB 0755
mariadb-hotcopy File 34.53 KB 0755
mariadb-import File 4.83 MB 0755
mariadb-install-db File 22.13 KB 0755
mariadb-optimize File 4.83 MB 0755
mariadb-plugin File 4.57 MB 0755
mariadb-repair File 4.83 MB 0755
mariadb-report File 49.02 KB 0755
mariadb-secure-installation File 13.49 KB 0755
mariadb-service-convert File 2.45 KB 0755
mariadb-setpermission File 17.56 KB 0755
mariadb-show File 4.83 MB 0755
mariadb-slap File 4.83 MB 0755
mariadb-tzinfo-to-sql File 4.57 MB 0755
mariadb-upgrade File 4.96 MB 0755
mariadb-waitpid File 4.51 MB 0755
mariadbcheck File 4.83 MB 0755
mariadbd-multi File 26.69 KB 0755
mariadbd-safe File 30.42 KB 0755
mariadbd-safe-helper File 4.51 MB 0755
markdown-it File 220 B 0755
markdown_py File 969 B 0755
mate-polkit File 61 B 0755
mawk File 150.49 KB 0755
mbim-network File 11.08 KB 0755
mbimcli File 199.46 KB 0755
mcookie File 66.23 KB 0755
md5sum File 66.91 KB 0755
md5sum.textutils File 66.91 KB 0755
mdatopbm File 65.8 KB 0755
mdig File 66.18 KB 0755
media-ctl File 66.78 KB 0755
melt File 65.93 KB 0755
melt-7 File 65.93 KB 0755
memusage File 7.3 KB 0755
memusagestat File 66.42 KB 0755
mencoder File 2.57 MB 0755
mesa-overlay-control.py File 5.59 KB 0755
mesg File 66.16 KB 0755
meson File 903 B 0755
mgrtopbm File 65.8 KB 0755
migrate-pubring-from-classic-gpg File 2.99 KB 0755
mk_modmap File 15.78 KB 0755
mkdir File 131.23 KB 0755
mkfifo File 67.13 KB 0755
mkfontdir File 65 B 0755
mkfontscale File 34.9 KB 0755
mkisofs File 665.41 KB 0755
mknod File 67.16 KB 0755
mktemp File 66.87 KB 0755
mkvextract File 3.57 MB 0755
mkvinfo File 2.7 MB 0755
mkvmerge File 6.14 MB 0755
mkvpropedit File 3.01 MB 0755
mkzftree File 66.66 KB 0755
mmcli File 265.49 KB 0755
modeline2fb File 4.31 KB 0755
mogrify File 66.09 KB 0755
mogrify-im6 File 66.09 KB 0755
mogrify-im6.q16 File 66.09 KB 0755
monitor-sensor File 14.09 KB 0755
montage File 66.09 KB 0755
montage-im6 File 66.09 KB 0755
montage-im6.q16 File 66.09 KB 0755
more File 66.16 KB 0755
mount File 66.16 KB 4755
mountpoint File 66.16 KB 0755
mousepad File 66.09 KB 0755
mpeg2desc File 66.17 KB 0755
mpiCC File 66.51 KB 0755
mpiCC.openmpi File 66.51 KB 0755
mpic++ File 66.51 KB 0755
mpic++.openmpi File 66.51 KB 0755
mpicc File 66.51 KB 0755
mpicc.openmpi File 66.51 KB 0755
mpicxx File 66.51 KB 0755
mpicxx.openmpi File 66.51 KB 0755
mpiexec File 66.28 KB 0755
mpiexec.openmpi File 66.28 KB 0755
mpif77 File 66.51 KB 0755
mpif77.openmpi File 66.51 KB 0755
mpif90 File 66.51 KB 0755
mpif90.openmpi File 66.51 KB 0755
mpifort File 66.51 KB 0755
mpifort.openmpi File 66.51 KB 0755
mpijavac File 4.7 KB 0755
mpijavac.pl File 4.7 KB 0755
mpirun File 66.28 KB 0755
mpirun.openmpi File 66.28 KB 0755
mplayer File 3.01 MB 0755
mpris-proxy File 130.35 KB 0755
mrftopbm File 65.8 KB 0755
msql2mysql File 1.41 KB 0755
mt File 131.12 KB 0755
mt-gnu File 131.12 KB 0755
mtrace File 6.35 KB 0755
mtvtoppm File 65.8 KB 0755
mv File 131.57 KB 0755
mvxattr File 66.08 KB 0755
my_print_defaults File 4.51 MB 0755
myisam_ftdump File 4.83 MB 0755
myisamchk File 4.96 MB 0755
myisamlog File 4.83 MB 0755
myisampack File 4.89 MB 0755
mypy File 230 B 0755
mypyc File 213 B 0755
mysql File 5.05 MB 0755
mysql_convert_table_format File 4.12 KB 0755
mysql_find_rows File 3.21 KB 0755
mysql_fix_extensions File 1.22 KB 0755
mysql_install_db File 22.13 KB 0755
mysql_plugin File 4.57 MB 0755
mysql_secure_installation File 13.49 KB 0755
mysql_setpermission File 17.56 KB 0755
mysql_tzinfo_to_sql File 4.57 MB 0755
mysql_upgrade File 4.96 MB 0755
mysql_waitpid File 4.51 MB 0755
mysqlaccess File 109.31 KB 0755
mysqladmin File 4.83 MB 0755
mysqlanalyze File 4.83 MB 0755
mysqlbinlog File 5.09 MB 0755
mysqlcheck File 4.83 MB 0755
mysqld_multi File 26.69 KB 0755
mysqld_safe File 30.42 KB 0755
mysqld_safe_helper File 4.51 MB 0755
mysqldump File 4.96 MB 0755
mysqldumpslow File 8.05 KB 0755
mysqlhotcopy File 34.53 KB 0755
mysqlimport File 4.83 MB 0755
mysqloptimize File 4.83 MB 0755
mysqlrepair File 4.83 MB 0755
mysqlreport File 49.02 KB 0755
mysqlshow File 4.83 MB 0755
mysqlslap File 4.83 MB 0755
mytop File 71.95 KB 0755
named-checkconf File 66.16 KB 0755
named-checkzone File 66.16 KB 0755
named-compilezone File 66.16 KB 0755
named-journalprint File 66.08 KB 0755
named-nzd2nzf File 66.08 KB 0755
named-rrchecker File 66.08 KB 0755
namei File 66.16 KB 0755
nano File 324.64 KB 0755
nawk File 712.3 KB 0755
ncdu File 130.07 KB 0755
ncurses5-config File 8.28 KB 0755
ncurses6-config File 8.28 KB 0755
ncursesw5-config File 8.28 KB 0755
ncursesw6-config File 8.28 KB 0755
neofetch File 333.58 KB 0755
neotoppm File 65.8 KB 0755
neqn File 913 B 0755
net File 1.02 MB 0755
netstat File 199.34 KB 0755
networkctl File 130.49 KB 0755
newgrp File 67.55 KB 4755
ngettext File 66.16 KB 0755
nice File 66.84 KB 0755
ninja File 323.49 KB 0755
nisdomainname File 66.01 KB 0755
nl File 131.08 KB 0755
nm File 67.84 KB 0755
nm-applet File 259.98 KB 0755
nm-connection-editor File 770.78 KB 0755
nm-online File 66.08 KB 0755
nmblookup File 194.26 KB 0755
nmcli File 1007.52 KB 0755
nmtui File 805.5 KB 0755
nmtui-connect File 805.5 KB 0755
nmtui-edit File 805.5 KB 0755
nmtui-hostname File 805.5 KB 0755
nohup File 66.86 KB 0755
noip-duc File 2.51 MB 0755
normalizer File 244 B 0755
nproc File 66.85 KB 0755
nroff File 3.22 KB 0755
nsec3hash File 66.09 KB 0755
nsenter File 66.38 KB 0755
nslookup File 130.55 KB 0755
nstat File 144.27 KB 0755
nsupdate File 66.29 KB 0755
ntfs-3g File 194.8 KB 4755
ntfs-3g.probe File 66.16 KB 0755
ntfscat File 66.19 KB 0755
ntfscluster File 66.19 KB 0755
ntfscmp File 66.19 KB 0755
ntfsdecrypt File 66.2 KB 0755
ntfsfallocate File 66.2 KB 0755
ntfsfix File 66.29 KB 0755
ntfsinfo File 66.2 KB 0755
ntfsls File 67.24 KB 0755
ntfsmove File 66.19 KB 0755
ntfsrecover File 130.28 KB 0755
ntfssecaudit File 130.66 KB 0755
ntfstruncate File 66.12 KB 0755
ntfsusermap File 66.11 KB 0755
ntfswipe File 66.7 KB 0755
ntpmon File 20.7 KB 0755
ntpq File 69.28 KB 0755
ntptrace File 5.39 KB 0755
numfmt File 130.98 KB 0755
nvlc File 47 B 0755
oLschema2ldif File 66.08 KB 0755
obamenu File 6.76 KB 0755
obconf File 73.93 KB 0755
obexctl File 130.17 KB 0755
obfs4proxy File 4.87 MB 0755
objcopy File 199.55 KB 0755
objdump File 394.5 KB 0755
obxprop File 66.08 KB 0755
octave File 68.01 KB 0755
octave-cli File 66.48 KB 0755
od File 130.96 KB 0755
ogg123 File 131.48 KB 0755
oggdec File 66.45 KB 0755
oggenc File 131.88 KB 0755
ogginfo File 66.17 KB 0755
ompi-clean File 66.72 KB 0755
ompi-server File 66.8 KB 0755
ompi_info File 66.47 KB 0755
opal_wrapper File 66.51 KB 0755
opalc++ File 66.51 KB 0755
opalcc File 66.51 KB 0755
open File 25.46 KB 0755
openapp File 10.69 KB 0755
openbox File 387.55 KB 0755
openbox-lxde File 77 B 0755
openbox-lxde-pi File 80 B 0755
openbox-session File 595 B 0755
openocd File 4.16 MB 0755
openssl File 992.91 KB 0755
opentool File 5.71 KB 0755
openvt File 66.98 KB 0755
orte-clean File 66.72 KB 0755
orte-info File 66.9 KB 0755
orte-server File 66.8 KB 0755
ortecc File 66.51 KB 0755
orted File 66.23 KB 0755
orterun File 66.28 KB 0755
oshCC File 66.51 KB 0755
oshc++ File 66.51 KB 0755
oshcc File 66.51 KB 0755
oshcxx File 66.51 KB 0755
oshfort File 66.51 KB 0755
oshmem_info File 66.44 KB 0755
oshrun File 66.28 KB 0755
otpset File 5.79 KB 0755
overlaycheck File 25.35 KB 0755
ovmerge File 46.81 KB 0755
p11-kit File 66.17 KB 0755
p7zip File 4.64 KB 0755
pa-info File 2.29 KB 0755
pacat File 66.2 KB 0755
pacmd File 66.16 KB 0755
pactl File 130.18 KB 0755
padsp File 2.18 KB 0755
pager File 209.96 KB 0755
palmtopnm File 65.8 KB 0755
pamaddnoise File 65.8 KB 0755
pamaltsat File 65.84 KB 0755
pamarith File 65.8 KB 0755
pambackground File 65.8 KB 0755
pambayer File 65.88 KB 0755
pambrighten File 65.8 KB 0755
pamcat File 65.8 KB 0755
pamchannel File 65.8 KB 0755
pamcomp File 65.8 KB 0755
pamcrater File 65.8 KB 0755
pamcut File 65.8 KB 0755
pamdeinterlace File 65.8 KB 0755
pamdepth File 65.8 KB 0755
pamdice File 65.8 KB 0755
pamditherbw File 65.81 KB 0755
pamedge File 65.8 KB 0755
pamendian File 65.8 KB 0755
pamenlarge File 65.88 KB 0755
pamexec File 65.8 KB 0755
pamfile File 65.8 KB 0755
pamfind File 65.8 KB 0755
pamfix File 65.8 KB 0755
pamfixtrunc File 2.01 KB 0755
pamflip File 65.8 KB 0755
pamfunc File 65.8 KB 0755
pamgauss File 65.8 KB 0755
pamgetcolor File 65.88 KB 0755
pamgradient File 65.8 KB 0755
pamhomography File 65.8 KB 0755
pamhue File 65.8 KB 0755
pamlevels File 65.8 KB 0755
pamlookup File 65.8 KB 0755
pammasksharpen File 65.8 KB 0755
pammixinterlace File 65.88 KB 0755
pammixmulti File 65.8 KB 0755
pammosaicknit File 65.8 KB 0755
pamoil File 65.8 KB 0755
pamon File 66.2 KB 0755
pampaintspill File 65.8 KB 0755
pamperspective File 65.88 KB 0755
pampick File 65.8 KB 0755
pampop9 File 65.8 KB 0755
pamrecolor File 65.8 KB 0755
pamrestack File 65.8 KB 0755
pamrgbatopng File 65.8 KB 0755
pamrubber File 65.8 KB 0755
pamscale File 65.88 KB 0755
pamseq File 65.8 KB 0755
pamshadedrelief File 65.8 KB 0755
pamsharpmap File 65.8 KB 0755
pamsharpness File 65.8 KB 0755
pamshuffle File 65.8 KB 0755
pamsistoaglyph File 65.8 KB 0755
pamslice File 65.8 KB 0755
pamsplit File 65.8 KB 0755
pamstack File 65.8 KB 0755
pamstereogram File 65.8 KB 0755
pamstretch File 65.8 KB 0755
pamstretch-gen File 3.83 KB 0755
pamsumm File 65.8 KB 0755
pamsummcol File 65.8 KB 0755
pamtable File 65.8 KB 0755
pamthreshold File 65.8 KB 0755
pamtilt File 65.8 KB 0755
pamtoavs File 65.8 KB 0755
pamtodjvurle File 65.8 KB 0755
pamtofits File 65.8 KB 0755
pamtogif File 65.8 KB 0755
pamtohdiff File 65.8 KB 0755
pamtohtmltbl File 65.8 KB 0755
pamtojpeg2k File 264.27 KB 0755
pamtompfont File 65.8 KB 0755
pamtooctaveimg File 65.8 KB 0755
pamtopam File 65.8 KB 0755
pamtopdbimg File 65.88 KB 0755
pamtopfm File 65.8 KB 0755
pamtopng File 65.8 KB 0755
pamtopnm File 65.8 KB 0755
pamtoqoi File 65.8 KB 0755
pamtosrf File 65.8 KB 0755
pamtosvg File 65.8 KB 0755
pamtotga File 65.8 KB 0755
pamtotiff File 65.88 KB 0755
pamtouil File 65.8 KB 0755
pamtowinicon File 65.8 KB 0755
pamtoxvmini File 65.8 KB 0755
pamtris File 65.8 KB 0755
pamundice File 65.8 KB 0755
pamunlookup File 65.8 KB 0755
pamvalidate File 65.8 KB 0755
pamwipeout File 65.8 KB 0755
pamx File 65.88 KB 0755
pandoc File 214.26 MB 0755
paperconf File 66.23 KB 0755
paplay File 66.2 KB 0755
parec File 66.2 KB 0755
parecord File 66.2 KB 0755
parse-edid File 21.73 KB 0755
partx File 130.16 KB 0755
passwd File 70.36 KB 4755
paste File 66.84 KB 0755
pastebinit File 16.31 KB 0755
pasuspender File 66.17 KB 0755
patch File 183.36 KB 0755
pathchk File 66.82 KB 0755
pax11publish File 66.09 KB 0755
pbget File 2.51 KB 0755
pbmclean File 65.8 KB 0755
pbmlife File 65.8 KB 0755
pbmmake File 65.8 KB 0755
pbmmask File 65.8 KB 0755
pbmminkowski File 65.8 KB 0755
pbmnoise File 65.8 KB 0755
pbmpage File 65.8 KB 0755
pbmpscale File 65.8 KB 0755
pbmreduce File 65.8 KB 0755
pbmtext File 65.97 KB 0755
pbmtextps File 65.8 KB 0755
pbmto10x File 65.8 KB 0755
pbmto4425 File 65.8 KB 0755
pbmtoascii File 65.8 KB 0755
pbmtoatk File 65.8 KB 0755
pbmtobbnbg File 65.8 KB 0755
pbmtocis File 65.8 KB 0755
pbmtocmuwm File 65.8 KB 0755
pbmtodjvurle File 65.8 KB 0755
pbmtoepsi File 65.8 KB 0755
pbmtoepson File 65.8 KB 0755
pbmtoescp2 File 65.8 KB 0755
pbmtog3 File 66.63 KB 0755
pbmtogem File 65.8 KB 0755
pbmtogo File 65.8 KB 0755
pbmtoibm23xx File 65.8 KB 0755
pbmtoicon File 65.8 KB 0755
pbmtolj File 65.8 KB 0755
pbmtoln03 File 65.8 KB 0755
pbmtolps File 65.8 KB 0755
pbmtomacp File 65.8 KB 0755
pbmtomatrixorbital File 65.8 KB 0755
pbmtomda File 65.8 KB 0755
pbmtomgr File 65.8 KB 0755
pbmtomrf File 65.8 KB 0755
pbmtonokia File 65.8 KB 0755
pbmtopgm File 65.8 KB 0755
pbmtopi3 File 65.8 KB 0755
pbmtopk File 66.09 KB 0755
pbmtoplot File 65.8 KB 0755
pbmtoppa File 65.88 KB 0755
pbmtopsg3 File 67.43 KB 0755
pbmtoptx File 65.8 KB 0755
pbmtosunicon File 65.8 KB 0755
pbmtowbmp File 65.8 KB 0755
pbmtox10bm File 2.83 KB 0755
pbmtoxbm File 65.8 KB 0755
pbmtoybm File 65.8 KB 0755
pbmtozinc File 65.8 KB 0755
pbmupc File 65.8 KB 0755
pbput File 2.51 KB 0755
pbputs File 2.51 KB 0755
pc1toppm File 65.8 KB 0755
pcdindex File 6.56 KB 0755
pcdovtoppm File 6.56 KB 0755
pcmanfm File 327.73 KB 0755
pcre-config File 2.29 KB 0755
pcre2-config File 1.93 KB 0755
pcxtoppm File 65.8 KB 0755
pdb3 File 62.4 KB 0755
pdb3.11 File 62.4 KB 0755
pdbedit File 66.08 KB 0755
pdbimgtopam File 65.88 KB 0755
pdf2dsc File 698 B 0755
pdf2ps File 909 B 0755
pdfattach File 66.16 KB 0755
pdfdetach File 66.24 KB 0755
pdffonts File 66.25 KB 0755
pdfimages File 66.25 KB 0755
pdfinfo File 66.26 KB 0755
pdfseparate File 66.16 KB 0755
pdfsig File 66.52 KB 0755
pdftexi2dvi File 1.14 KB 0755
pdftocairo File 194.24 KB 0755
pdftohtml File 130.23 KB 0755
pdftoppm File 66.2 KB 0755
pdftops File 66.27 KB 0755
pdftotext File 66.27 KB 0755
pdfunite File 66.16 KB 0755
pear File 793 B 0755
peardev File 814 B 0755
pecl File 727 B 0755
peekfd File 66.63 KB 0755
perl File 3.51 MB 0755
perl5.36-aarch64-linux-gnu File 66.29 KB 0755
perl5.36.0 File 3.51 MB 0755
perlbug File 44.12 KB 0755
perldoc File 125 B 0755
perli11ndoc File 56.56 KB 0755
perlivp File 10.61 KB 0755
perlthanks File 44.12 KB 0755
perror File 4.73 MB 0755
pf2afm File 498 B 0755
pfbtopfa File 516 B 0755
pfmtopam File 65.8 KB 0755
pgmabel File 65.8 KB 0755
pgmbentley File 65.8 KB 0755
pgmcrater File 3.49 KB 0755
pgmdeshadow File 65.8 KB 0755
pgmedge File 65.8 KB 0755
pgmenhance File 65.8 KB 0755
pgmhist File 65.8 KB 0755
pgmkernel File 65.8 KB 0755
pgmmake File 65.8 KB 0755
pgmmedian File 65.8 KB 0755
pgmminkowski File 65.8 KB 0755
pgmmorphconv File 65.8 KB 0755
pgmnoise File 65.8 KB 0755
pgmnorm File 65.8 KB 0755
pgmoil File 65.8 KB 0755
pgmramp File 65.8 KB 0755
pgmslice File 65.8 KB 0755
pgmtexture File 65.8 KB 0755
pgmtofs File 65.8 KB 0755
pgmtolispm File 65.8 KB 0755
pgmtopbm File 65.8 KB 0755
pgmtopgm File 65.8 KB 0755
pgmtoppm File 65.8 KB 0755
pgmtosbig File 65.8 KB 0755
pgmtost4 File 65.8 KB 0755
pgrep File 66.24 KB 0755
pgzrun File 371 B 0755
phar File 14.88 KB 0755
phar.phar File 14.88 KB 0755
phar.phar8.2 File 14.88 KB 0755
phar8.2 File 14.88 KB 0755
phar8.2.phar File 14.88 KB 0755
php File 5.38 MB 0755
php8.2 File 5.38 MB 0755
phpdbg File 5.38 MB 0755
phpdbg8.2 File 5.38 MB 0755
pi-gpk-dbus-service File 196.68 KB 0755
pi-gpk-install-local-file File 67.23 KB 0755
pi-gpk-log File 131.61 KB 0755
pi-gpk-prefs File 131.62 KB 0755
pi-gpk-update-viewer File 197.04 KB 0755
pi-packages File 197.5 KB 0755
pi1toppm File 65.8 KB 0755
pi3topbm File 65.8 KB 0755
pic File 260.11 KB 0755
piclone File 66.53 KB 0755
pico File 324.64 KB 0755
piconv File 8.16 KB 0755
pidof File 66.21 KB 0755
pidwait File 66.24 KB 0755
pig2vcd File 9.97 KB 0755
pigpiod File 14.22 KB 0755
pigs File 43.48 KB 0755
pinctrl File 66.48 KB 0755
pinentry File 130.45 KB 0755
pinentry-curses File 66.45 KB 0755
pinentry-gnome3 File 130.45 KB 0755
pinentry-x11 File 130.45 KB 0755
ping File 144.36 KB 4755
ping4 File 144.36 KB 4755
ping6 File 144.36 KB 4755
pinky File 66.98 KB 0755
pinout File 959 B 0755
pintest File 961 B 0755
pip File 221 B 0755
pip3 File 221 B 0755
pip3.11 File 221 B 0755
pipanel File 131.23 KB 0755
pipewire File 66.16 KB 0755
pipewire-aes67 File 66.16 KB 0755
pipewire-avb File 66.16 KB 0755
pipewire-pulse File 66.16 KB 0755
pishutdown File 66.21 KB 0755
piwiz File 131.74 KB 0755
pjtoppm File 65.81 KB 0755
pkaction File 66.08 KB 0755
pkcheck File 66.08 KB 0755
pkexec File 66.05 KB 4755
pkg-config File 67.88 KB 0755
pkgconf File 67.88 KB 0755
pkgdata File 67.3 KB 0755
pkill File 66.24 KB 0755
pktopbm File 65.8 KB 0755
pkttyagent File 66.08 KB 0755
pl File 67.53 KB 0755
pl2link File 68.58 KB 0755
pl2pm File 4.43 KB 0755
plasmapkg2 File 66.09 KB 0755
play File 66.23 KB 0755
pldd File 66.35 KB 0755
pldes File 67.2 KB 0755
plget File 67.25 KB 0755
plmerge File 67.56 KB 0755
plog File 146 B 0755
plparse File 67.54 KB 0755
plser File 67.76 KB 0755
plutil File 71.77 KB 0755
plymouth File 66.7 KB 0755
pmap File 66.19 KB 0755
png-fix-itxt File 66.09 KB 0755
pngfix File 66.02 KB 0755
pngtopam File 65.88 KB 0755
pngtopnm File 65.88 KB 0755
pnmalias File 65.8 KB 0755
pnmarith File 65.8 KB 0755
pnmcat File 65.8 KB 0755
pnmcolormap File 65.8 KB 0755
pnmcomp File 65.8 KB 0755
pnmconvol File 65.8 KB 0755
pnmcrop File 65.88 KB 0755
pnmcut File 65.8 KB 0755
pnmdepth File 65.8 KB 0755
pnmenlarge File 65.88 KB 0755
pnmfile File 65.8 KB 0755
pnmflip File 3.63 KB 0755
pnmgamma File 65.8 KB 0755
pnmhisteq File 65.8 KB 0755
pnmhistmap File 65.8 KB 0755
pnmindex File 65.8 KB 0755
pnminterp File 65.8 KB 0755
pnminterp-gen File 3.83 KB 0755
pnminvert File 65.8 KB 0755
pnmmargin File 2.75 KB 0755
pnmmercator File 65.8 KB 0755
pnmmontage File 65.8 KB 0755
pnmnlfilt File 65.85 KB 0755
pnmnoraw File 31 B 0755
pnmnorm File 65.8 KB 0755
pnmpad File 65.8 KB 0755
pnmpaste File 65.8 KB 0755
pnmpsnr File 65.8 KB 0755
pnmquant File 10.63 KB 0755
pnmquantall File 6.84 KB 0755
pnmremap File 65.8 KB 0755
pnmrotate File 65.8 KB 0755
pnmscale File 65.88 KB 0755
pnmscalefixed File 65.8 KB 0755
pnmshear File 65.8 KB 0755
pnmsmooth File 65.8 KB 0755
pnmsplit File 65.8 KB 0755
pnmstitch File 66.52 KB 0755
pnmtile File 65.8 KB 0755
pnmtoddif File 65.8 KB 0755
pnmtofiasco File 195.65 KB 0755
pnmtofits File 65.8 KB 0755
pnmtojbig File 76.63 KB 0755
pnmtojpeg File 65.8 KB 0755
pnmtopalm File 65.8 KB 0755
pnmtopclxl File 66.3 KB 0755
pnmtoplainpnm File 31 B 0755
pnmtopng File 65.8 KB 0755
pnmtopnm File 65.8 KB 0755
pnmtops File 65.8 KB 0755
pnmtorast File 65.8 KB 0755
pnmtorle File 66.04 KB 0755
pnmtosgi File 65.8 KB 0755
pnmtosir File 65.8 KB 0755
pnmtotiff File 65.88 KB 0755
pnmtotiffcmyk File 65.88 KB 0755
pnmtoxwd File 65.8 KB 0755
pod2html File 4.04 KB 0755
pod2man File 14.68 KB 0755
pod2texi File 19.93 KB 0755
pod2text File 10.55 KB 0755
pod2usage File 4.01 KB 0755
podchecker File 3.57 KB 0755
poff File 2.77 KB 0755
pon File 1.33 KB 0755
powerprofilesctl File 8.62 KB 0755
ppdc File 130.3 KB 0755
ppdhtml File 130.3 KB 0755
ppdi File 130.3 KB 0755
ppdmerge File 66.16 KB 0755
ppdpo File 130.3 KB 0755
pphs File 404 B 0755
ppm3d File 65.8 KB 0755
ppmbrighten File 2 KB 0755
ppmchange File 65.8 KB 0755
ppmcie File 65.96 KB 0755
ppmcolormask File 65.8 KB 0755
ppmcolors File 65.8 KB 0755
ppmdcfont File 65.8 KB 0755
ppmddumpfont File 65.8 KB 0755
ppmdim File 65.8 KB 0755
ppmdist File 65.8 KB 0755
ppmdither File 65.8 KB 0755
ppmdmkfont File 69.25 KB 0755
ppmdraw File 65.8 KB 0755
ppmfade File 11.78 KB 0755
ppmflash File 65.8 KB 0755
ppmforge File 65.8 KB 0755
ppmglobe File 65.8 KB 0755
ppmhist File 65.8 KB 0755
ppmlabel File 65.8 KB 0755
ppmmake File 65.8 KB 0755
ppmmix File 65.8 KB 0755
ppmnorm File 65.8 KB 0755
ppmntsc File 65.8 KB 0755
ppmpat File 65.8 KB 0755
ppmquant File 2.3 KB 0755
ppmquantall File 6.84 KB 0755
ppmrainbow File 3.48 KB 0755
ppmrelief File 65.8 KB 0755
ppmrough File 65.8 KB 0755
ppmshadow File 10.85 KB 0755
ppmshift File 65.8 KB 0755
ppmspread File 65.8 KB 0755
ppmtoacad File 66.63 KB 0755
ppmtoapplevol File 65.8 KB 0755
ppmtoarbtxt File 65.8 KB 0755
ppmtoascii File 65.88 KB 0755
ppmtobmp File 65.8 KB 0755
ppmtoeyuv File 65.8 KB 0755
ppmtogif File 65.8 KB 0755
ppmtoicr File 65.8 KB 0755
ppmtoilbm File 65.89 KB 0755
ppmtojpeg File 65.8 KB 0755
ppmtoleaf File 65.8 KB 0755
ppmtolj File 65.8 KB 0755
ppmtomap File 82 B 0755
ppmtomitsu File 65.8 KB 0755
ppmtompeg File 489.51 KB 0755
ppmtoneo File 65.8 KB 0755
ppmtopcx File 65.8 KB 0755
ppmtopgm File 65.8 KB 0755
ppmtopi1 File 65.8 KB 0755
ppmtopict File 65.8 KB 0755
ppmtopj File 65.88 KB 0755
ppmtopjxl File 65.88 KB 0755
ppmtoppm File 65.8 KB 0755
ppmtopuzz File 65.8 KB 0755
ppmtorgb3 File 65.8 KB 0755
ppmtosixel File 65.8 KB 0755
ppmtospu File 65.8 KB 0755
ppmtoterm File 65.8 KB 0755
ppmtotga File 65.8 KB 0755
ppmtouil File 65.8 KB 0755
ppmtowinicon File 65.8 KB 0755
ppmtoxpm File 65.8 KB 0755
ppmtoyuv File 65.8 KB 0755
ppmtoyuvsplit File 65.8 KB 0755
ppmtv File 65.8 KB 0755
ppmwheel File 65.8 KB 0755
pprompt.sh File 336 B 0755
pr File 131.08 KB 0755
preconv File 66.29 KB 0755
preparetips5 File 1019 B 0755
print File 18.06 KB 0755
printafm File 395 B 0755
printenv File 66.8 KB 0755
printf File 66.88 KB 0755
prlimit File 66.66 KB 0755
procan File 131.73 KB 0755
profile2mat File 2.65 KB 0755
profiles File 66.08 KB 0755
proj File 66.19 KB 0755
projinfo File 130.18 KB 0755
projsync File 130.26 KB 0755
protocoltojson File 66.08 KB 0755
prove File 13.34 KB 0755
proxy File 65.93 KB 0755
prtstat File 66.55 KB 0755
ps File 194.78 KB 0755
ps2ascii File 631 B 0755
ps2epsi File 1.23 KB 0755
ps2pdf File 272 B 0755
ps2pdf12 File 215 B 0755
ps2pdf13 File 215 B 0755
ps2pdf14 File 215 B 0755
ps2pdfwr File 1.05 KB 0755
ps2ps File 647 B 0755
ps2ps2 File 669 B 0755
ps2txt File 631 B 0755
psfaddtable File 66.5 KB 0755
psfgettable File 66.5 KB 0755
psfstriptable File 66.5 KB 0755
psfxtable File 66.5 KB 0755
psidtopgm File 65.8 KB 0755
pslog File 66.34 KB 0755
pstoedit File 65.93 KB 0755
pstopnm File 65.8 KB 0755
pstree File 67.59 KB 0755
pstree.x11 File 67.59 KB 0755
ptar File 3.48 KB 0755
ptardiff File 2.58 KB 0755
ptargrep File 4.29 KB 0755
ptx File 131.17 KB 0755
pv File 71.81 KB 0755
pw-cat File 194.16 KB 0755
pw-cli File 130.26 KB 0755
pw-config File 66.16 KB 0755
pw-container File 66.16 KB 0755
pw-dot File 66.16 KB 0755
pw-dsdplay File 194.16 KB 0755
pw-dump File 130.23 KB 0755
pw-encplay File 194.16 KB 0755
pw-link File 66.16 KB 0755
pw-loopback File 66.16 KB 0755
pw-metadata File 66.16 KB 0755
pw-mididump File 66.16 KB 0755
pw-midiplay File 194.16 KB 0755
pw-midirecord File 194.16 KB 0755
pw-mon File 130.2 KB 0755
pw-play File 194.16 KB 0755
pw-profiler File 66.16 KB 0755
pw-record File 194.16 KB 0755
pw-reserve File 66.16 KB 0755
pw-top File 130.16 KB 0755
pwd File 66.89 KB 0755
pwdx File 66.16 KB 0755
pwrkey File 170 B 0755
py3clean File 7.63 KB 0755
py3compile File 13 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 79 B 0755
pydoc3 File 79 B 0755
pydoc3.11 File 79 B 0755
pygettext3 File 23.67 KB 0755
pygettext3.11 File 23.67 KB 0755
pygmentize File 970 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.31 MB 0755
python-dotenv File 977 B 0755
python3 File 6.31 MB 0755
python3-config File 3.01 KB 0755
python3.11 File 6.31 MB 0755
python3.11-config File 3.01 KB 0755
pzstd File 642.34 KB 0755
qcam File 322.99 KB 0755
qmi-firmware-update File 195.8 KB 0755
qmi-network File 16.04 KB 0755
qmicli File 589.67 KB 0755
qoitopam File 65.8 KB 0755
qrttoppm File 65.8 KB 0755
qt-faststart File 66.08 KB 0755
qt5ct File 642.25 KB 0755
qvlc File 42 B 0755
r File 175.1 KB 0755
raindrop File 67.55 KB 0755
ranlib File 67.01 KB 0755
raspi-config File 127.15 KB 0755
raspi-gpio File 71.55 KB 0755
raspinfo File 5.8 KB 0755
rasputin File 66.77 KB 0755
rasttopnm File 65.8 KB 0755
rawtopgm File 65.8 KB 0755
rawtoppm File 65.8 KB 0755
rbash File 1.28 MB 0755
rc_gui File 66.93 KB 0755
rctest File 66.12 KB 0755
rdjpgcom File 66.09 KB 0755
rdma File 208.41 KB 0755
rds-ctl File 66.88 KB 0755
readelf File 779.36 KB 0755
readlink File 66.85 KB 0755
realpath File 66.86 KB 0755
rec File 66.23 KB 0755
recordmydesktop File 87.72 KB 0755
red File 89 B 0755
regexp-assemble File 4.92 KB 0755
rename-user File 2.56 KB 0755
rename.ul File 66.16 KB 0755
renice File 66.16 KB 0755
replace File 4.51 MB 0755
reset File 66.09 KB 0755
resizepart File 130.16 KB 0755
resolve_stack_dump File 4.51 MB 0755
resolveip File 4.51 MB 0755
rev File 66.16 KB 0755
rfcomm File 66.5 KB 0755
rgb3toppm File 65.8 KB 0755
rgrep File 30 B 0755
rlatopam File 65.8 KB 0755
rletopnm File 66.05 KB 0755
rm File 66.98 KB 0755
rmdir File 66.88 KB 0755
rmiregistry File 65.93 KB 0755
rnano File 324.64 KB 0755
rotatelogs File 66.16 KB 0755
routel File 1.62 KB 0755
rp-bookshelf File 67.39 KB 0755
rp-prefapps File 67.16 KB 0755
rpcgen File 130.84 KB 0755
rpcinfo File 66.45 KB 0755
rpi-bootloader-key-convert File 1.37 KB 0755
rpi-connect File 7.69 MB 0755
rpi-connect-env File 216 B 0755
rpi-connectd File 12.75 MB 0755
rpi-eeprom-config File 23.46 KB 0755
rpi-eeprom-digest File 5.12 KB 0755
rpi-eeprom-update File 36.12 KB 0755
rpi-imager File 37 MB 0755
rpi-otp-private-key File 6.08 KB 0755
rpi-sign-bootcode File 10.86 KB 0755
rpi-update File 18.33 KB 0755
rpicam-hello File 66.62 KB 0755
rpicam-jpeg File 131.03 KB 0755
rpicam-raw File 195.13 KB 0755
rpicam-still File 195.36 KB 0755
rpicam-vid File 195.16 KB 0755
rpinters File 327.82 KB 0755
rrsync File 12.34 KB 0755
rst-buildhtml File 11.17 KB 0755
rst2html File 592 B 0755
rst2html4 File 714 B 0755
rst2html5 File 1.03 KB 0755
rst2latex File 791 B 0755
rst2man File 614 B 0755
rst2odt File 780 B 0755
rst2odt_prepstyles File 2.01 KB 0755
rst2pseudoxml File 599 B 0755
rst2s5 File 635 B 0755
rst2xetex File 871 B 0755
rst2xml File 600 B 0755
rstpep2html File 668 B 0755
rsync File 529.99 KB 0755
rsync-ssl File 5.02 KB 0755
rtstat File 66.43 KB 0755
run-mailcap File 18.06 KB 0755
run-parts File 66.79 KB 0755
runcon File 66.93 KB 0755
rview File 1.65 MB 0755
rvlc File 42 B 0755
rygel File 66.16 KB 0755
samba-regedit File 131.1 KB 0755
samba-tool File 1.52 KB 0755
sane-find-scanner File 195.11 KB 0755
savelog File 10.24 KB 0755
sbigtopgm File 65.8 KB 0755
sbout File 113 B 0755
sbtest File 186 B 0755
scalar File 2.16 MB 0755
scanimage File 67.04 KB 0755
scp File 322.48 KB 0755
scp-dbus-service File 90 B 0755
screendump File 66.36 KB 0755
script File 130.16 KB 0755
scriptlive File 66.16 KB 0755
scriptreplay File 66.16 KB 0755
scrot File 67.1 KB 0755
sdiff File 66.95 KB 0755
sdptool File 137.63 KB 0755
sed File 131.38 KB 0755
see File 18.06 KB 0755
select-default-iwrap File 474 B 0755
select-editor File 2.39 KB 0755
send2trash File 218 B 0755
sensible-browser File 1.26 KB 0755
sensible-editor File 1.24 KB 0755
sensible-pager File 565 B 0755
seq File 66.89 KB 0755
sessreg File 66.4 KB 0755
setarch File 66.41 KB 0755
setcifsacl File 66.09 KB 0755
setfacl File 66.68 KB 0755
setfattr File 66.37 KB 0755
setfont File 66.76 KB 0755
setkeycodes File 66.53 KB 0755
setleds File 66.52 KB 0755
setlogcons File 66.41 KB 0755
setmetamode File 66.64 KB 0755
setpci File 66.24 KB 0755
setpriv File 130.16 KB 0755
setsid File 66.16 KB 0755
setterm File 66.16 KB 0755
setup_env File 565 B 0755
setupcon File 39.17 KB 0755
setvtrgb File 66.63 KB 0755
setxkbmap File 22.88 KB 0755
sfparse File 67.7 KB 0755
sftp File 322.46 KB 0755
sg File 67.55 KB 4755
sgitopnm File 65.8 KB 0755
sh File 130.51 KB 0755
sha1sum File 66.91 KB 0755
sha224sum File 66.91 KB 0755
sha256sum File 66.91 KB 0755
sha384sum File 66.91 KB 0755
sha512sum File 66.91 KB 0755
sharesec File 66.16 KB 0755
shasum File 9.75 KB 0755
shmemCC File 66.51 KB 0755
shmemc++ File 66.51 KB 0755
shmemcc File 66.51 KB 0755
shmemcxx File 66.51 KB 0755
shmemfort File 66.51 KB 0755
shmemrun File 66.28 KB 0755
showconsolefont File 66.64 KB 0755
showkey File 66.63 KB 0755
showrgb File 66.28 KB 0755
shred File 67.07 KB 0755
shuf File 66.97 KB 0755
sirtopnm File 65.8 KB 0755
sixel2png File 10.09 KB 0755
size File 66.71 KB 0755
skill File 66.2 KB 0755
slabtop File 66.21 KB 0755
sldtoppm File 65.86 KB 0755
sleep File 66.83 KB 0755
slogin File 1.13 MB 0755
smb2-quota File 6.3 KB 0755
smbcontrol File 66.35 KB 0755
smbinfo File 28.64 KB 0755
smbpasswd File 66.16 KB 0755
smbstatus File 130.16 KB 0755
snice File 66.2 KB 0755
socat File 453.92 KB 0755
soelim File 66.29 KB 0755
sort File 131.62 KB 0755
sotruss File 4.19 KB 0755
sox File 66.23 KB 0755
soxi File 66.23 KB 0755
spa-acp-tool File 323.88 KB 0755
spa-inspect File 130.25 KB 0755
spa-json-dump File 66.16 KB 0755
spa-monitor File 66.25 KB 0755
spa-resample File 66.38 KB 0755
spctoppm File 65.8 KB 0755
speaker-test File 66.22 KB 0755
splain File 18.99 KB 0755
split File 67.51 KB 0755
splitfont File 66.27 KB 0755
spottopgm File 65.82 KB 0755
sprof File 66.55 KB 0755
spumux File 196.07 KB 0755
sputoppm File 65.8 KB 0755
spuunmux File 130.16 KB 0755
squeekboard File 31.45 MB 0755
squeekboard-restyled File 428 B 0755
srftopam File 65.8 KB 0755
ss File 208.91 KB 0755
ssconvert File 66.16 KB 0755
ssdiff File 66.16 KB 0755
ssgrep File 66.16 KB 0755
ssh File 1.13 MB 0755
ssh-add File 578.3 KB 0755
ssh-agent File 514.23 KB 2755
ssh-argv0 File 1.42 KB 0755
ssh-copy-id File 12.38 KB 0755
ssh-import-id File 409 B 0755
ssh-import-id-gh File 785 B 0755
ssh-import-id-lp File 785 B 0755
ssh-keygen File 706.41 KB 0755
ssh-keyscan File 706.45 KB 0755
sshfs File 132.55 KB 0755
ssindex File 66.16 KB 0755
st4topgm File 65.8 KB 0755
startlxde File 1.46 KB 0755
startlxde-pi File 659 B 0755
startx File 5.39 KB 0755
stat File 131.17 KB 0755
stdbuf File 66.88 KB 0755
strace File 1.56 MB 0755
strace-log-merge File 1.78 KB 0755
stream File 66.09 KB 0755
stream-im6 File 66.09 KB 0755
stream-im6.q16 File 66.09 KB 0755
streamzip File 7.75 KB 0755
strings File 66.84 KB 0755
strip File 199.56 KB 0755
stty File 130.95 KB 0755
stubgen File 211 B 0755
stubtest File 212 B 0755
su File 130.19 KB 4755
sudo File 263 KB 4755
sudoedit File 263 KB 4755
sudopwd File 66.36 KB 0755
sudoreplay File 131.53 KB 0755
sum File 66.93 KB 0755
sunicontopnm File 65.8 KB 0755
svgtopam File 65.8 KB 0755
svlc File 46 B 0755
swayidle File 66.11 KB 0755
swaylock File 132.25 KB 0755
symilar File 219 B 0755
sync File 66.84 KB 0755
systemctl File 1.32 MB 0755
systemd File 130.34 KB 0755
systemd-analyze File 194.76 KB 0755
systemd-ask-password File 66.34 KB 0755
systemd-cat File 66.23 KB 0755
systemd-cgls File 66.34 KB 0755
systemd-cgtop File 66.27 KB 0755
systemd-creds File 66.48 KB 0755
systemd-cryptenroll File 66.46 KB 0755
systemd-delta File 66.23 KB 0755
systemd-detect-virt File 66.23 KB 0755
systemd-escape File 66.23 KB 0755
systemd-firstboot File 66.45 KB 0755
systemd-hwdb File 130.85 KB 0755
systemd-id128 File 66.23 KB 0755
systemd-inhibit File 66.25 KB 0755
systemd-machine-id-setup File 66.34 KB 0755
systemd-mount File 66.45 KB 0755
systemd-notify File 66.23 KB 0755
systemd-path File 66.23 KB 0755
systemd-repart File 194.59 KB 0755
systemd-run File 66.51 KB 0755
systemd-socket-activate File 66.23 KB 0755
systemd-stdio-bridge File 66.23 KB 0755
systemd-sysext File 66.35 KB 0755
systemd-sysusers File 66.59 KB 0755
systemd-tmpfiles File 130.5 KB 0755
systemd-tty-ask-password-agent File 66.23 KB 0755
systemd-umount File 66.45 KB 0755
systemsettings File 194.16 KB 0755
systemsettings5 File 194.16 KB 0755
tabs File 66.09 KB 0755
tac File 131.01 KB 0755
tail File 131.07 KB 0755
tar File 527.24 KB 0755
tasksel File 26.82 KB 0755
taskset File 130.16 KB 0755
tbl File 194.29 KB 0755
tclsh File 66.07 KB 0755
tclsh8.6 File 66.07 KB 0755
tdbbackup File 66.09 KB 0755
tdbbackup.tdbtools File 66.09 KB 0755
tdbdump File 66.09 KB 0755
tdbrestore File 66.09 KB 0755
tdbtool File 66.57 KB 0755
tee File 66.88 KB 0755
tempfile File 66.31 KB 0755
test File 66.84 KB 0755
testparm File 66.13 KB 0755
texi2any File 52.86 KB 0755
texi2dvi File 58.33 KB 0755
texi2pdf File 1.14 KB 0755
texindex File 3.9 KB 0755
tgatoppm File 65.8 KB 0755
thinkjettopbm File 65.8 KB 0755
thonny File 945 B 0755
tic File 130.2 KB 0755
tifftopnm File 65.88 KB 0755
timedatectl File 66.23 KB 0755
timeout File 67.42 KB 0755
tjbench File 66.4 KB 0755
tload File 66.17 KB 0755
toe File 66.09 KB 0755
toilet File 22.91 KB 0755
top File 135.34 KB 0755
tor File 3.36 MB 0755
tor-gencert File 481.04 KB 0755
tor-print-ed-signing-cert File 417.02 KB 0755
tor-resolve File 194.07 KB 0755
torify File 1.34 KB 0755
torsocks File 11.42 KB 0755
touch File 131.02 KB 0755
tput File 66.12 KB 0755
tqdm File 207 B 0755
tr File 66.87 KB 0755
transmission-gtk File 902.13 KB 0755
tree File 131.66 KB 0755
troff File 815.7 KB 0755
true File 66.78 KB 0755
truncate File 66.85 KB 0755
trust File 258.41 KB 0755
tset File 66.09 KB 0755
tsort File 66.85 KB 0755
tty File 66.81 KB 0755
twolame File 27.05 KB 0755
txixml2texi File 14.71 KB 0755
tzselect File 15 KB 0755
ucf File 40.69 KB 0755
ucfq File 18.91 KB 0755
ucfr File 10.85 KB 0755
uclampset File 130.16 KB 0755
uconv File 66.6 KB 0755
ucs2any File 18.18 KB 0755
udevadm File 1.26 MB 0755
udisksctl File 66.16 KB 0755
ul File 66.16 KB 0755
umax_pp File 195.24 KB 0755
umount File 66.16 KB 4755
uname File 66.81 KB 0755
unar File 2.93 MB 0755
uncompress File 2.29 KB 0755
undill File 587 B 0755
unexpand File 66.88 KB 0755
unicode_start File 2.71 KB 0755
unicode_stop File 528 B 0755
uniq File 66.91 KB 0755
unix2dos File 54.09 KB 0755
unix2mac File 54.09 KB 0755
unlink File 66.8 KB 0755
unlzma File 130.51 KB 0755
unmkinitramfs File 3.59 KB 0755
unrar File 323.08 KB 0755
unrar-nonfree File 323.08 KB 0755
unshare File 130.38 KB 0755
unxz File 130.51 KB 0755
unzip File 194.95 KB 0755
unzipsfx File 130.76 KB 0755
unzstd File 1.13 MB 0755
update-alternatives File 66.17 KB 0755
update-desktop-database File 22.16 KB 0755
update-mime-database File 59.04 KB 0755
update-perl-sax-parsers File 6.03 KB 0755
upower File 66.08 KB 0755
uptime File 66.16 KB 0755
usb-devices File 4.35 KB 0755
usbhid-dump File 66.64 KB 0755
usbreset File 66.36 KB 0755
users File 66.85 KB 0755
utmpdump File 66.16 KB 0755
uuid File 66.1 KB 0755
v4l2-compliance File 707.45 KB 0755
v4l2-ctl File 459.84 KB 0755
v4l2-sysfs-path File 66.23 KB 0755
vcgencmd File 66.3 KB 0755
vclog File 66.47 KB 0755
vcmailbox File 66.27 KB 0755
vcut File 66.09 KB 0755
vdir File 195.74 KB 0755
vi File 1.65 MB 0755
view File 1.65 MB 0755
viewres File 27.34 KB 0755
vim.tiny File 1.65 MB 0755
vkcube File 259.17 KB 0755
vkcube-wayland File 259.4 KB 0755
vkcubepp File 323.52 KB 0755
vlc File 66.08 KB 0755
vlc-wrapper File 66.08 KB 0755
vmstat File 66.53 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
vncviewer File 10.79 MB 0755
vorbiscomment File 66.16 KB 0755
vorbistagedit File 4.32 KB 0755
vsftpdwho File 54 B 0755
vulkaninfo File 643.31 KB 0755
w File 66.19 KB 0755
w3m File 1.6 MB 0755
w3mman File 1.37 KB 0755
wall File 66.16 KB 0755
watch File 66.55 KB 0755
watchgnupg File 66.09 KB 0755
wayfire File 1.19 MB 0755
wayfire-pi File 510 B 0755
wayvnc File 201.99 KB 0755
wayvncctl File 69.46 KB 0755
wbmptopbm File 65.8 KB 0755
wc File 66.99 KB 0755
wcmgr File 65.98 KB 0755
wdctl File 130.19 KB 0755
webalizer File 212.18 KB 0755
webazolver File 212.18 KB 0755
wf-panel-pi File 711.14 KB 0755
wfpanelctl File 697 B 0755
wfrespawn File 135 B 0755
wget File 467.09 KB 0755
whatis File 67.03 KB 0755
whereis File 66.59 KB 0755
which File 946 B 0755
which.debianutils File 946 B 0755
whiptail File 66.65 KB 0755
who File 66.98 KB 0755
whoami File 66.81 KB 0755
winicontopam File 65.8 KB 0755
winicontoppm File 65.8 KB 0755
wireplumber File 66.23 KB 0755
wish File 66.09 KB 0755
wish8.6 File 66.09 KB 0755
wlopm File 66.05 KB 0755
wlr-randr File 66.1 KB 0755
wordview File 8.97 KB 0755
wpa_passphrase File 130.1 KB 0755
wpctl File 66.44 KB 0755
wpexec File 66.3 KB 0755
write File 66.16 KB 0755
wrjpgcom File 66.09 KB 0755
wsrep_sst_backup File 2.39 KB 0755
wsrep_sst_common File 66.86 KB 0755
wsrep_sst_mariabackup File 49.23 KB 0755
wsrep_sst_mysqldump File 8.11 KB 0755
wsrep_sst_rsync File 29.72 KB 0755
wsrep_sst_rsync_wan File 29.72 KB 0755
www-browser File 1.92 MB 0755
x-session-manager File 659 B 0755
x-terminal-emulator File 133.39 KB 0755
x-window-manager File 387.55 KB 0755
x-www-browser File 848 B 0755
xarchiver File 323.19 KB 0755
xargs File 130.27 KB 0755
xauth File 67.37 KB 0755
xbmtopbm File 65.8 KB 0755
xcmsdb File 67.11 KB 0755
xcompmgr File 38.08 KB 0755
xdg-dbus-proxy File 65.93 KB 0755
xdg-desktop-icon File 20.16 KB 0755
xdg-desktop-menu File 42.27 KB 0755
xdg-email File 26.3 KB 0755
xdg-icon-resource File 29.33 KB 0755
xdg-mime File 41.14 KB 0755
xdg-open File 25.46 KB 0755
xdg-screensaver File 37.11 KB 0755
xdg-settings File 37.5 KB 0755
xdg-user-dir File 234 B 0755
xdg-user-dirs-update File 66.01 KB 0755
xdpyinfo File 35.55 KB 0755
xdriinfo File 10.28 KB 0755
xev File 30.91 KB 0755
xfallback.sh File 451 B 0755
xfd File 32.28 KB 0755
xfontsel File 40.31 KB 0755
xgamma File 66.32 KB 0755
xhost File 66.47 KB 0755
ximtoppm File 65.8 KB 0755
xinit File 18.47 KB 0755
xinput File 55.32 KB 0755
xkbbell File 14.36 KB 0755
xkbcomp File 204.64 KB 0755
xkbevd File 38.66 KB 0755
xkbprint File 82.63 KB 0755
xkbvleds File 23.23 KB 0755
xkbwatch File 19.25 KB 0755
xkeystone File 16.58 KB 0755
xkill File 14.41 KB 0755
xls2csv File 67.27 KB 0755
xlsatoms File 10.35 KB 0755
xlsclients File 14.43 KB 0755
xlsfonts File 22.53 KB 0755
xmessage File 23.31 KB 0755
xml2-config File 1.4 KB 0755
xmlparse File 67.4 KB 0755
xmlstarlet File 130.03 KB 0755
xmodmap File 66.91 KB 0755
xpmtoppm File 65.84 KB 0755
xprop File 44.98 KB 0755
xrandr File 66.95 KB 0755
xrdb File 66.8 KB 0755
xrefresh File 66.4 KB 0755
xscreensaver File 66.11 KB 0755
xscreensaver-command File 66.09 KB 0755
xscreensaver-demo File 452.78 KB 0755
xscreensaver-settings File 452.78 KB 0755
xsel File 65.93 KB 0755
xset File 66.73 KB 0755
xsetmode File 66.3 KB 0755
xsetpointer File 66.32 KB 0755
xsetroot File 66.48 KB 0755
xsettingsd File 46.38 KB 0755
xstdcmap File 66.91 KB 0755
xsubpp File 5.05 KB 0755
xvidtune File 68.07 KB 0755
xvinfo File 14.35 KB 0755
xvminitoppm File 65.8 KB 0755
xwayland-xauth File 448 B 0755
xwdtopnm File 65.8 KB 0755
xwininfo File 42.88 KB 0755
xz File 130.51 KB 0755
xzcat File 130.51 KB 0755
xzcmp File 7.25 KB 0755
xzdiff File 7.25 KB 0755
xzegrep File 10.09 KB 0755
xzfgrep File 10.09 KB 0755
xzgrep File 10.09 KB 0755
xzless File 1.77 KB 0755
xzmore File 2.14 KB 0755
ybmtopbm File 65.8 KB 0755
yelp File 66.01 KB 0755
yes File 66.8 KB 0755
ypdomainname File 66.01 KB 0755
yuvsplittoppm File 65.8 KB 0755
yuvtoppm File 65.8 KB 0755
yuy2topam File 65.8 KB 0755
zcat File 1.94 KB 0755
zcmp File 1.64 KB 0755
zdiff File 6.31 KB 0755
zdump File 66.27 KB 0755
zegrep File 29 B 0755
zeisstopnm File 65.8 KB 0755
zenity File 136.3 KB 0755
zenoty File 66.3 KB 0755
zfgrep File 29 B 0755
zforce File 2.03 KB 0755
zgrep File 7.91 KB 0755
zip File 264.05 KB 0755
zipcloak File 132.28 KB 0755
zipdetails File 68.55 KB 0755
zipgrep File 2.89 KB 0755
zipinfo File 194.95 KB 0755
zipnote File 131.96 KB 0755
zipsplit File 131.98 KB 0755
zless File 2.15 KB 0755
zmore File 1.8 KB 0755
znew File 4.47 KB 0755
zstd File 1.13 MB 0755
zstdcat File 1.13 MB 0755
zstdgrep File 3.78 KB 0755
zstdless File 197 B 0755
zstdmt File 1.13 MB 0755
Filemanager