Unverified Commit 07a877b2 authored by Igor Pečovnik's avatar Igor Pečovnik Committed by GitHub
Browse files

Improve nightly / stable switching and add new branch naminig support (#72)

parent dae96143
...@@ -366,60 +366,50 @@ function kernel_desc () ...@@ -366,60 +366,50 @@ function kernel_desc ()
# reload kernel, bsp and armbian-config # reload kernel, bsp and armbian-config
# #
function reload_bsp(){ function reload_bsp(){
clear
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
# test install packages
TARGET_BRANCH=$BRANCH # new branch names introduced with 12/2019
if [[ -n $(apt-cache search --names-only "^linux-image-current") ]]; then
[[ BRANCH == next ]] && TARGET_BRANCH="legacy" && TARGET_UBOOT_BRANCH="legacy"
TARGET_BRANCH="current"
TARGET_UBOOT_BRANCH="current"
else
TARGET_BRANCH="${BRANCH}"
TARGET_UBOOT_BRANCH="${UBOOT_BRANCH}"
fi
exceptions "$INSTALL_KERNEL" exceptions "$INSTALL_KERNEL"
unset PACKAGE_LIST unset PACKAGE_LIST
[[ -n $(apt-cache search --names-only "^armbian-${LINUXFAMILY}$") ]] && \ PACKAGE_LIST="linux-${DISTROID}-root$TARGET_BRANCH-$BOARD"
PACKAGE_LIST=$PACKAGE_LIST" armbian-${LINUXFAMILY}" [[ -z ${TARGET_UBOOT_BRANCH} ]] && TARGET_UBOOT_BRANCH="current"
[[ -n $(apt-cache search --names-only "^armbian-${BOARD}$") ]] && \ PACKAGE_LIST=$PACKAGE_LIST" linux-u-boot-$BOARD-$TARGET_UBOOT_BRANCH"
PACKAGE_LIST=$PACKAGE_LIST" armbian-${BOARD}" check_if_installed armbian-${DISTROID}-desktop && PACKAGE_LIST=$PACKAGE_LIST" armbian-${DISTROID}-desktop"
[[ -n $(apt-cache search --names-only "^armbian-${DISTROID}$") ]] && \ check_if_installed linux-headers${TARGET_BRANCH}-${TARGET_FAMILY} && PACKAGE_LIST=$PACKAGE_LIST" linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}"
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=" " IFS=" "
[[ -n $(apt-cache search --names-only "^linux-dtb$TARGET_BRANCH-$TARGET_FAMILY") ]] && \ [[ -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-dtb$TARGET_BRANCH-$TARGET_FAMILY"
PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}" PACKAGE_LIST=$PACKAGE_LIST" linux-image${TARGET_BRANCH}-${TARGET_FAMILY}"
debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends \ debconf-apt-progress -- apt --download-only --allow-downgrades -y --no-install-recommends install $PACKAGE_LIST armbian-config
install $PACKAGE_LIST armbian-config
# if download is ok, remove old packages # if download is ok, remove old packages
if [[ $? = 0 ]]; then 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 debconf-apt-progress -- apt -y -qq purge linux-u-boot* linux-image* linux-dtb* linux-headers* linux-${DISTROID}-root* armbian-${DISTROID}-desktop* armbian-config
aptitude remove ~nlinux-dtb --quiet=100 -y >> /var/log/upgrade.log 2>&1 find "/boot/" -name "System.map*" -type f -delete
aptitude remove ~nlinux-headers --quiet=100 -y >> /var/log/upgrade.log 2>&1 find "/boot/" -name "config*" -type f -delete
aptitude remove ~nlinux-${DISTROID}-root --quiet=100 -y >> /var/log/upgrade.log 2>&1 find "/boot/" -name "vmlinuz*" -type f -delete
aptitude remove ~narmbian-config --quiet=100 -y >> /var/log/upgrade.log 2>&1 find "/boot/" -name "*nitrd*" -type f -delete
aptitude remove ~narmbian-${LINUXFAMILY} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${BOARD} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID} --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID}-desktop --quiet=100 -y >> /var/log/upgrade.log 2>&1
aptitude remove ~narmbian-${DISTROID}-desktop-xfce --quiet=100 -y >> /var/log/upgrade.log 2>&1
# install packages # install packages
echo $PACKAGE_LIST >> /var/log/upgrade.log echo $PACKAGE_LIST >> /var/log/upgrade.log
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends --reinstall \ 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 -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE_LIST armbian-config
# clean apt cache
apt clean
if [[ $? = 1 ]]; then if [[ $? = 1 ]]; then
echo "Something went wrong ... check logs."; exit; echo "Something went wrong ... check logs."; exit;
else else
reboot apt clean
fi fi
fi fi
} }
......
...@@ -1413,8 +1413,8 @@ function jobs () ...@@ -1413,8 +1413,8 @@ function jobs ()
"\nYou are switching to an untested auto-build repository which might break your system.\n\nContinue?" 10 48 "\nYou are switching to an untested auto-build repository which might break your system.\n\nContinue?" 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/^deb http:\/\/[^ ]*/deb http:\/\/beta.armbian.com/' /etc/apt/sources.list.d/armbian.list
reload_bsp "nightly" reload_bsp
fi fi
fi fi
;; ;;
...@@ -1430,8 +1430,8 @@ function jobs () ...@@ -1430,8 +1430,8 @@ function jobs ()
"\nYou are switching to a stable repository where you will receive future updates.\n\nContinue?" 9 44 "\nYou are switching to a stable repository where you will receive future updates.\n\nContinue?" 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/^deb http:\/\/beta/deb http:\/\/apt/' /etc/apt/sources.list.d/armbian.list
reload_bsp "stable" reload_bsp
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