Skip to content

Commit

Permalink
Add support for desktop board support package (armbian#2972)
Browse files Browse the repository at this point in the history
* Add support for desktop board support package

Extracting from armbian#2776 which can be closed after.
* Desktop BSP creation is working, but need broader testing and some quick how-to
* Create empty files as examples where we can put things.
* Fixing Pinebook desktop bsp creation
* We need to have information about ARCH in the desktop bsp package. This ain't universal.
  • Loading branch information
igorpecovnik authored and root committed Feb 4, 2022
1 parent 4c74fcd commit 5e9314d
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 20 deletions.
Empty file.
Empty file.
@@ -1,7 +1,5 @@
# install custom asound state for pinebook-pro
mkdir -p "${destination}"/etc/
cp -R "${SRC}"/packages/blobs/asound.state/ "${destination}"/etc/

# install custom xorg for pinebook-pro
mkdir -p "${destination}"/etc/X11/
cp -R "${SRC}"/packages/bsp/rk3399/xorg.conf "${destination}"/etc/X11/
File renamed without changes.

This file was deleted.

@@ -0,0 +1,5 @@
# powerconfig, touchpad, and special keys
mkdir -p $destination/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
cp $SRC/packages/bsp/pinebook-pro/xfce4-power-manager.xml $destination/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
cp $SRC/packages/bsp/pinebook-pro/pointers.xml $destination/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
cp $SRC/packages/bsp/pinebook-pro/xfce4-keyboard-shortcuts.xml $destination/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
10 changes: 9 additions & 1 deletion lib/configuration.sh
Expand Up @@ -373,7 +373,7 @@ fi

AGGREGATION_SEARCH_ROOT_ABSOLUTE_DIRS="
${SRC}/config
${SRC}/config/optional/_any_board/_configs
${SRC}/config/optional/_any_board/_config
${SRC}/config/optional/architectures/${ARCH}/_config
${SRC}/config/optional/families/${LINUXFAMILY}/_config
${SRC}/config/optional/boards/${BOARD}/_config
Expand All @@ -390,6 +390,14 @@ cli/_all_distributions/main
cli/${RELEASE}/main
"

PACKAGES_SEARCH_ROOT_ABSOLUTE_DIRS="
${SRC}/packages
${SRC}/config/optional/_any_board/_packages
${SRC}/config/optional/architectures/${ARCH}/_packages
${SRC}/config/optional/families/${LINUXFAMILY}/_packages
${SRC}/config/optional/boards/${BOARD}/_packages
"

DESKTOP_ENVIRONMENTS_SEARCH_RELATIVE_DIRS="
desktop/_all_distributions/environments/_all_environments
desktop/_all_distributions/environments/${DESKTOP_ENVIRONMENT}
Expand Down
95 changes: 84 additions & 11 deletions lib/desktop.sh
Expand Up @@ -23,8 +23,6 @@
create_desktop_package ()
{

# join and cleanup package list
# Remove leading and trailing whitespaces
echo "Showing PACKAGE_LIST_DESKTOP before postprocessing" >> "${DEST}"/debug/output.log
# Use quotes to show leading and trailing spaces
echo "\"$PACKAGE_LIST_DESKTOP\"" >> "${DEST}"/debug/output.log
Expand Down Expand Up @@ -62,15 +60,12 @@ create_desktop_package ()
Installed-Size: 1
Section: xorg
Priority: optional
Recommends: ${DEBIAN_RECOMMENDS//[:space:]+/,}
Recommends: ${DEBIAN_RECOMMENDS//[:space:]+/,}, armbian-bsp-desktop
Provides: ${CHOSEN_DESKTOP}, armbian-${RELEASE}-desktop
Pre-Depends: ${PACKAGE_LIST_PREDEPENDS//[:space:]+/,}
Description: Armbian desktop for ${DISTRIBUTION} ${RELEASE}
EOF

#display_alert "Showing ${destination}/DEBIAN/control"
cat "${destination}"/DEBIAN/control >> "${DEST}"/debug/install.log

# Recreating the DEBIAN/postinst file
echo "#!/bin/sh -e" > "${destination}/DEBIAN/postinst"

Expand All @@ -89,16 +84,12 @@ create_desktop_package ()

unset aggregated_content

# Myy : I'm preparing the common armbian folders, in advance, since the scripts are now splitted
mkdir -p "${destination}"/etc/armbian

local aggregated_content=""

aggregate_all_desktop "armbian/create_desktop_package.sh" $'\n'

# display_alert "Showing the user scripts executed in create_desktop_package"
echo "${aggregated_content}" >> "${DEST}"/debug/install.log
eval "${aggregated_content}"
[[ $? -ne 0 ]] && display_alert "create_desktop_package.sh exec error" "" "wrn"

# create board DEB file
display_alert "Building desktop package" "${CHOSEN_DESKTOP}_${REVISION}_all" "info"
Expand All @@ -117,6 +108,88 @@ create_desktop_package ()



copy_all_packages_files_for()
{
local package_name="${1}"
for package_src_dir in ${PACKAGES_SEARCH_ROOT_ABSOLUTE_DIRS};
do
local package_dirpath="${package_src_dir}/${package_name}"
if [ -d "${package_dirpath}" ];
then
cp -r "${package_dirpath}/"* "${destination}/" 2> /dev/null
display_alert ">>> adding files from" "${package_dirpath}"
fi
done
}




create_bsp_desktop_package ()
{

local package_name="${BSP_DESKTOP_PACKAGE_FULLNAME}"

local destination tmp_dir
tmp_dir=$(mktemp -d)
destination=${tmp_dir}/${BOARD}/${BSP_DESKTOP_PACKAGE_FULLNAME}
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN

copy_all_packages_files_for "bsp-desktop"

# set up control file
cat <<-EOF > "${destination}"/DEBIAN/control
Package: armbian-bsp-desktop-${BOARD}
Version: $REVISION
Architecture: $ARCH
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Section: xorg
Priority: optional
Provides: armbian-bsp-desktop, armbian-bsp-desktop-${BOARD}
Description: Armbian Board Specific Packages for desktop users using $ARCH ${BOARD} machines
EOF

# Recreating the DEBIAN/postinst file
echo "#!/bin/sh -e" > "${destination}/DEBIAN/postinst"

local aggregated_content=""
aggregate_all_desktop "debian/armbian-bsp-desktop/postinst" $'\n'

echo "${aggregated_content}" >> "${destination}/DEBIAN/postinst"
echo "exit 0" >> "${destination}/DEBIAN/postinst"

chmod 755 "${destination}"/DEBIAN/postinst

# Armbian create_desktop_package scripts

unset aggregated_content

mkdir -p "${destination}"/etc/armbian

local aggregated_content=""
aggregate_all_desktop "debian/armbian-bsp-desktop/prepare.sh" $'\n'
eval "${aggregated_content}"
[[ $? -ne 0 ]] && display_alert "prepare.sh exec error" "" "wrn"

# create board DEB file
display_alert "Building desktop package" "${package_name}" "info"

mkdir -p "${DEB_STORAGE}/${RELEASE}"
cd "${destination}"; cd ..
fakeroot dpkg-deb -b "${destination}" "${DEB_STORAGE}/${RELEASE}/${package_name}.deb" >/dev/null

# cleanup
rm -rf "${tmp_dir}"

unset aggregated_content

}




install_ppa_prerequisites() {

# Myy : So... The whole idea is that, a good bunch of external sources
Expand Down
3 changes: 2 additions & 1 deletion lib/distributions.sh
Expand Up @@ -305,7 +305,8 @@ install_common()
# install armbian-desktop
if [[ "${REPOSITORY_INSTALL}" != *armbian-desktop* ]]; then
if [[ $BUILD_DESKTOP == yes ]]; then
install_deb_chroot "${DEB_STORAGE}/$RELEASE/${CHOSEN_DESKTOP}_${REVISION}_all.deb"
install_deb_chroot "${DEB_STORAGE}/${RELEASE}/${CHOSEN_DESKTOP}_${REVISION}_all.deb"
install_deb_chroot "${DEB_STORAGE}/${RELEASE}/${BSP_DESKTOP_PACKAGE_FULLNAME}.deb"
# install display manager and PACKAGE_LIST_DESKTOP_FULL packages if enabled per board
desktop_postinstall
fi
Expand Down
4 changes: 3 additions & 1 deletion lib/main.sh
Expand Up @@ -410,6 +410,8 @@ LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")"

BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}"
BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}"
BSP_DESKTOP_PACKAGE_NAME="armbian-bsp-desktop-${BOARD}"
BSP_DESKTOP_PACKAGE_FULLNAME="${BSP_DESKTOP_PACKAGE_NAME}_${REVISION}_${ARCH}"

CHOSEN_UBOOT=linux-u-boot-${BOARD}-${BRANCH}
CHOSEN_KERNEL=linux-image-${BRANCH}-${LINUXFAMILY}
Expand Down Expand Up @@ -516,7 +518,7 @@ overlayfs_wrapper "cleanup"

# create desktop package
[[ -n $RELEASE && $DESKTOP_ENVIRONMENT && ! -f ${DEB_STORAGE}/$RELEASE/${CHOSEN_DESKTOP}_${REVISION}_all.deb ]] && create_desktop_package

[[ -n $RELEASE && $DESKTOP_ENVIRONMENT && ! -f ${DEB_STORAGE}/${RELEASE}/${BSP_DESKTOP_PACKAGE_FULLNAME}.deb ]] && create_bsp_desktop_package



Expand Down
7 changes: 7 additions & 0 deletions packages/README.md
@@ -0,0 +1,7 @@
|folder|function|
|:--|:--|
|armbian|kernel deb packaging scripts|
|blobs||
|bsp||
|bsp-desktop | common desktop board support packages overlay|
|extras-buildpkgs||

0 comments on commit 5e9314d

Please sign in to comment.