Skip to content

Commit

Permalink
Refactor armbian-bsp-cli package creation (armbian#3378)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
igorpecovnik committed Jan 6, 2022
1 parent 9d8a424 commit 310495d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/distributions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion lib/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
35 changes: 18 additions & 17 deletions lib/makeboarddeb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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}
Expand Down
6 changes: 4 additions & 2 deletions packages/bsp/common/etc/update-motd.d/10-armbian-header
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 310495d

Please sign in to comment.