Commit 5a0fc32b authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Cleanup, typos

parent bf56d86a
...@@ -191,12 +191,12 @@ function jobs () ...@@ -191,12 +191,12 @@ function jobs ()
if [[ -n $(service hostapd status | grep -w active | grep -w running) ]]; then if [[ -n $(service hostapd status | grep -w active | grep -w running) ]]; then
if [[ -n $HOSTAPDBRIDGE ]]; then if [[ -n $HOSTAPDBRIDGE ]]; then
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \ dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Cancel" --yes-label "Stop and reboot" --no-label "Edit" --yesno \ --help-label "Back" --yes-label "Stop and reboot" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop and reboot\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70 "\n\Z1Stop:\Z0 stop and reboot\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
else else
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \ dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Cancel" --yes-label "Stop" --no-label "Edit" --yesno \ --help-label "Back" --yes-label "Stop" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop providing Access Point\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70 "\n\Z1Stop:\Z0 stop providing Access Point\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
fi fi
exitstatus=$?; exitstatus=$?;
...@@ -477,8 +477,8 @@ function jobs () ...@@ -477,8 +477,8 @@ function jobs ()
# Freeze and unfreeze kernel and board support packages # Freeze and unfreeze kernel and board support packages
# #
"Hold" | "Unhold" ) "Hold" | "Unhold" )
dialog --title " Update " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno \ dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Back" --yesno \
"\nDo you want to ${1,,} kernel updates?" 7 50 "\nDo you want to ${1,,} kernel updates?" 7 42
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
TARGET_BRANCH=$BRANCH TARGET_BRANCH=$BRANCH
exceptions "$BRANCH" exceptions "$BRANCH"
...@@ -497,15 +497,20 @@ function jobs () ...@@ -497,15 +497,20 @@ function jobs ()
"Desktop" ) "Desktop" )
if [[ -n $(service lightdm status 2> /dev/null | grep -w active | grep -w running) || -n $(service nodm status | grep -w active | grep -w running) ]]; then if [[ -n $(service lightdm status 2> /dev/null | grep -w active | grep -w running) || -n $(service nodm status | grep -w active | grep -w running) ]]; then
dialog --title " Desktop is enabled and running " --backtitle "$BACKTITLE" \ dialog --title " Desktop is enabled and running " --backtitle "$BACKTITLE" \
--yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50 --yes-label "Stop" --no-label "Back" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && service nodm stop && service lightdm stop && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm [[ $exitstatus = 0 ]] && service nodm stop && service lightdm stop && \
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm
else else
dialog --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \ dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Lightdm" \
--no-label "Nodm" --yesno "\nLightdm = full featured login display manager\nNodm = autoloading into desktop" 8 70 --no-label "Nodm" --yesno "\n\Z1Lightdm\Z0 = full featured login display manager\n\Z1Nodm\Z0 = autoloading into desktop" 8 70
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager && debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y --no-install-recommends install lightdm-gtk-greeter lightdm && systemctl start lightdm.service [[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && \
[[ $exitstatus = 1 ]] && [[ -f /etc/X11/default-display-manager ]] && echo "/usr/sbin/nodm" > /etc/X11/default-display-manager && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager && \
debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y --no-install-recommends install lightdm-gtk-greeter lightdm && systemctl start lightdm.service
[[ $exitstatus = 1 ]] && [[ -f /etc/X11/default-display-manager ]] && \
echo "/usr/sbin/nodm" > /etc/X11/default-display-manager && \
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start
fi fi
;; ;;
...@@ -682,7 +687,7 @@ function jobs () ...@@ -682,7 +687,7 @@ function jobs ()
# Toggle sshd options # Toggle sshd options
# #
"SSHd" ) "SSH" )
while true; do while true; do
DIALOG_CANCEL=1 DIALOG_CANCEL=1
...@@ -705,7 +710,7 @@ function jobs () ...@@ -705,7 +710,7 @@ function jobs ()
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \ selection=$(dialog --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \
"Exit" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \ "Back" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
$LISTLENGHT 74 21 "${MOTD[@]}" 2>&1 1>&3) $LISTLENGHT 74 21 "${MOTD[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -737,7 +742,7 @@ function jobs () ...@@ -737,7 +742,7 @@ function jobs ()
# Switch to daily builds # Switch to daily builds
# #
"Nightly" ) "Nightly" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \ dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
--yesno "\nYou are switching to automated nightly repository which is untested and might break your system.\ --yesno "\nYou are switching to automated nightly repository which is untested and might break your system.\
Are you fine with that?" 9 48 Are you fine with that?" 9 48
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
...@@ -745,7 +750,7 @@ function jobs () ...@@ -745,7 +750,7 @@ function jobs ()
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \ dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34 --no-label "Back" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
fi fi
;; ;;
...@@ -754,14 +759,13 @@ function jobs () ...@@ -754,14 +759,13 @@ function jobs ()
# Switch to stable builds # Switch to stable builds
# #
"Stable" ) "Stable" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \ dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
--yesno "\nYou are switching back to stable respository where you are going to get future updates.\ --yesno "\nYou are switching back to stable respository where you are going to get future updates. Are you fine with that?" 9 44
Are you fine with that?" 9 44
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
sed -i 's/beta.armbian.com/apt.armbian.com/' /etc/apt/sources.list.d/armbian.list sed -i 's/beta.armbian.com/apt.armbian.com/' /etc/apt/sources.list.d/armbian.list
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno \ dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Back" --yesno \
"\nReboot to apply new settings?" 7 34 "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
fi fi
...@@ -774,7 +778,7 @@ function jobs () ...@@ -774,7 +778,7 @@ function jobs ()
aval_kernel aval_kernel
if [[ $exitstatus = 0 ]]; then if [[ $exitstatus = 0 ]]; then
exceptions "$INSTALL_KERNEL" exceptions "$INSTALL_KERNEL"
dialog --title " Install and reboot " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \ dialog --title " Install and reboot " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
--yesno "\nSwitching to linux-image${TARGET_BRANCH}-${TARGET_FAMILY} \n\nMake sure you know what you are doing! \ --yesno "\nSwitching to linux-image${TARGET_BRANCH}-${TARGET_FAMILY} \n\nMake sure you know what you are doing! \
\n\nBoard config will be reverted to defaults." 11 46 \n\nBoard config will be reverted to defaults." 11 46
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
...@@ -791,12 +795,14 @@ function jobs () ...@@ -791,12 +795,14 @@ function jobs ()
fi fi
# install new # install new
INSTALL_DTB="" INSTALL_DTB=""
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && INSTALL_DTB="linux-dtb$TARGET_BRANCH-$TARGET_FAMILY" [[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && \
INSTALL_DTB="linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
debconf-apt-progress -- apt-get -y --no-install-recommends install linux-image${TARGET_BRANCH}-${TARGET_FAMILY} \ debconf-apt-progress -- apt-get -y --no-install-recommends install linux-image${TARGET_BRANCH}-${TARGET_FAMILY} \
linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} \ linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} \
linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD $INSTALL_DTB linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD $INSTALL_DTB
dialog --title "Kernel switch" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" --yesno "\nNew kernel was installed. Reboot?" 7 64 dialog --title "Kernel switch" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" \
--yesno "\nNew kernel was installed. Reboot?" 7 64
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && reboot [[ $exitstatus = 0 ]] && reboot
fi fi
...@@ -816,7 +822,8 @@ function jobs () ...@@ -816,7 +822,8 @@ function jobs ()
else else
debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confnew" -y --no-install-recommends install overlayroot debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confnew" -y --no-install-recommends install overlayroot
echo '#!/bin/bash' > /etc/update-motd.d/97-overlayroot echo '#!/bin/bash' > /etc/update-motd.d/97-overlayroot
echo 'if [ -n "$(mount | grep -w tmpfs-root)" ]; then echo -e "\n[\e[0m \e[1mremember: your system is in virtual read only mode\e[0m ]";fi' >> /etc/update-motd.d/97-overlayroot echo 'if [ -n "$(mount | grep -w tmpfs-root)" ]; then \
echo -e "\n[\e[0m \e[1mremember: your system is in virtual read only mode\e[0m ]";fi' >> /etc/update-motd.d/97-overlayroot
chmod +x /etc/update-motd.d/97-overlayroot chmod +x /etc/update-motd.d/97-overlayroot
dialog --title "Root overlay" --backtitle "$BACKTITLE" --yes-label "Reboot" \ dialog --title "Root overlay" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nEnable virtual read-only root and reboot." 7 45 --no-label "Cancel" --yesno "\nEnable virtual read-only root and reboot." 7 45
...@@ -824,5 +831,6 @@ function jobs () ...@@ -824,5 +831,6 @@ function jobs ()
fi fi
;; ;;
esac esac
} }
\ No newline at end of file
...@@ -148,7 +148,8 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear -- ...@@ -148,7 +148,8 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --
# #
function check_ht_capab () function check_ht_capab ()
{ {
declare -a arr=("[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]" "[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]" "[SHORT-GI-20][SHORT-GI-40][HT40+]") declare -a arr=("[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]" \
"[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]" "[SHORT-GI-20][SHORT-GI-40][HT40+]")
local j=0 local j=0
for i in "${arr[@]}" for i in "${arr[@]}"
do do
...@@ -225,7 +226,9 @@ function ip_editor () ...@@ -225,7 +226,9 @@ function ip_editor ()
2>&1 1>&3 | { 2>&1 1>&3 | {
read -r address;read -r netmask;read -r gateway read -r address;read -r netmask;read -r gateway
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
echo -e "# armbian-config created\nsource /etc/network/interfaces.d/*\n\nallow-hotplug $2\nno-auto-down $2\niface $2 inet static\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8" > $3 echo -e "# armbian-config created\nsource /etc/network/interfaces.d/*\n\nallow-hotplug $2\
\nno-auto-down $2\niface $2 inet static\
\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8" > $3
fi fi
} }
} }
...@@ -446,7 +449,11 @@ function connect_bt_interface () ...@@ -446,7 +449,11 @@ function connect_bt_interface ()
exec 3>&- exec 3>&-
if [[ $BT_ADAPTER != "" ]]; then if [[ $BT_ADAPTER != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nConnecting to $BT_ADAPTER " 5 35 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nConnecting to $BT_ADAPTER " 5 35
BT_EXEC=$(expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address\r";sleep 1;send "remove $address\r";sleep 1;expect -re $prompt;send "scan on\r";sleep 8;send "scan off\r";expect "Controller";send "trust $address\r";sleep 2;send "pair $address\r";sleep 2;send "connect $address\r";send_user "\nShould be paired now.\r";sleep 2;send "quit\r";expect eof') BT_EXEC=$(
expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address\r";
sleep 1;send "remove $address\r";sleep 1;expect -re $prompt;send "scan on\r";sleep 8;send "scan off\r";
expect "Controller";send "trust $address\r";sleep 2;send "pair $address\r";sleep 2;send "connect $address\r";
send_user "\nShould be paired now.\r";sleep 2;send "quit\r";expect eof')
echo "$BT_EXEC" > /tmp/bt-connect-debug.log echo "$BT_EXEC" > /tmp/bt-connect-debug.log
if [[ $(echo "$BT_EXEC" | grep "Connection successful" ) != "" ]]; then if [[ $(echo "$BT_EXEC" | grep "Connection successful" ) != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nYour device is ready to use!" 7 32 dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nYour device is ready to use!" 7 32
...@@ -470,7 +477,7 @@ while true; do ...@@ -470,7 +477,7 @@ while true; do
LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" ) LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" )
LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" ) LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" )
LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" ) LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" )
LIST+=( "SSHd" "Reconfigure SSH daemon" ) LIST+=( "SSH" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" ) LIST+=( "Firmware" "Upgrade board firmware" )
# detect desktop # detect desktop
......
...@@ -367,7 +367,7 @@ done ...@@ -367,7 +367,7 @@ done
/sbin/folder2ram -enablesystemd /sbin/folder2ram -enablesystemd
# Prevent accidentally destroying board performance by clicking around in OMV UI since # Prevent accidentally destroying board performance by clicking around in OMV UI since
# OMV sets 'powersave' governor when touching 'Power Management' settings. # OMV sets 'powersave' governor when touching 'Power Management' settings.
if [ -f /etc/default/cpufrequtils ]; then if [ -f /etc/default/cpufrequtils ]; then
. /etc/default/cpufrequtils . /etc/default/cpufrequtils
else else
...@@ -911,7 +911,7 @@ fi ...@@ -911,7 +911,7 @@ fi
# Install basic stuff # Install basic stuff
# #
export LANG=C #export LANG=C
echo -e "\nChecking dependencies. This might take a while." echo -e "\nChecking dependencies. This might take a while."
apt-get -qq -y --no-install-recommends install debconf-utils unzip build-essential html2text apt-transport-https dialog whiptail \ apt-get -qq -y --no-install-recommends install debconf-utils unzip build-essential html2text apt-transport-https dialog whiptail \
lsb-release bc expect html2text > /dev/null lsb-release bc expect html2text > /dev/null
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment