Code cleaning attempts #1 (#2911)

* Remove Docker version check from compile.sh since its deprecated

* Remove meta package creation which was needed for upgrade

* Update in-code documentation

* Bugfix

* Making oneliner

* Remove Groovy debug leftovers

* Add readme to distributions

* Update

* More text adjust

* Add virtual

* add more
This commit is contained in:
Igor Pečovnik
2021-06-21 23:03:39 +02:00
committed by GitHub
parent 7325cc57d7
commit 7d330d2e5b
6 changed files with 48 additions and 59 deletions

View File

@@ -11,7 +11,7 @@
# DO NOT EDIT THIS FILE
# use configuration files like config-default.conf to set the build configuration
# check Armbian documentation for more info
# check Armbian documentation https://docs.armbian.com/ for more info
SRC="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
@@ -39,10 +39,10 @@ check_args ()
# Take a variable if the branch exists locally
if [ "${p#*=}" == "$(git branch | \
gawk -v b="${p#*=}" '{if ( $NF == b ) {print $NF}}')" ]; then
echo "Setting $p"
echo -e "[\e[0;35m warn \x1B[0m] Setting $p"
eval "$p"
else
echo "Skip $p Set as LIB_TAG=\"\""
echo -e "[\e[0;35m warn \x1B[0m] Skip $p setting as LIB_TAG=\"\""
eval LIB_TAG=""
fi
;;
@@ -74,7 +74,7 @@ update_src() {
echo "Unknown command!"
fi
done
else
elif [[ $(git branch | grep "*" | awk '{print $2}') != "${LIB_TAG}" && -n "${LIB_TAG}" ]]; then
git checkout "${LIB_TAG:-master}"
git pull
fi
@@ -187,15 +187,6 @@ if [[ "${1}" == docker && -f /etc/debian_version && -z "$(command -v docker)" ]]
exit $?
fi
# check if Docker version is high enough
[[ $(systemd-detect-virt) == 'none' ]] && dockerversion=$(docker version | grep runc -A1 | tail -n 1 | awk '{print $2}')
if [[ "${1}" == docker && -n ${dockerversion} ]] && linux-version compare "${dockerversion}" lt 1.0.0-rc93; then
display_alert "Your Docker engine is too old - using Docker from nigtly builds" "Required > 1.0.0-rc92" "wrn"
sed -i "s/edge/nightly/" /etc/apt/sources.list.d/docker.list
apt-get update
apt-get upgrade -y -qq
fi
# Create userpatches directory if not exists
mkdir -p "${SRC}"/userpatches

View File

@@ -0,0 +1,9 @@
## Upstream distributions status
Supported Debian and Ubuntu upstream distributions / packages base. Here we define their status:
|support|description|
|:--|:--|
|supported|current package base|
|csc |unstable, work in progress|
|eos |former stable, end of life|

View File

@@ -12,4 +12,6 @@
| Allwinner sun6i : sunxi | sun50iw1 : sunxi64 |
| Allwinner sun7i : sunxi | sun50iw2 : sunxi64 |
| Allwinner sun8i : sunxi | sun50iw6 : sunxi64 |
| Allwinner sun9i : sunxi                             |                                 |
| Allwinner sun9i : sunxi                             | virtual : qemu-virtual                           |
|| zynq : zynq |
|| jetson-nano : jetson-nano |

View File

@@ -610,14 +610,7 @@ install_distribution_specific()
chroot "${SDCARD}" /bin/bash -c "systemctl disable motd-news.service >/dev/null 2>&1"
chroot "${SDCARD}" /bin/bash -c "systemctl disable motd-news.timer >/dev/null 2>&1"
rm -f "${SDCARD}"/etc/update-motd.d/10-uname
rm -f "${SDCARD}"/etc/update-motd.d/10-help-text
rm -f "${SDCARD}"/etc/update-motd.d/50-motd-news
rm -f "${SDCARD}"/etc/update-motd.d/80-esm
rm -f "${SDCARD}"/etc/update-motd.d/80-livepatch
rm -f "${SDCARD}"/etc/update-motd.d/90-updates-available
rm -f "${SDCARD}"/etc/update-motd.d/91-release-upgrade
rm -f "${SDCARD}"/etc/update-motd.d/95-hwe-eol
rm -f "${SDCARD}"/etc/update-motd.d/{10-uname,10-help-text,50-motd-news,80-esm,80-livepatch,90-updates-available,91-release-upgrade,95-hwe-eol}
# remove motd news from motd.ubuntu.com
[[ -f "${SDCARD}"/etc/default/motd-news ]] && sed -i "s/^ENABLED=.*/ENABLED=0/" "${SDCARD}"/etc/default/motd-news

View File

@@ -169,7 +169,7 @@ create_sources_list()
EOF
;;
xenial|bionic|groovy|focal|groovy|hirsute)
xenial|bionic|focal|hirsute)
cat <<-EOF > "${basedir}"/etc/apt/sources.list
deb http://${UBUNTU_MIRROR} $release main restricted universe multiverse
#deb-src http://${UBUNTU_MIRROR} $release main restricted universe multiverse
@@ -807,15 +807,26 @@ addtorepo()
repo-manipulate() {
local DISTROS=("xenial" "stretch" "bionic" "buster" "bullseye" "groovy" "focal" "hirsute" "sid")
repo-manipulate()
{
# repository manipulation
# "show" displays packages in each repository
# "server" serve repository - useful for local diagnostics
# "unique" manually select which package should be removed from all repositories
# "update" search for new files in output/debs* to add them to repository
# "purge" leave only last 5 versions
local DISTROS=($(grep -rw config/distributions/* -e 'supported' | cut -d"/" -f3))
case $@ in
serve)
# display repository content
display_alert "Serving content" "common utils" "ext"
aptly serve -listen=$(ip -f inet addr | grep -Po 'inet \K[\d.]+' | grep -v 127.0.0.1 | head -1):80 -config="${SCRIPTPATH}config/${REPO_CONFIG}"
exit 0
;;
show)
# display repository content
for release in "${DISTROS[@]}"; do
@@ -830,6 +841,7 @@ repo-manipulate() {
;;
unique)
# which package should be removed from all repositories
IFS=$'\n'
while true; do
LIST=()
@@ -849,7 +861,7 @@ repo-manipulate() {
LIST=("${new_list[@]}")
LIST_LENGTH=$((${#LIST[@]}/2));
exec 3>&1
TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "BACKTITLE" --no-collapse --title "Switch from and reboot" --clear --menu "Delete" $((9+${LIST_LENGTH})) 82 65 "${LIST[@]}" 2>&1 1>&3)
TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "BACKTITLE" --no-collapse --title "Remove packages from repositories" --clear --menu "Delete" $((9+${LIST_LENGTH})) 82 65 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
if [[ $exitstatus -eq 0 ]]; then
@@ -861,8 +873,10 @@ repo-manipulate() {
else
exit 1
fi
aptly db cleanup -config="${SCRIPTPATH}config/${REPO_CONFIG}" > /dev/null 2>&1
done
;;
update)
# display full help test
# run repository update
@@ -871,6 +885,7 @@ repo-manipulate() {
cp "${SCRIPTPATH}"config/armbian.key "${REPO_STORAGE}"/public/
exit 0
;;
purge)
for release in "${DISTROS[@]}"; do
repo-remove-old-packages "$release" "armhf" "5"
@@ -880,6 +895,7 @@ repo-manipulate() {
done
exit 0
;;
purgesource)
for release in "${DISTROS[@]}"; do
aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" 'Name (% *-source*)'
@@ -889,15 +905,20 @@ repo-manipulate() {
exit 0
;;
*)
echo -e "Usage: repository show | serve | create | update | purge\n"
echo -e "\n show = display repository content"
echo -e "\n serve = publish your repositories on current server over HTTP"
echo -e "\n update = updating repository"
echo -e "\n purge = removes all but last 5 versions\n\n"
echo -e "Usage: repository show | serve | unique | create | update | purge | purgesource\n"
echo -e "\n show = display repository content"
echo -e "\n serve = publish your repositories on current server over HTTP"
echo -e "\n unique = manually select which package should be removed from all repositories"
echo -e "\n update = updating repository"
echo -e "\n purge = removes all but last 5 versions"
echo -e "\n purgesource = removes all sources\n\n"
exit 0
;;
esac
} # ParseOptions
}
@@ -917,11 +938,8 @@ repo-remove-old-packages() {
pkg_name=$(echo "${pkg}" | cut -d_ -f1)
for subpkg in $(aptly repo search -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${repo}" "Name ($pkg_name)" | grep -v "ERROR: no results" | sort -rt '.' -nk4); do
((count+=1))
# echo $subpkg
if [[ $count -gt $keep ]]; then
#echo "rem"
pkg_version=$(echo "${subpkg}" | cut -d_ -f2)
#echo $pkg_version
aptly repo remove -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${repo}" "Name ($pkg_name), Version (= $pkg_version)"
fi
done

View File

@@ -319,30 +319,6 @@ fi
mkdir -p "${DEB_STORAGE}/${RELEASE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/"
# Can be removed after 21.05
# create meta package for upgrade
local DEB_BRANCH=("legacy" "current" "edge")
for deb_branch in "${DEB_BRANCH[@]}"; do
local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${deb_branch}-${BOARD}_${REVISION}_${ARCH}
mkdir -p "${destination}"/DEBIAN
cat <<-EOF > "${destination}"/DEBIAN/control
Package: linux-${RELEASE}-root-${deb_branch}-${BOARD}
Version: $REVISION
Architecture: all
Priority: optional
Section: oldlibs
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Depends: ${BSP_CLI_PACKAGE_NAME}
Description: This is a transitional package. It can safely be removed.
EOF
display_alert "Building meta package" "$CHOSEN_ROOTFS" "info"
fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1
mkdir -p "${DEB_STORAGE}/${RELEASE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/"
done
# Can be removed after 21.05
# cleanup
rm -rf ${bsptempdir}
}