From be880c1af2f2e94b4ea5e60a235e575df9c69de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mati=C4=87?= <48199696+stefan-matic@users.noreply.github.com> Date: Fri, 17 Oct 2025 23:36:57 +0200 Subject: [PATCH 1/3] Update install script to support pi0w with unofficial nodejs builds --- raspberry.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/raspberry.sh b/raspberry.sh index 69d2d2d..ca11fdf 100755 --- a/raspberry.sh +++ b/raspberry.sh @@ -189,9 +189,21 @@ OS=$(cat /etc/os-release 2>/dev/null | grep VERSION_CODENAME | awk -F= '{print # exit 4 #fi if [ $ARM == "armv6l" ]; then - echo -e "nodejs version required for MagicMirror is no longer available for armv6l (pi0w) devices\ninstallation aborted" | tee -a $logfile - date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile - exit 3 + # Check if Node.js 22+ is already installed (from unofficial builds) + if command -v node >/dev/null 2>&1; then + NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) + if [ "$NODE_VERSION" -ge 22 ]; then + echo -e "Detected Node.js v$(node -v) on armv6l device - continuing with installation" | tee -a $logfile + else + echo -e "nodejs version 22+ required for MagicMirror but found v$(node -v)\nPlease upgrade Node.js before continuing\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + else + echo -e "nodejs version 22+ required for MagicMirror is no longer officially available for armv6l (pi0w) devices\nPlease install an unofficial build (e.g., from unofficial-builds.nodejs.org) before continuing\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi fi if [ "$OS." = "buster." ]; then From 2192ebcff5811f3bd1f7a6e5df6606c4a1aee25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mati=C4=87?= <48199696+stefan-matic@users.noreply.github.com> Date: Fri, 17 Oct 2025 23:52:17 +0200 Subject: [PATCH 2/3] Fix double version output --- raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raspberry.sh b/raspberry.sh index ca11fdf..c8c2054 100755 --- a/raspberry.sh +++ b/raspberry.sh @@ -193,7 +193,7 @@ if [ $ARM == "armv6l" ]; then if command -v node >/dev/null 2>&1; then NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) if [ "$NODE_VERSION" -ge 22 ]; then - echo -e "Detected Node.js v$(node -v) on armv6l device - continuing with installation" | tee -a $logfile + echo -e "Detected Node.js $(node -v) on armv6l device - continuing with installation" | tee -a $logfile else echo -e "nodejs version 22+ required for MagicMirror but found v$(node -v)\nPlease upgrade Node.js before continuing\ninstallation aborted" | tee -a $logfile date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile From 0b19c5cd189aada2683743504b3dcbaa5a2fd0be Mon Sep 17 00:00:00 2001 From: Stefan Matic Date: Sun, 19 Oct 2025 13:13:35 +0200 Subject: [PATCH 3/3] Add latest node armv6l installation for pi0w --- raspberry.sh | 120 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 5 deletions(-) diff --git a/raspberry.sh b/raspberry.sh index c8c2054..baac1f4 100755 --- a/raspberry.sh +++ b/raspberry.sh @@ -73,6 +73,35 @@ EOF echo "" } +getLatestUnofficialNodeVersion() { + # Fetch the latest Node.js version >= 22 from unofficial builds that has armv6l support + local versions + local latest_version + + # Get all available versions >= 22 in descending order + versions=$(curl -sL https://unofficial-builds.nodejs.org/download/release/ | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | grep -E '^v2[2-9]' | sort -V -r) + + if [[ -z "$versions" ]]; then + echo "Error: Could not fetch Node.js versions >= 22 from unofficial builds" >&2 + return 1 + fi + + # Find the latest version that has armv6l builds + while IFS= read -r version; do + if [ -n "$version" ] && curl -sL "https://unofficial-builds.nodejs.org/download/release/$version/" | grep -q "armv6l"; then + latest_version=$version + break + fi + done <<< "$versions" + + if [[ -z "$latest_version" ]]; then + echo "Error: No Node.js version >= 22 with armv6l support found in unofficial builds" >&2 + return 1 + fi + + echo "$latest_version" +} + getRequiredNodeVersion() { engine=$(echo "$package_json" | grep \"engines\" -A 2 | grep $1 | awk -F: '{print $2}' | tr -d \") @@ -195,14 +224,95 @@ if [ $ARM == "armv6l" ]; then if [ "$NODE_VERSION" -ge 22 ]; then echo -e "Detected Node.js $(node -v) on armv6l device - continuing with installation" | tee -a $logfile else - echo -e "nodejs version 22+ required for MagicMirror but found v$(node -v)\nPlease upgrade Node.js before continuing\ninstallation aborted" | tee -a $logfile + echo -e "nodejs version 22+ required for MagicMirror but found v$(node -v)" | tee -a $logfile + echo -e "Attempting to upgrade to latest Node.js from unofficial builds..." | tee -a $logfile + + # Get the latest version + LATEST_NODE_VERSION=$(getLatestUnofficialNodeVersion) + if [ $? -ne 0 ]; then + echo -e "Failed to fetch latest Node.js version\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + echo -e "Installing Node.js $LATEST_NODE_VERSION for armv6l..." | tee -a $logfile + + # Download and install the latest version + cd /tmp + curl -sL "https://unofficial-builds.nodejs.org/download/release/${LATEST_NODE_VERSION}/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" -o "node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + if [ $? -ne 0 ]; then + echo -e "Failed to download Node.js $LATEST_NODE_VERSION\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + cd /usr/local + sudo tar --strip-components 1 -xzf "/tmp/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + if [ $? -ne 0 ]; then + echo -e "Failed to extract Node.js $LATEST_NODE_VERSION\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + # Clean up + rm "/tmp/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + cd $HOME + + # Verify installation + hash -r + NEW_NODE_VERSION=$(node -v 2>/dev/null) + if [ $? -eq 0 ]; then + echo -e "Successfully installed Node.js $NEW_NODE_VERSION on armv6l device" | tee -a $logfile + else + echo -e "Node.js installation verification failed\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + fi + else + echo -e "Node.js not found - installing latest version from unofficial builds..." | tee -a $logfile + + # Get the latest version + LATEST_NODE_VERSION=$(getLatestUnofficialNodeVersion) + if [ $? -ne 0 ]; then + echo -e "Failed to fetch latest Node.js version\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + echo -e "Installing Node.js $LATEST_NODE_VERSION for armv6l..." | tee -a $logfile + + # Download and install the latest version + cd /tmp + curl -sL "https://unofficial-builds.nodejs.org/download/release/${LATEST_NODE_VERSION}/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" -o "node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + if [ $? -ne 0 ]; then + echo -e "Failed to download Node.js $LATEST_NODE_VERSION\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + cd /usr/local + sudo tar --strip-components 1 -xzf "/tmp/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + if [ $? -ne 0 ]; then + echo -e "Failed to extract Node.js $LATEST_NODE_VERSION\ninstallation aborted" | tee -a $logfile + date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile + exit 3 + fi + + # Clean up + rm "/tmp/node-${LATEST_NODE_VERSION}-linux-armv6l.tar.gz" + cd $HOME + + # Verify installation + hash -r + NEW_NODE_VERSION=$(node -v 2>/dev/null) + if [ $? -eq 0 ]; then + echo -e "Successfully installed Node.js $NEW_NODE_VERSION on armv6l device" | tee -a $logfile + else + echo -e "Node.js installation verification failed\ninstallation aborted" | tee -a $logfile date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile exit 3 fi - else - echo -e "nodejs version 22+ required for MagicMirror is no longer officially available for armv6l (pi0w) devices\nPlease install an unofficial build (e.g., from unofficial-builds.nodejs.org) before continuing\ninstallation aborted" | tee -a $logfile - date +"install ended - %a %b %e %H:%M:%S %Z %Y" >>$logfile - exit 3 fi fi