From 04dc0052b8001ca348be39dfa31dc11053aedf3a Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Mon, 25 Sep 2023 20:50:48 +0200 Subject: [PATCH 1/3] fix: fix armbian-release file error To get mainsail release shown in moonraker we need that 'hacky' solution Signed-off-by: Stephan Wendel --- src/modules/armbian/start_chroot_script | 31 +++++++++---------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index 65b90ac90..58a0d4490 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -73,26 +73,17 @@ 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 +## Step 5: 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/mainsailos-release" ]]; then + echo_green "Apply release file workaround ..." + ln -s /etc/aaaa-release /etc/mainsailos-release +fi ## END Step 5 ## Step 6: Patch dynamic motd From 29a22e41c5fac6757084d6618a92f94e4b65901e Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Fri, 29 Sep 2023 19:52:39 +0200 Subject: [PATCH 2/3] refactor: moved release file workaround Since this is not an issue related to the armbian module, but related to the release file of mainsailos (or choosen distname) it belongs to this distro instead of the general armbian module. Therefore refactoring into mainsailos module. Signed-off-by: Stephan Wendel --- src/modules/armbian/start_chroot_script | 25 ++++++---------------- src/modules/mainsailos/start_chroot_script | 17 +++++++++++++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index 58a0d4490..5ce9874b4 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -73,29 +73,16 @@ if [[ -f "/root/.not_logged_in_yet" ]]; then fi ## END Step 4 -## Step 5: 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/mainsailos-release" ]]; then - echo_green "Apply release file workaround ..." - ln -s /etc/aaaa-release /etc/mainsailos-release -fi -## 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 @@ -120,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..570aba5b7 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/aaaa-release /etc/"${DIST_NAME,,}"-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 From 09caf30e967739098ffce66736f5888f921f1b56 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Fri, 29 Sep 2023 20:08:57 +0200 Subject: [PATCH 3/3] fix: fix syntax error Signed-off-by: Stephan Wendel --- src/modules/mainsailos/start_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mainsailos/start_chroot_script b/src/modules/mainsailos/start_chroot_script index 570aba5b7..89b426a17 100644 --- a/src/modules/mainsailos/start_chroot_script +++ b/src/modules/mainsailos/start_chroot_script @@ -42,7 +42,7 @@ echo "${DIST_NAME} release ${DIST_VERSION} ($(get_parent))" > /etc/"${DIST_NAME, ### aaaa-release, which is directly read by moonraker. if [[ -f "/etc/armbian-release" ]]; then echo_green "Apply release file workaround ..." - ln -s /etc/aaaa-release /etc/"${DIST_NAME,,}"-release + ln -s /etc/"${DIST_NAME,,}"-release /etc/aaaa-release fi ## END Step 2