Commit cc1078ad authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Warning and acknowledge at startup, switch from nightly to stable branch, test...

Warning and acknowledge at startup, switch from nightly to stable branch, test install before removing old kernel
parent af36951e
...@@ -122,6 +122,11 @@ TITLE="Configuring $BOARD_NAME" ...@@ -122,6 +122,11 @@ TITLE="Configuring $BOARD_NAME"
WIRELESS_ADAPTER="wlan0" WIRELESS_ADAPTER="wlan0"
NETWORK_CONF="/etc/network/interfaces" NETWORK_CONF="/etc/network/interfaces"
exec 3>&1
ACKNOWLEDGEMENT=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse --title "Warning" --clear --radiolist "\nThis configuration tool need superuser rights and it's not yet fully tested yet.\n \n" 11 60 9 "Yes, I understand the risks" "" off 2>&1 1>&3)
exec 3>&-
if [[ $ACKNOWLEDGEMENT == "" ]]; then exit; fi
LIST=() LIST=()
########################################################################################################################################### ###########################################################################################################################################
# here we add new items to menu. with condition when needed # here we add new items to menu. with condition when needed
...@@ -135,6 +140,7 @@ fi ...@@ -135,6 +140,7 @@ fi
[[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && -n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" ) [[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && -n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
[[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "Wireless" "Connect to your router" ) [[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "Wireless" "Connect to your router" )
[[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] && LIST+=( "Nightly" "Switch to daily builds" ) [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] && LIST+=( "Nightly" "Switch to daily builds" )
[[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list) ]] && LIST+=( "Stable" "Switch to stable builds" )
LIST+=( "Hotspot" "Manage wireless access point" ) LIST+=( "Hotspot" "Manage wireless access point" )
LIST+=( "Network" "Edit network settings" ) LIST+=( "Network" "Edit network settings" )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'*' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' | wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" ) [[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'*' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' | wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" )
...@@ -209,7 +215,7 @@ while true; do ...@@ -209,7 +215,7 @@ while true; do
"Overlayroot" ) "Overlayroot" )
if [[ -n $(mount | grep -w overlay) ]]; then if [[ -n $(mount | grep -w overlay) ]]; then
dialog --title "Root overlay" --backtitle "$BACKTITLE" --yes-label "Disable" --no-label "Cancel" --yesno "\nYour system is already virtual read-only.\n\nDo you want to disable this feature and reboot?" 9 60 dialog --title "Root overlay" --backtitle "$BACKTITLE" --yes-label "Disable" --no-label "Cancel" --yesno "\nYour system is already virtual read-only.\n\nDo you want to disable this feature and reboot?" 9 60
[[ $? = 0 ]] && overlayroot-chroot sed -i "s/^overlayroot=.*/overlayroot=\"\"/" /etc/overlayroot.conf && reboot [[ $? = 0 ]] && overlayroot-chroot sed -i "s/^overlayroot=.*/overlayroot=\"\"/" /etc/overlayroot.conf && rm /etc/update-motd.d/97-overlayroot && reboot
else else
debconf-apt-progress -- apt-get -y --no-install-recommends install overlayroot debconf-apt-progress -- apt-get -y --no-install-recommends install overlayroot
echo '#!/bin/bash' > /etc/update-motd.d/97-overlayroot echo '#!/bin/bash' > /etc/update-motd.d/97-overlayroot
...@@ -355,6 +361,17 @@ while true; do ...@@ -355,6 +361,17 @@ while true; do
"\nReboot to apply new settings?" 7 34 "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
;; ;;
"Stable" )
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 -y upgrade
dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno \
"\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
;;
"Install" ) "Install" )
nand-sata-install nand-sata-install
;; ;;
...@@ -415,11 +432,15 @@ while true; do ...@@ -415,11 +432,15 @@ while true; do
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
# remove old # remove old
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel." 5 28 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel." 5 28
aptitude remove ~nlinux-image --quiet=100 >> /var/log/upgrade.log apt-get -s -y -qq --no-install-recommends install linux-image${TARGET_BRANCH}-${TARGET_FAMILY} linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} linux-u-boot-${BOARD}-${UBOOT_BRANCH} linux-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD > /dev/null 2>&1
aptitude remove ~nlinux-dtb --quiet=100 >> /var/log/upgrade.log # if test download is ok, remove old kernel
aptitude remove ~nlinux-headers --quiet=100 >> /var/log/upgrade.log if [[ $? = 0 ]]; then
aptitude remove ~nlinux-image --quiet=100 >> /var/log/upgrade.log
aptitude remove ~nlinux-dtb --quiet=100 >> /var/log/upgrade.log
aptitude remove ~nlinux-headers --quiet=100 >> /var/log/upgrade.log
fi
# install new # install new
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-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD 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-$(lsb_release -cs)-root$TARGET_BRANCH-$BOARD
[[ $UBOOT_BRANCH != "default" ]] && debconf-apt-progress -- apt-get -y --no-install-recommends install linux-dtb$TARGET_BRANCH-$TARGET_FAMILY [[ $UBOOT_BRANCH != "default" ]] && debconf-apt-progress -- apt-get -y --no-install-recommends install linux-dtb$TARGET_BRANCH-$TARGET_FAMILY
reboot reboot
fi fi
......
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