Skip to content

Commit

Permalink
fix: fix armbian-release file error (mainsail-crew#241)
Browse files Browse the repository at this point in the history
To get mainsail release shown in moonraker we need that 'hacky' solution

---------

Signed-off-by: Stephan Wendel <me@stephanwe.de>
  • Loading branch information
KwadFan authored and miklschmidt committed Feb 25, 2024
1 parent 8d211f8 commit 30e6afb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 30 deletions.
34 changes: 6 additions & 28 deletions src/modules/armbian/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
17 changes: 15 additions & 2 deletions src/modules/mainsailos/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 30e6afb

Please sign in to comment.