From 30e6afb6569cd522586367f1b81a53b18902847f Mon Sep 17 00:00:00 2001 From: Stephan Wendel <43513802+KwadFan@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:16:15 +0200 Subject: [PATCH] fix: fix armbian-release file error (#241) To get mainsail release shown in moonraker we need that 'hacky' solution --------- Signed-off-by: Stephan Wendel --- src/modules/armbian/start_chroot_script | 34 ++++------------------ src/modules/mainsailos/start_chroot_script | 17 +++++++++-- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index 65b90ac90..5ce9874b4 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -73,38 +73,16 @@ if [[ -f "/root/.not_logged_in_yet" ]]; then fi ## END Step 4 -## Step 5: Move armbian-release to display mainsailos-release -### Substep 1: Move armbian-release - if [[ -f "/etc/armbian-release" ]]; then - echo_green "Armbian release file found! moving to: 'armbian-release-info.txt'" - mv /etc/armbian-release /etc/armbian-release-info.txt - else - echo_red "Armbian release file not found! [SKIPPED]" - fi -### END Substep 1 -### Substep 2: patch Armbian scripts to new file location - echo_green "Patching armbian scripts (release file path) ..." - pushd "/usr/lib/armbian" &> /dev/null || exit 1 - files=() - while IFS='' read -r line; do - files+=("${line}") - done < <(grep -R "/etc/armbian-release" -- * | cut -d":" -f1) - for f in "${files[@]}"; do - sed -i "s|/etc/armbian-release|/etc/armbian-release-info.txt|g" "${f}" - done - popd &> /dev/null || exit 1 -## END Step 5 - -## Step 6: Patch dynamic motd +## Step 5: Patch dynamic motd echo_green "Patch dynamic motd ..." unpack /filesystem/root / chmod +x /etc/update-motd.d/* if [[ -f "/etc/default/armbian-motd" ]]; then sed -i 's/MOTD_DISABLE=""/MOTD_DISABLE="header"/' /etc/default/armbian-motd fi -## END Step 6 +## END Step 5 -## Step 7: Enable SPI interface by default +## Step 6: Enable SPI interface by default echo_green "Enable SPI interface on Orange Pi SBC's ..." ### Substep 1: Copy default config to backup file @@ -129,9 +107,9 @@ echo "spi-dev" >> "${ARMBIAN_MODULES_FILE}" ### END Substep 3 echo_green "Enable SPI interface on Orange Pi SBC's ... DONE!" -## END Step 7 +## END Step 6 -## Step 8: Remove unattended-upgrades +## Step 7: Remove unattended-upgrades echo_green "Remove 'unattended-upgrades' service ..." sudo apt-get remove --purge --yes unattended-upgrades -## END Step 8 +## END Step 7 diff --git a/src/modules/mainsailos/start_chroot_script b/src/modules/mainsailos/start_chroot_script index 1f9a192f5..89b426a17 100644 --- a/src/modules/mainsailos/start_chroot_script +++ b/src/modules/mainsailos/start_chroot_script @@ -33,8 +33,21 @@ function get_parent { echo "${DIST_NAME} release ${DIST_VERSION} ($(get_parent))" > /etc/"${DIST_NAME,,}"-release ## END Step 1 -## Step 2: Install CANBoot Dependency +## Step 2: Fake release file +### NOTE: Turns out that the 'distro' python package, +### which is used by moonraker, uses the first file after sorting. +### Therefore we need a hacky solution, because armbian relies, on upgrades +### on the original armbian-release file. +### To get around that, we simple symlink mainsailos-release to +### aaaa-release, which is directly read by moonraker. +if [[ -f "/etc/armbian-release" ]]; then + echo_green "Apply release file workaround ..." + ln -s /etc/"${DIST_NAME,,}"-release /etc/aaaa-release +fi +## END Step 2 + +## Step 3: Install CANBoot Dependency apt-get update --allow-releaseinfo-change # shellcheck disable=SC2086 check_install_pkgs ${MAINSAILOS_DEPS} -## END Step 2 +## END Step 3