Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Miouyouyou/3066cb3350ea3e886280842260c42686 to your computer and use it in GitHub Desktop.
Save Miouyouyou/3066cb3350ea3e886280842260c42686 to your computer and use it in GitHub Desktop.
Patching latest armbian desktop build
From 2ce078b6ad63eca06325f9d07d529e8d620f6cb7 Mon Sep 17 00:00:00 2001
From: "Miouyouyou (Myy)" <[email protected]>
Date: Sun, 13 Dec 2020 04:21:16 +0100
Subject: [PATCH] Fixing a few issues with putting the Desktop build inside IF
The issue was that some variables were done defined
correctly if the first IF block was skipped, due to
defining settings directly through variables.
Also made sure to only cover some parts when desktop
build is enabled.
Some factorization is required, though.
Signed-off-by: Miouyouyou (Myy) <[email protected]>
---
lib/configuration.sh | 34 ++++++++++++++++++++------------
lib/debootstrap.sh | 46 +++++++++++++++++++++++++-------------------
2 files changed, 48 insertions(+), 32 deletions(-)
diff --git a/lib/configuration.sh b/lib/configuration.sh
index e41b5f1..6fff078 100644
--- a/lib/configuration.sh
+++ b/lib/configuration.sh
@@ -114,7 +114,7 @@ show_menu() {
provided_title=$1
provided_backtitle=$2
provided_menuname=$3
- # Myy : I don't know why there's a TTY_Y - 8...
+ # Myy : I don't know why there's a TTY_Y - 8...
#echo "Provided title : $provided_title"
#echo "Provided backtitle : $provided_backtitle"
#echo "Provided menuname : $provided_menuname"
@@ -204,7 +204,9 @@ if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT ]]; then
exit_with_error "No desktop environment selected..."
fi
+fi
+if [[ $BUILD_DESKTOP == "yes" ]]; then
# Expected environment variables :
# - options
# - ARCH
@@ -234,7 +236,6 @@ if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT ]]; then
DESKTOP_ENVIRONMENT_DIRPATH="${DESKTOP_CONFIGS_DIR}/${DESKTOP_ENVIRONMENT}"
desktop_environment_check_if_valid
-
fi
if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
@@ -260,8 +261,10 @@ if [[ $BUILD_DESKTOP == "yes" && -z $DESKTOP_ENVIRONMENT_CONFIG_NAME ]]; then
fi
fi
-DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
-DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
+if [[ $BUILD_DESKTOP == "yes" ]]; then
+ DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH="${DESKTOP_ENVIRONMENT_DIRPATH}/${DESKTOP_ENVIRONMENT_CONFIG_NAME}"
+ DESKTOP_ENVIRONMENT_PACKAGE_LIST_FILEPATH="${DESKTOP_ENVIRONMENT_PACKAGE_LIST_DIRPATH}/packages"
+fi
# "-z ${VAR+x}" allows to check for unset variable
# Technically, someone might want to build a desktop with no additional
@@ -434,7 +437,7 @@ aggregate_all_cli() {
potential_paths+=" ${CLI_CONFIG_PATH}/main/config_${SELECTED_CONFIGURATION}/${looked_up_subpath}"
potential_paths+=" ${CLI_CONFIG_PATH}/main/custom/boards/${BOARD}/config_${SELECTED_CONFIGURATION}/${looked_up_subpath}"
fi
-
+
aggregate_content
}
@@ -481,14 +484,16 @@ unset aggregated_content
# Myy : Sources packages from file here
# Myy : FIXME Rename aggregate_all to aggregate_all_desktop
-aggregated_content=""
-aggregate_all "packages" " "
+if [[ $BUILD_DESKTOP == "yes" ]]; then
+ aggregated_content=""
+ aggregate_all "packages" " "
-PACKAGE_LIST_DESKTOP+="${aggregated_content}"
+ PACKAGE_LIST_DESKTOP+="${aggregated_content}"
-unset aggregated_content
+ unset aggregated_content
-echo "Groups selected ${DESKTOP_APPGROUPS_SELECTED} -> PACKAGES : ${PACKAGE_LIST_DESKTOP}"
+ echo "Groups selected ${DESKTOP_APPGROUPS_SELECTED} -> PACKAGES : ${PACKAGE_LIST_DESKTOP}"
+fi
# Myy : Clean the Debootstrap lists. The packages list will be cleaned when necessary.
# This horrendous cleanup syntax is used to remove trailing and leading spaces.
@@ -594,14 +599,19 @@ if [[ -n $PACKAGE_LIST_RM ]]; then
# the previous one after consuming the spaces.
PACKAGE_LIST=$(sed -r "s/\W($(tr ' ' '|' <<< ${PACKAGE_LIST_RM}))\W/ /g" <<< " ${PACKAGE_LIST} ")
PACKAGE_MAIN_LIST=$(sed -r "s/\W($(tr ' ' '|' <<< ${PACKAGE_LIST_RM}))\W/ /g" <<< " ${PACKAGE_MAIN_LIST} ")
- PACKAGE_LIST_DESKTOP=$(sed -r "s/\W($(tr ' ' '|' <<< ${PACKAGE_LIST_RM}))\W/ /g" <<< " ${PACKAGE_LIST_DESKTOP} ")
+ if [[ $BUILD_DESKTOP == "yes" ]]; then
+ PACKAGE_LIST_DESKTOP=$(sed -r "s/\W($(tr ' ' '|' <<< ${PACKAGE_LIST_RM}))\W/ /g" <<< " ${PACKAGE_LIST_DESKTOP} ")
+ fi
fi
# Removing double spaces
# Do not quote the variables. This would defeat the trick.
PACKAGE_LIST="$(echo ${PACKAGE_LIST})"
PACKAGE_MAIN_LIST="$(echo ${PACKAGE_MAIN_LIST})"
-PACKAGE_LIST_DESKTOP="$(echo ${PACKAGE_LIST_DESKTOP})"
+
+if [[ $BUILD_DESKTOP == "yes" ]]; then
+ PACKAGE_LIST_DESKTOP="$(echo ${PACKAGE_LIST_DESKTOP})"
+fi
display_alert "After removal of packages.remove packages"
display_alert "PACKAGE_MAIN_LIST : \"${PACKAGE_MAIN_LIST}\""
diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh
index b708b24..b92d59a 100644
--- a/lib/debootstrap.sh
+++ b/lib/debootstrap.sh
@@ -249,28 +249,34 @@ create_rootfs_cache()
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian main packages failed"
- display_alert "Adding apt sources for Desktop packages"
- add_desktop_package_sources
-
- local apt_desktop_install_flags=""
- if [[ ! -z ${DESKTOP_APT_FLAGS_SELECTED+x} ]]; then
- for flag in ${DESKTOP_APT_FLAGS_SELECTED}; do
- apt_desktop_install_flags+=" --install-${flag}"
- done
- else
- # Myy : Using the previous default option, if the variable isn't defined
- # And ONLY if it's not defined !
- apt_desktop_install_flags+=" --no-install-recommends"
- fi
+ if [[ $BUILD_DESKTOP == "yes" ]]; then
+ # FIXME Myy : Are we keeping this only for Desktop users,
+ # or should we extend this to CLI users too ?
+ # There might be some clunky boards that require Debian packages from
+ # specific repos...
+ display_alert "Adding apt sources for Desktop packages"
+ add_desktop_package_sources
+
+ local apt_desktop_install_flags=""
+ if [[ ! -z ${DESKTOP_APT_FLAGS_SELECTED+x} ]]; then
+ for flag in ${DESKTOP_APT_FLAGS_SELECTED}; do
+ apt_desktop_install_flags+=" --install-${flag}"
+ done
+ else
+ # Myy : Using the previous default option, if the variable isn't defined
+ # And ONLY if it's not defined !
+ apt_desktop_install_flags+=" --no-install-recommends"
+ fi
- display_alert "Installing the desktop packages for" "Armbian" "info"
- eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \
- $apt_extra $apt_extra_progress install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP"' \
- ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
- ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian desktop packages..." $TTY_Y $TTY_X'} \
- ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
+ display_alert "Installing the desktop packages for" "Armbian" "info"
+ eval 'LC_ALL=C LANG=C chroot $SDCARD /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \
+ $apt_extra $apt_extra_progress install ${apt_desktop_install_flags} $PACKAGE_LIST_DESKTOP"' \
+ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
+ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian desktop packages..." $TTY_Y $TTY_X'} \
+ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
- [[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian desktop packages failed"
+ [[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian desktop packages failed"
+ fi
# Remove packages from packages.uninstall
--
2.29.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment