introduce armbian-base-files artifact, which downloads & repacks base-files from upstream distro

- bsp-cli: now depends on `base-files (>= ${REVISION})`, this way upgrading the bsp-cli causes our base-files to be installed
  - bsp-cli no longer does gymnastics with /etc/os-release et al, all done in armbian-base-files now
- general/apt-utils.sh: introduce `apt_find_upstream_package_version_and_download_url()`
- base-files: add release to version, in order to comply with repo restrictions (valid repos can't have two different debs with same name and version, md5 must match)
This commit is contained in:
Ricardo Pardini
2023-05-12 18:11:51 +02:00
committed by igorpecovnik
parent c7fc14a7b8
commit 1fd5d519d4
9 changed files with 318 additions and 32 deletions

View File

@@ -31,6 +31,11 @@ function compile_armbian-bsp-cli() {
# Replaces: base-files is needed to replace /etc/update-motd.d/ files on Xenial
# Depends: linux-base is needed for "linux-version" command in initrd cleanup script
# Depends: fping is needed for armbianmonitor to upload armbian-hardware-monitor.log
# Depends: base-files (>= ${REVISION}) is to force usage of our base-files package (not the original Distro's).
declare depends_base_files=", base-files (>= ${REVISION})"
if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" == "yes" ]]; then
depends_base_files=""
fi
cat <<- EOF > "${destination}"/DEBIAN/control
Package: ${artifact_name}
Version: ${artifact_version}
@@ -39,7 +44,7 @@ function compile_armbian-bsp-cli() {
Installed-Size: 1
Section: kernel
Priority: optional
Depends: bash, linux-base, u-boot-tools, initramfs-tools, lsb-release, fping
Depends: bash, linux-base, u-boot-tools, initramfs-tools, lsb-release, fping${depends_base_files}
Suggests: armbian-config
Replaces: zram-config, base-files
Recommends: bsdutils, parted, util-linux, toilet
@@ -108,12 +113,7 @@ function compile_armbian-bsp-cli() {
postinst_functions+=(board_side_bsp_cli_postinst_update_uboot_bootscript)
fi
if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" != "yes" ]]; then
# add to postinst, to change PRETTY_NAME to Armbian's
postinst_functions+=(board_side_bsp_cli_postinst_os_release_armbian)
else
display_alert "bsp-cli: KEEP_ORIGINAL_OS_RELEASE" "Keeping original /etc/os-release's PRETTY_NAME as original" "info"
fi
# PRETTY_NAME stuff is now done in armbian-base-files artifact
# add configuration for setting uboot environment from userspace with: fw_setenv fw_printenv
if [[ -n $UBOOT_FW_ENV ]]; then
@@ -328,14 +328,7 @@ function board_side_bsp_cli_postinst_base() {
# Source the armbian-release information file
[ -f /etc/armbian-release ] && . /etc/armbian-release
# Read release value from lsb-release and set it separately as ARMBIAN_PRETTY_NAME
# More is done, actually taking over PRETTY_NAME, in separate board_side_bsp_cli_postinst_os_release_armbian()
if [ -f /etc/lsb-release ]; then
ORIGINAL_DISTRO_RELEASE="$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')"
echo "ARMBIAN_PRETTY_NAME=\"${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE}\"" >> /etc/os-release
echo -e "${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE} \\l \n" > /etc/issue
echo -e "${VENDOR} ${REVISION} ${ORIGINAL_DISTRO_RELEASE}" > /etc/issue.net
fi
# ARMBIAN_PRETTY_NAME is now set in armbian-base-files.
# Force ramlog to be enabled if it exists. @TODO: why?
[ -f /etc/lib/systemd/system/armbian-ramlog.service ] && systemctl --no-reload enable armbian-ramlog.service
@@ -353,17 +346,6 @@ function board_side_bsp_cli_postinst_base() {
fi
}
function board_side_bsp_cli_postinst_os_release_armbian() {
# Source the armbian-release information file
[ -f /etc/armbian-release ] && . /etc/armbian-release
# Read release value from lsb-release, so deploying a bsp-cli package on top of "X" makes it "Armbian X"
if [ -f /etc/lsb-release ]; then
ORIGINAL_DISTRO_RELEASE="$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')"
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION ${ORIGINAL_DISTRO_RELEASE}\"/" /etc/os-release
fi
}
function board_side_bsp_cli_postinst_finish() {
[ ! -f "/etc/network/interfaces" ] && [ -f "/etc/network/interfaces.default" ] && cp /etc/network/interfaces.default /etc/network/interfaces
ln -sf /var/run/motd /etc/motd