Commit 6038d1ea authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Better way of switching from stable to beta and back

parent c87cedc8
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# beta_disclaimer # beta_disclaimer
# show_box # show_box
# description # description
# reload_bsp
# aval_kernel # aval_kernel
# aval_dtbs # aval_dtbs
# get_a20modes # get_a20modes
...@@ -297,6 +298,42 @@ function kernel_desc () ...@@ -297,6 +298,42 @@ function kernel_desc ()
#
# reload kernel, bsp and armbian-config
#
function reload_bsp(){
debconf-apt-progress -- apt-get update
# test install packages
TARGET_BRANCH=$BRANCH
exceptions "$INSTALL_KERNEL"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nTest install ..." 5 36
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
# if test download is ok, remove old packages
if [[ $? = 0 ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
aptitude remove ~nlinux-image --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-$(lsb_release -cs)-root --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1
# install packages
INSTALL_DTB=""
[[ -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 --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
-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 armbian-config $INSTALL_DTB
dialog --title "Switching to $1" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
fi
}
# #
# check if board has alternative kernels # check if board has alternative kernels
......
...@@ -1266,23 +1266,21 @@ function jobs () ...@@ -1266,23 +1266,21 @@ function jobs ()
# Switch to daily builds # Switch to daily builds
# #
"Nightly" ) "Nightly" )
if ! is_package_manager_running; then if ! is_package_manager_running; then
dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" --yesno \ dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" \
--no-label "Cancel" --yesno \
"\nYou are switching to untested auto-build repository which might break your system.\n\nAre you fine with that?" 10 48 "\nYou are switching to untested auto-build repository which might break your system.\n\nAre you fine with that?" 10 48
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
sed -i 's/apt.armbian.com/beta.armbian.com/' /etc/apt/sources.list.d/armbian.list sed -i 's/apt.armbian.com/beta.armbian.com/' /etc/apt/sources.list.d/armbian.list
debconf-apt-progress -- apt-get update reload_bsp "nightly"
debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
fi fi
fi fi
;; ;;
# Switch to stable builds and reinstall armbian packages # Switch to stable builds
# #
"Stable" ) "Stable" )
...@@ -1290,35 +1288,10 @@ function jobs () ...@@ -1290,35 +1288,10 @@ function jobs ()
dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" \ dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" \
--no-label "Cancel" --yesno \ --no-label "Cancel" --yesno \
"\nYou are switching back to stable respository where you are going to get future updates. Are you fine with that?" 9 44 "\nYou are switching back to stable respository where you are going to get future updates. 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 reload_bsp "stable"
# remove nighlty packages and install stable
TARGET_BRANCH=$BRANCH
exceptions "$INSTALL_KERNEL"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current nightly kernel." 5 36
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
# if test download is ok, remove old kernel
if [[ $? = 0 ]]; then
aptitude remove ~nlinux-image --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~nlinux-$(lsb_release -cs)-root --quiet=100 -y >> /var/log/upgrade.log 2>&1
fi
# install new packages
INSTALL_DTB=""
[[ -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 --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
-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 $INSTALL_DTB
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
fi fi
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