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

Further improvements when changing kernel and switching beta/stable

parent a9eea65f
......@@ -348,29 +348,23 @@ function reload_bsp(){
# test install packages
TARGET_BRANCH=$BRANCH
exceptions "$INSTALL_KERNEL"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nProbing test install ..." 5 28
unset PACKAGE_LIST
[[ -n $(apt-cache search --names-only "^armbian-${LINUXFAMILY}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}"
[[ -n $(apt-cache search --names-only "^armbian-${BOARD}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}-desktop-xfce$") ]] && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop-xfce"
# if new packages are absent, reinstall old ones
if [[ -z $PACKAGE_LIST ]]; then
PACKAGE_LIST="linux-${DISTROID}-root$TARGET_BRANCH-$BOARD"
check_if_installed armbian-${DISTROID}-desktop && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop"
fi
# reinstall headers only if they are already installed
check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"
IFS=" "
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && PACKAGE_LIST=$PACKAGE_LIST" linux-dtb$TARGET_BRANCH-$TARGET_FAMILY"
PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
apt-get -s -y --no-install-recommends install $PACKAGE_LIST > /tmp/reload_bsp.log 2>&1
# if test download is ok, remove old packages
debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST armbian-config
# if 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*${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
......@@ -385,14 +379,12 @@ function reload_bsp(){
aptitude remove ~narmbian-${DISTROID}-desktop-xfce --quiet=100 -y >> /var/log/upgrade.log 2>&1
# install packages
echo $PACKAGE_LIST >> /var/log/upgrade.log
debconf-apt-progress -- apt-get --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
-y -qq --no-install-recommends install $PACKAGE_LIST armbian-config
if [[ $? = 1 ]]; then echo "Something went wrong ... check logs."; exit; fi
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
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE_LIST armbian-config
if [[ $? = 1 ]]; then
echo "Something went wrong ... check logs."; exit;
else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/reload_bsp.log" 9 48
reboot
fi
fi
}
......@@ -451,7 +443,7 @@ function other_kernel_version ()
TARGET_VERSION_SUB=$(echo $TARGET_VERSION_DTB | cut -f2 -d"=")
[[ -n $(apt-cache madison "$TARGET_VERSION_PRE" | grep $TARGET_VERSION_SUB ) ]] && PACKAGE_LIST=$PACKAGE_LIST" $TARGET_VERSION_DTB"
echo $PACKAGE_LIST > /tmp/switch_kernel.log 2>&1
apt-get -s -y --allow-downgrades --no-install-recommends install $PACKAGE_LIST >> /tmp/switch_kernel.log 2>&1
debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST
if [[ $? = 0 ]]; then
# remove old kernel
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nRemoving current kernel ..." 5 36
......@@ -466,7 +458,7 @@ function other_kernel_version ()
find "/boot/" -name "config*" -type f -delete
find "/boot/" -name "vmlinuz*" -type f -delete
find "/boot/" -name "*nitrd*" -type f -delete
debconf-apt-progress -- apt-get -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
if [[ $? = 0 ]]; then reboot; fi
else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48
......
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