Skip to content

Commit

Permalink
Enable distro upgrades procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Sep 27, 2024
1 parent bd256bc commit 5133d31
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
# define docker images where we will run test install
dockerimages=("debian:bookworm" "debian:trixie" "ubuntu:jammy" "ubuntu:noble")
dockerimages=("debian:bullseye" "debian:bookworm" "debian:trixie" "ubuntu:focal" "ubuntu:jammy" "ubuntu:noble")
# read tests cases and loop them
Expand Down Expand Up @@ -110,14 +110,16 @@ jobs:
apt -y install wget gpg
# add armbian repository
URL=apt.armbian.com
URL=beta.armbian.com
wget https://${URL}/armbian.key -O key
gpg --dearmor < key | tee /usr/share/keyrings/armbian.gpg > /dev/null
chmod go+r /usr/share/keyrings/armbian.gpg
echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] http://${URL} $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" | tee /etc/apt/sources.list.d/armbian.list
apt update -y
apt upgrade -y
apt -y install sudo procps systemd whiptail jq lsb-release iproute2
apt -y -o Dpkg::Options::="--force-confold" install sudo procps systemd whiptail jq lsb-release iproute2 armbian-bsp-cli-wsl2-x86-current-grub
sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target
cat /etc/armbian-distribution-status
# install packages / except howdy as its too large
export DEBIAN_FRONTEND=noninteractive
Expand Down
31 changes: 30 additions & 1 deletion lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,37 @@
"src_reference": "",
"author": "Igor Pecovnik",
"condition": ""
},
{
"id": "S25",
"description": "Distribution upgrades",
"condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade rolling verify",
"sub": [
{
"id": "S26",
"description": "Upgrade to latest stable / LTS",
"prompt": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!",
"command": [
"release_upgrade stable"
],
"status": "Active",
"author": "Igor Pecovnik",
"condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade stable verify"
},
{
"id": "S27",
"description": "Upgrade to rolling unstable",
"prompt": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!",
"command": [
"release_upgrade rolling"
],
"status": "Active",
"author": "Igor Pecovnik",
"condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade rolling verify"
}
]
}
]
]
},
{
"id": "Network",
Expand Down
39 changes: 39 additions & 0 deletions lib/armbian-configng/config.ng.software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,42 @@ install_docker() {
whiptail --msgbox "ERROR ! ${DISTRO} $DISTROID distribution not found in repository!" 7 70
fi
}


release_upgrade(){

local upgrade_type=$1
local verify=$2

local distroid=$DISTROID

if [[ "${upgrade_type}" == stable ]]; then
local filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1)
elif [[ "${upgrade_type}" == unstable ]]; then
local filter=$(grep "eos\|csc" /etc/armbian-distribution-status | cut -d"=" -f1)
else
local filter=$(cat /etc/armbian-distribution-status | cut -d"=" -f1)
fi

local upgrade=$(for j in $filter; do
for i in $(grep "^${distroid}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do
if [[ $i == $j ]]; then
echo $i
fi
done
done | tail -1)
if [[ -z $upgrade ]]; then
return 1;
elif [[ -z $verify ]]; then

[[ -f /etc/apt/sources.list.d/ubuntu.sources ]] && sed "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/ubuntu.sources
[[ -f /etc/apt/sources.list ]] && sed "s/$distroid/$upgrade/g" /etc/apt/sources.list
exit

apt-get -y update
apt-get -y -o Dpkg::Options::="--force-confold" upgrade --without-new-pkgs
apt-get -y -o Dpkg::Options::="--force-confold" full-upgrade
apt-get -y --purge autoremove
exit
fi
}
2 changes: 2 additions & 0 deletions tests/S26.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
RELEASE="bookworm:jammy:noble"
2 changes: 2 additions & 0 deletions tests/S27.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
RELEASE="bookworm:jammy:noble"

0 comments on commit 5133d31

Please sign in to comment.