raspi-config/openEuler.patch
yafen 879341eb64 update source, adjust for openEuler 23.03
(cherry picked from commit d34a2d090c236e9bbb938db259a28c354e2d3a9d)
2023-03-20 18:47:03 +08:00

756 lines
29 KiB
Diff

diff --git a/raspi-config b/raspi-config
index bf24fa9..c6599aa 100755
--- a/raspi-config
+++ b/raspi-config
@@ -12,8 +12,8 @@ USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')}
INIT="$(ps --no-headers -o comm 1)"
is_pi () {
- ARCH=$(dpkg --print-architecture)
- if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then
+ ARCH=$(arch)
+ if [ "$ARCH" = "aarch64" ]; then
return 0
else
return 1
@@ -117,15 +117,18 @@ has_analog() {
}
is_installed() {
- if [ "$(dpkg -l "$1" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then
+ if [ "$(rpm -qa "$1" 2> /dev/null | wc -l)" == "0" ]; then
return 1
else
return 0
fi
}
-deb_ver () {
- ver=`cat /etc/debian_version | cut -d . -f 1`
+rpm_ver () {
+ ver=`cat /etc/os-release | grep VERSION_ID | awk -F = '{print $2}' | cut -d . -f 1`
+ if [ "x${ver:0:1}" == "x\"" ]; then
+ ver=${ver:1}
+ fi
echo $ver
}
@@ -152,7 +155,7 @@ 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)\
+$(rpm -qi raspi-config 2> /dev/null | grep Version)\
" 20 70 1
return 0
}
@@ -163,7 +166,7 @@ get_can_expand() {
PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")"
- if [ "$PART_NUM" -ne 2 ]; then
+ if [ "$PART_NUM" -ne 3 ]; then
echo 1
exit
fi
@@ -182,14 +185,25 @@ do_expand_rootfs() {
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:)
+ PART_INFO=$(parted "$ROOT_DEV" -ms unit s p)
+
+ LAST_PART_NUM=$(echo "$PART_INFO" | 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
+ return -1
+ fi
+
+ PART_END=$(echo "$PART_INFO" | grep "^${PART_NUM}" | cut -f 3 -d: | sed 's/[^0-9]//g')
+ ROOT_END=$(echo "$PART_INFO" | grep "^/dev"| cut -f 2 -d: | sed 's/[^0-9]//g')
+ ((ROOT_END--)) # 31116287
+
+ if [ $PART_END -eq $ROOT_END ]; then
+ whiptail --msgbox "$ROOT_PART has been expanded!" 20 60 2
+ return 2
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=$(echo "$PART_INFO" | 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
@@ -205,6 +219,15 @@ $PART_START
p
w
EOF
+ resize2fs $ROOT_PART
+ if [ $? -eq 0 ]; then
+ whiptail --msgbox "Root partition has been expanded successfully." 20 60 2
+ return 0
+ else
+ whiptail --msgbox "Fail to expand the root partition.\n\nPlease try again or reboot!" 20 60 2
+ return -1
+ fi
+
ASK_TO_REBOOT=1
# now set up an init.d script
@@ -241,6 +264,7 @@ EOF
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "Root partition has been resized.\nThe filesystem will be enlarged upon the next reboot" 20 60 2
fi
+ return 0
}
set_config_var() {
@@ -397,9 +421,12 @@ do_overscan_kms() {
echo "xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" >> /usr/share/ovscsetup.sh
fi
else
- echo "#!/bin/sh\nxrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" > /usr/share/ovscsetup.sh
+ echo -e "#!/bin/sh\nxrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" > /usr/share/ovscsetup.sh
fi
if ! grep -q ovscsetup /usr/share/dispsetup.sh 2> /dev/null ; then
+ if [ ! -f /usr/share/dispsetup.sh ]; then
+ echo -e "#!/bin/sh\nexit 0" > /usr/share/dispsetup.sh
+ fi
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
@@ -424,8 +451,9 @@ do_blanking() {
CURRENT=1
fi
if [ "$INTERACTIVE" = True ]; then
- if [ "$(dpkg -l xscreensaver | tail -n 1 | cut -d ' ' -f 1)" = "ii" ]; then
- whiptail --msgbox "Warning: xscreensaver is installed may override raspi-config settings" 20 60 2
+ screensaver=$(rpm -qa *saver*)
+ if [ ! -z "$screensaver" ] ; then
+ whiptail --msgbox "Warning: $screensaver is installed may override raspi-config settings" 20 60 2
fi
whiptail --yesno "Would you like to enable screen blanking?" $DEFAULT 20 60 2
RET=$?
@@ -577,69 +605,74 @@ do_change_timezone() {
get_wifi_country() {
CODE=${1:-0}
- if [ -e /etc/default/crda ]; then
- . /etc/default/crda
- 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")"
+ 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
- if [ -z "$REGDOMAIN" ] \
- || ! grep -q "^${REGDOMAIN}[[:space:]]" /usr/share/zoneinfo/iso3166.tab; then
+ wpa_cli -i "$IFACE" save_config > /dev/null 2>&1
+ COUNTRY="$(wpa_cli -i "$IFACE" get country)"
+ if [ "$COUNTRY" = "FAIL" ]; then
return 1
fi
- if [ "$CODE" = 0 ]; then
- echo "$REGDOMAIN"
+ if [ $CODE = 0 ]; then
+ echo "$COUNTRY"
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
+ IFACE="$(list_wlan_interfaces | head -n 1)"
+ if [ -z "$IFACE" ]; then
if [ "$INTERACTIVE" = True ]; then
- whiptail --msgbox "$REGDOMAIN is not a valid ISO/IEC 3166-1 alpha2 code" 20 60
+ whiptail --msgbox "No wireless interface found" 20 60
fi
return 1
fi
- if [ -e /etc/default/crda ]; then
- sed -i "s/^REGDOMAIN=.*$/REGDOMAIN=$REGDOMAIN/" /etc/default/crda
- if ! ischroot; then
- iw reg set "$REGDOMAIN"
- fi
- 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
+ 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
- if [ "$INIT" = "systemd" ] && ! ischroot && systemctl -q is-active NetworkManager; then
- nmcli radio wifi on
- elif hash rfkill 2> /dev/null; then
- rfkill unblock wifi
+ oIFS="$IFS"
+ if [ "$INTERACTIVE" = True ]; then
+ value=$(cat /usr/share/zoneinfo/iso3166.tab | tail -n +26 | tr '\t' '/' | tr '\n' '/')
+ IFS="/"
+ COUNTRY=$(whiptail --menu "Select the country in which the Pi is to be used" 20 60 10 ${value} 3>&1 1>&2 2>&3)
+ else
+ COUNTRY=$1
+ true
fi
- if is_pi; then
- for filename in /var/lib/systemd/rfkill/*:wlan ; do
- if ! [ -e "$filename" ]; then
- continue
+ if [ $? -eq 0 ];then
+ wpa_cli -i "$IFACE" set country "$COUNTRY"
+ wpa_cli -i "$IFACE" save_config > /dev/null 2>&1
+ if iw reg set "$COUNTRY" 2> /dev/null; then
+ ASK_TO_REBOOT=1
+ fi
+ if hash rfkill 2> /dev/null; then
+ rfkill unblock wifi
+ if is_pi ; then
+ for filename in /var/lib/systemd/rfkill/*:wlan ; do
+ echo 0 > $filename
+ done
fi
- echo 0 > "$filename"
- done
- fi
- if [ "$INTERACTIVE" = True ]; then
- whiptail --msgbox "Wireless LAN country set to $REGDOMAIN" 20 60 1
+ fi
+ if [ "$INTERACTIVE" = True ]; then
+ whiptail --msgbox "Wireless LAN country set to $COUNTRY" 20 60 1
+ fi
fi
+ IFS=$oIFS
}
get_hostname() {
@@ -664,7 +697,7 @@ No other symbols, punctuation characters, or blank spaces are permitted.\
true
fi
if [ "$?" -eq 0 ]; then
- if [ "$INIT" = "systemd" ] && systemctl -q is-active dbus && ! ischroot; then
+ if [ "$INIT" = "systemd" ] && systemctl -q is-active dbus; then
hostnamectl set-hostname "$NEW_HOSTNAME" 2> /dev/null
else
echo "$NEW_HOSTNAME" > /etc/hostname
@@ -826,7 +859,7 @@ clear_overclock () {
}
get_ssh() {
- if service ssh status | grep -q inactive; then
+ if systemctl status sshd.service | grep -q inactive; then
echo 1
else
echo 0
@@ -852,12 +885,12 @@ do_ssh() {
fi
if [ $RET -eq 0 ]; then
ssh-keygen -A &&
- update-rc.d ssh enable &&
- invoke-rc.d ssh start &&
+ systemctl enable sshd.service &&
+ systemctl start sshd.service &&
STATUS=enabled
elif [ $RET -eq 1 ]; then
- update-rc.d ssh disable &&
- invoke-rc.d ssh stop &&
+ systemctl disable sshd.service &&
+ systemctl stop sshd.service &&
STATUS=disabled
else
return $RET
@@ -868,7 +901,7 @@ do_ssh() {
}
get_vnc() {
- if systemctl status vncserver-x11-serviced.service | grep -q -w active; then
+ if systemctl status vncserver@:1.service | grep -q -w active; then
echo 0
else
echo 1
@@ -880,33 +913,39 @@ do_vnc() {
if [ $(get_vnc) -eq 0 ]; then
DEFAULT=
fi
- APT_GET_FLAGS=""
if [ "$INTERACTIVE" = True ]; then
whiptail --yesno "Would you like the VNC Server to be enabled?" $DEFAULT 20 60 2
RET=$?
else
RET=$1
- APT_GET_FLAGS="-y"
fi
if [ $RET -eq 0 ]; then
- if is_installed realvnc-vnc-server || apt-get install "$APT_GET_FLAGS" realvnc-vnc-server; then
- systemctl enable vncserver-x11-serviced.service &&
- systemctl start vncserver-x11-serviced.service &&
+ if is_installed tigervnc-server || dnf install -y tigervnc-server; then
+ cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
+ sed -i '/:1='"$SUDO_USER"'/d' /etc/tigervnc/vncserver.users
+ sed -i '$a\:1='"$SUDO_USER"'' /etc/tigervnc/vncserver.users
+ systemctl enable vncserver@:1.service &&
+ systemctl start vncserver@:1.service &&
STATUS=enabled
else
return 1
fi
elif [ $RET -eq 1 ]; then
- if is_installed realvnc-vnc-server; then
- systemctl disable vncserver-x11-serviced.service
- systemctl stop vncserver-x11-serviced.service
+ if is_installed tigervnc-server; then
+ systemctl disable vncserver@:1.service
+ systemctl stop vncserver@:1.service
fi
STATUS=disabled
else
return $RET
fi
if [ "$INTERACTIVE" = True ]; then
- whiptail --msgbox "The VNC Server is $STATUS" 20 60 1
+ if [ -z $STATUS ]; then
+ whiptail --msgbox "Fail to start the VNC Server, please configure it manually!" 20 60 1
+ return 1
+ else
+ whiptail --msgbox "The VNC Server is $STATUS" 20 60 1
+ fi
fi
}
@@ -1095,8 +1134,7 @@ disable_raspi_config_at_boot() {
}
get_boot_cli() {
- if [ "$(basename $(readlink -f /etc/systemd/system/default.target))" = graphical.target ] \
- && systemctl is-enabled lightdm > /dev/null 2>&1; then
+ if [ "$(systemctl get-default)" = graphical.target ] && systemctl is-enabled lightdm > /dev/null 2>&1; then
echo 1
else
echo 0
@@ -1409,6 +1447,9 @@ do_boot_behaviour() {
;;
B2*)
systemctl --quiet set-default multi-user.target
+ if [ ! -d /etc/systemd/system/getty@tty1.service.d ]; then
+ mkdir /etc/systemd/system/getty@tty1.service.d
+ fi
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
@@ -1416,19 +1457,22 @@ ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
EOF
;;
B3*)
- if [ -e /etc/init.d/lightdm ]; then
+ if [ -e /etc/lightdm ]; then
systemctl --quiet set-default graphical.target
rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf
sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/"
disable_raspi_config_at_boot
else
- whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2
+ whiptail --msgbox "Do 'sudo dnf install lightdm' to allow configuration of boot to desktop" 20 60 2
return 1
fi
;;
B4*)
- if [ -e /etc/init.d/lightdm ]; then
+ if [ -e /etc/lightdm ]; then
systemctl --quiet set-default graphical.target
+ if [ ! -d /etc/systemd/system/getty@tty1.service.d ]; then
+ mkdir /etc/systemd/system/getty@tty1.service.d
+ fi
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
@@ -1437,7 +1481,7 @@ EOF
sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/"
disable_raspi_config_at_boot
else
- whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2
+ whiptail --msgbox "Do 'sudo dnf install lightdm' to allow configuration of boot to desktop" 20 60 2
return 1
fi
;;
@@ -1738,7 +1782,7 @@ EOF
}
get_camera() {
- if [ $(deb_ver) -le 10 ]; then
+ if [ $(rpm_ver) -le 21 ]; then
CAM=$(get_config_var start_x $CONFIG)
if [ $CAM -eq 1 ]; then
echo 0
@@ -1760,7 +1804,7 @@ get_camera() {
}
do_camera() {
- if [ $(deb_ver) -le 10 ] && [ ! -e /boot/start_x.elf ]; then
+ if [ $(rpm_ver) -le 21 ] && [ ! -e /boot/start_x.elf ]; then
whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2
return 1
fi
@@ -1783,7 +1827,7 @@ do_camera() {
ASK_TO_REBOOT=1
fi
if [ $RET -eq 0 ]; then
- if [ $(deb_ver) -le 10 ] ; then
+ if [ $(rpm_ver) -le 21 ] ; 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
@@ -1794,7 +1838,7 @@ do_camera() {
fi
STATUS=enabled
elif [ $RET -eq 1 ]; then
- if [ $(deb_ver) -le 10 ] ; then
+ if [ $(rpm_ver) -le 21 ] ; then
set_config_var start_x 0 $CONFIG
sed $CONFIG -i -e "s/^start_file/#start_file/"
else
@@ -1912,19 +1956,19 @@ do_legacy() {
}
do_gldriver() {
- if [ ! -e /boot/overlays/vc4-kms-v3d.dtbo ]; then
- whiptail --msgbox "Driver and kernel not present on your system. Please update" 20 60 2
- return 1
- fi
- for package in gldriver-test libgl1-mesa-dri; do
- if [ "$(dpkg -l "$package" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then
- missing_packages="$package $missing_packages"
- fi
- done
- if [ -n "$missing_packages" ] && ! apt-get install $missing_packages; then
- whiptail --msgbox "Required packages not found, please install: ${missing_packages}" 20 60 2
- return 1
- fi
+# if [ ! -e /boot/overlays/vc4-kms-v3d.dtbo ]; then
+# whiptail --msgbox "Driver and kernel not present on your system. Please update" 20 60 2
+# return 1
+# fi
+# for package in gldriver-test libgl1-mesa-dri; do
+# if [ "$(dpkg -l "$package" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then
+# missing_packages="$package $missing_packages"
+# fi
+# done
+# if [ -n "$missing_packages" ] && ! apt-get install $missing_packages; then
+# whiptail --msgbox "Required packages not found, please install: ${missing_packages}" 20 60 2
+# return 1
+# fi
GLOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "GL Driver" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
"G1 Legacy" "Original non-GL desktop driver" \
"G2 GL (Full KMS)" "OpenGL desktop driver with full KMS" \
@@ -2153,6 +2197,7 @@ do_net_names () {
rm -f /etc/systemd/network/73-usb-net-by-mac.link
STATUS=enabled
elif [ $RET -eq 1 ]; then
+ mkdir -p /etc/systemd/network
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
@@ -2165,8 +2210,8 @@ do_net_names () {
}
do_update() {
- apt-get update &&
- apt-get install raspi-config &&
+ dnf update &&
+ dnf install raspi-config -y &&
printf "Sleeping 5 seconds before reloading raspi-config\n" &&
sleep 5 &&
exec raspi-config
@@ -2211,7 +2256,7 @@ do_audio() {
if [ "$INTERACTIVE" = True ]; then
n=0
array=""
- while [ $n -le 9 ]]
+ 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
@@ -2377,12 +2422,69 @@ EOF
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
+ basename "$(dirname "$dir")"
+ # IFACE="$(basename "$(dirname "$dir")")"
+ # if wpa_cli -i "$IFACE" status > /dev/null 2>&1; then
+ # echo "$IFACE"
+ # fi
+ fi
+ done
+}
+
+do_wifi_ssid_passphrase_nmcli() {
+ 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
+
+ SSID="$1"
+ while [ -z "$SSID" ] && [ "$INTERACTIVE" = True ]; do
+ SSID=$(whiptail --inputbox "Please enter SSID" 20 60 3>&1 1>&2 2>&3)
+ if [ $? -ne 0 ]; 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
+ PASSPHRASE=$(whiptail --passwordbox "Please enter passphrase. Leave it empty if none." 20 60 3>&1 1>&2 2>&3)
+ if [ $? -ne 0 ]; then
+ return 0
+ else
+ break
fi
done
+
+ # Escape special characters for embedding in regex below
+ local 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')"
+
+ nmcli dev wifi connect "$SSID" password "$PASSPHRASE"
+ RET=$?
+ if [ $RET -ne 0 ] ; then
+ whiptail --msgbox "Connect to $SSID failed, try nmtui." 20 60
+ fi
+ return $RET
}
do_wifi_ssid_passphrase() {
@@ -2883,8 +2985,8 @@ do_proxy() {
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
+ if [ -f /etc/yum.conf ]; then
+ sed -i "/^proxy/Id" /etc/yum.conf
fi
fi
if [ -z "$ADDRESS" ]; then
@@ -2898,7 +3000,7 @@ do_proxy() {
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
+ echo "proxy=\"$ADDRESS\"" >> /etc/yum.conf
fi
done
if [ "$INTERACTIVE" = True ]; then
@@ -2929,7 +3031,9 @@ do
--expand-rootfs)
INTERACTIVE=False
do_expand_rootfs
- printf "Please reboot\n"
+ if [ $? -eq 0 ]; then
+ printf "Please reboot\n"
+ fi
exit 0
;;
--apply-os-config)
@@ -2975,8 +3079,8 @@ do_system_menu() {
"S3 Password" "Change password for the '$USER' user" \
"S4 Hostname" "Set name for this computer on a network" \
"S5 Boot / Auto Login" "Select boot into desktop or to command line" \
- "S6 Network at Boot" "Select wait for network connection on boot" \
- "S7 Splash Screen" "Choose graphical splash screen or text boot" \
+ `# "S6 Network at Boot" "Select wait for network connection on boot"` \
+ `# "S7 Splash Screen" "Choose graphical splash screen or text boot"` \
"S8 Power LED" "Set behaviour of power LED" \
3>&1 1>&2 2>&3)
elif is_live ; then
@@ -2985,7 +3089,7 @@ do_system_menu() {
"S3 Password" "Change password for the '$USER' user" \
"S4 Hostname" "Set name for this computer on a network" \
"S5 Boot / Auto Login" "Select boot into desktop or to command line" \
- "S6 Network at Boot" "Select wait for network connection on boot" \
+ `# "S6 Network at Boot" "Select wait for network connection on boot"` \
3>&1 1>&2 2>&3)
else
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
@@ -2993,8 +3097,8 @@ do_system_menu() {
"S3 Password" "Change password for the '$USER' user" \
"S4 Hostname" "Set name for this computer on a network" \
"S5 Boot / Auto Login" "Select boot into desktop or to command line" \
- "S6 Network at Boot" "Select wait for network connection on boot" \
- "S7 Splash Screen" "Choose graphical splash screen or text boot" \
+ `# "S6 Network at Boot" "Select wait for network connection on boot"` \
+ `# "S7 Splash Screen" "Choose graphical splash screen or text boot"` \
3>&1 1>&2 2>&3)
fi
RET=$?
@@ -3002,7 +3106,7 @@ do_system_menu() {
return 0
elif [ $RET -eq 0 ]; then
case "$FUN" in
- S1\ *) do_wifi_ssid_passphrase ;;
+ S1\ *) do_wifi_ssid_passphrase_nmcli ;;
S2\ *) do_audio ;;
S3\ *) do_change_pass ;;
S4\ *) do_hostname ;;
@@ -3071,7 +3175,7 @@ do_interface_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"I1 Legacy Camera" "Enable/disable legacy camera support" \
"I2 SSH" "Enable/disable remote command line access using SSH" \
- "I3 VNC" "Enable/disable graphical remote access using RealVNC" \
+ "I3 VNC" "Enable/disable graphical remote access using TigerVNC" \
"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" \
@@ -3105,7 +3209,7 @@ do_performance_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"P1 Overclock" "Configure CPU overclocking" \
"P2 GPU Memory" "Change the amount of memory made available to the GPU" \
- "P3 Overlay File System" "Enable/disable read-only file system" \
+ `# "P3 Overlay File System" "Enable/disable read-only file system"` \
"P4 Fan" "Set behaviour of GPIO fan" \
3>&1 1>&2 2>&3)
RET=$?
@@ -3147,41 +3251,41 @@ do_advanced_menu() {
if is_pifour ; then
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"A1 Expand Filesystem" "Ensures that all of the SD card is available" \
- "A3 Compositor" "Enable/disable xcompmgr composition manager" \
+ `# "A3 Compositor" "Enable/disable xcompmgr composition manager"` \
"A4 Network Interface Names" "Enable/disable predictable network i/f names" \
"A5 Network Proxy Settings" "Configure network proxy settings" \
"A6 Boot Order" "Choose network or USB device boot" \
"A7 Bootloader Version" "Select latest or default boot ROM software" \
- "A9 Wayland" "Enable experimental Wayland backend" \
- "AA Network Config" "Set network configuration tool" \
+ `# "A9 Wayland" "Enable experimental Wayland backend"` \
+ `# "AA Network Config" "Set network configuration tool"` \
3>&1 1>&2 2>&3)
elif is_pi ; then
if is_kms; then
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"A1 Expand Filesystem" "Ensures that all of the SD card is available" \
- "A2 GL Driver" "Enable/disable experimental desktop GL driver" \
- "A3 Compositor" "Enable/disable xcompmgr composition manager" \
+ `# "A2 GL Driver" "Enable/disable experimental desktop GL driver"` \
+ `# "A3 Compositor" "Enable/disable xcompmgr composition manager"` \
"A4 Network Interface Names" "Enable/disable predictable network i/f names" \
"A5 Network Proxy Settings" "Configure network proxy settings" \
- "A8 Glamor" "Enable/disable glamor graphics acceleration" \
- "A9 Wayland" "Enable experimental Wayland backend" \
- "AA Network Config" "Set network configuration tool" \
+ `# "A8 Glamor" "Enable/disable glamor graphics acceleration"` \
+ `# "A9 Wayland" "Enable experimental Wayland backend"` \
+ `# "AA Network Config" "Set network configuration tool"` \
3>&1 1>&2 2>&3)
else
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"A1 Expand Filesystem" "Ensures that all of the SD card is available" \
- "A2 GL Driver" "Enable/disable experimental desktop GL driver" \
+ `# "A2 GL Driver" "Enable/disable experimental desktop GL driver"` \
"A4 Network Interface Names" "Enable/disable predictable network i/f names" \
"A5 Network Proxy Settings" "Configure network proxy settings" \
- "A8 Glamor" "Enable/disable glamor graphics acceleration" \
- "AA Network Config" "Set network configuration tool" \
+ `# "A8 Glamor" "Enable/disable glamor graphics acceleration"` \
+ `# "AA Network Config" "Set network configuration tool"` \
3>&1 1>&2 2>&3)
fi
else
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"A4 Network Interface Names" "Enable/disable predictable network i/f names" \
"A5 Network Proxy Settings" "Configure network proxy settings" \
- "AA Network Config" "Set network configuration tool" \
+ `# "AA Network Config" "Set network configuration tool"` \
3>&1 1>&2 2>&3)
fi
RET=$?
@@ -3200,7 +3304,7 @@ do_advanced_menu() {
A9\ *) do_wayland ;;
AA\ *) do_netconf ;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
- esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
+ esac || [ $? -eq 2 ] || whiptail --msgbox "There was an error running option $FUN" 20 60 1
fi
}
@@ -3237,17 +3341,17 @@ if [ "$INTERACTIVE" = True ]; then
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
+ exit 0
fi
done
while true; do
if is_pi ; then
- FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --backtitle "$(cat /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
+ FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --backtitle "$(tr -d '\0' < /proc/device-tree/model)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
"1 System Options" "Configure system settings" \
"2 Display Options" "Configure display settings" \
"3 Interface Options" "Configure connections to peripherals" \
"4 Performance Options" "Configure performance settings" \
- "5 Localisation Options" "Configure language and regional settings" \
+ `# "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" \
@@ -3257,7 +3361,7 @@ if [ "$INTERACTIVE" = True ]; then
"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" \
+ `# "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" \