Refactor armbian-bsp-cli package creation (#3378)

* Refactor armbian-bsp-cli package creation

- added general distro status for all in separate file inside BSP
- remove branch and distro specifics

* Looking for prebuild pack

* Small fixes
This commit is contained in:
Igor Pečovnik 2022-01-06 11:50:24 +01:00 committed by GitHub
parent 9d8a424c03
commit 310495ddf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 22 deletions

View File

@ -327,7 +327,7 @@ POST_INSTALL_KERNEL_DEBS
# install board support packages
if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then
install_deb_chroot "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" | tee "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
install_deb_chroot "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb" | tee "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
else
install_deb_chroot "${CHOSEN_ROOTFS}" "remote"
fi

View File

@ -640,7 +640,7 @@ fingerprint_image()
{
cat <<-EOF > "${1}"
--------------------------------------------------------------------------------
Title: ${VENDOR} $REVISION ${BOARD^} $DISTRIBUTION $RELEASE $BRANCH
Title: ${VENDOR} $REVISION ${BOARD^} $BRANCH
Kernel: Linux $VER
Build date: $(date +'%d.%m.%Y')
Maintainer: $MAINTAINER <$MAINTAINERMAIL>

View File

@ -517,7 +517,7 @@ overlayfs_wrapper "cleanup"
# create board support package
[[ -n "${RELEASE}" && ! -f "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-cli* ]] && create_board_package
[[ -n "${RELEASE}" && ! -f "${DEB_STORAGE}/${BSP_CLI_PACKAGE_FULLNAME}.deb" && "${REPOSITORY_INSTALL}" != *armbian-bsp-cli* ]] && create_board_package

View File

@ -23,7 +23,7 @@ create_board_package()
bsptempdir=$(mktemp -d)
chmod 700 ${bsptempdir}
trap "rm -rf \"${bsptempdir}\" ; exit 0" 0 1 2 3 15
local destination=${bsptempdir}/${RELEASE}/${BSP_CLI_PACKAGE_FULLNAME}
local destination=${bsptempdir}/${BSP_CLI_PACKAGE_FULLNAME}
mkdir -p "${destination}"/DEBIAN
cd $destination
@ -76,7 +76,7 @@ create_board_package()
Replaces: zram-config, base-files, armbian-tools-$RELEASE, linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~)
Breaks: linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~)
Recommends: bsdutils, parted, util-linux, toilet
Description: Tweaks for Armbian $RELEASE on $BOARD
Description: Armbian board support files for $BOARD
EOF
# set up pre install script
@ -246,10 +246,15 @@ fi
mv /usr/lib/chromium-browser/master_preferences.dpkg-dist /usr/lib/chromium-browser/master_preferences
fi
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION "${RELEASE^}"\"/" /etc/os-release
echo "${VENDOR} ${REVISION} ${RELEASE^} \\l \n" > /etc/issue
echo "${VENDOR} ${REVISION} ${RELEASE^}" > /etc/issue.net
# Read release value
if [ -f /etc/lsb-release ]; then
RELEASE=\$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2 | sed 's/.*/\u&/')
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"${VENDOR} $REVISION "\${RELEASE}"\"/" /etc/os-release
echo "${VENDOR} ${REVISION} \${RELEASE} \\l \n" > /etc/issue
echo "${VENDOR} ${REVISION} \${RELEASE}" > /etc/issue.net
fi
# Reload services
systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service >/dev/null 2>&1
exit 0
EOF
@ -270,8 +275,12 @@ fi
activate update-initramfs
EOF
# read distribution support status
set_distribution_status
# copy distribution support status
local releases=($(find ${SRC}/config/distributions -mindepth 1 -maxdepth 1 -type d))
for i in ${releases[@]}
do
echo "$(echo $i | sed 's/.*\///')=$(cat $i/support)" >> "${destination}"/etc/armbian-distribution-status
done
# armhwinfo, firstrun, armbianmonitor, etc. config file
cat <<-EOF > "${destination}"/etc/armbian-release
@ -281,8 +290,6 @@ fi
BOARDFAMILY=${BOARDFAMILY}
BUILD_REPOSITORY_URL=${BUILD_REPOSITORY_URL}
BUILD_REPOSITORY_COMMIT=${BUILD_REPOSITORY_COMMIT}
DISTRIBUTION_CODENAME=${RELEASE}
DISTRIBUTION_STATUS=${DISTRIBUTION_STATUS}
VERSION=$REVISION
LINUXFAMILY=$LINUXFAMILY
ARCH=$ARCHITECTURE
@ -292,12 +299,6 @@ fi
KERNEL_IMAGE_TYPE=$KERNEL_IMAGE_TYPE
EOF
if [[ $BUILD_DESKTOP == yes ]]; then
cat <<-EOF >> "${destination}"/etc/armbian-release
DESKTOP=$DESKTOP_ENVIRONMENT
EOF
fi
# this is required for NFS boot to prevent deconfiguring the network on shutdown
sed -i 's/#no-auto-down/no-auto-down/g' "${destination}"/etc/network/interfaces.default
@ -318,8 +319,8 @@ POST_FAMILY_TWEAKS_BSP
# create board DEB file
fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "${destination}" "${destination}.deb" >> "${DEST}"/${LOG_SUBPATH}/output.log 2>&1
mkdir -p "${DEB_STORAGE}/${RELEASE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/"
mkdir -p "${DEB_STORAGE}/"
rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/"
# cleanup
rm -rf ${bsptempdir}

View File

@ -12,14 +12,16 @@
THIS_SCRIPT="header"
MOTD_DISABLE=""
. /etc/armbian-release
[[ -f /etc/armbian-release ]] && . /etc/armbian-release
[[ -f /etc/armbian-distribution-status ]] && . /etc/armbian-distribution-status
[[ -f /etc/lsb-release && -f /etc/armbian-distribution-status ]] && DISTRIBUTION_CODENAME=$(cat /etc/lsb-release | grep CODENAME | cut -d"=" -f2) && DISTRIBUTION_STATUS=$(cat /etc/armbian-distribution-status | grep $DISTRIBUTION_CODENAME | cut -d"=" -f2)
[[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd
for f in $MOTD_DISABLE; do
[[ $f == $THIS_SCRIPT ]] && exit 0
done
KERNELID=$(uname -r)
# Odroid N2 exception