-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces support for arm64, changes have been tested on the new arm64 Raspberry Pi OS. Those images are generated by the pi-gen arm64 branch: https://github.com/RPi-Distro/pi-gen/tree/arm64. For ffmpeg I've selected the 'debian' binary, which seems to work.
- Loading branch information
Showing
4 changed files
with
133 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash -e | ||
|
||
|
||
# | ||
# Prevent Node.js being installed or updated later using apt | ||
# | ||
install -m 644 files/apt-preferences "${ROOTFS_DIR}/etc/apt/preferences" | ||
|
||
# | ||
# Install Node.js | ||
# Select the correct version of Node based on dpkg-architecture | ||
# | ||
|
||
export LTS="$(curl -s https://nodejs.org/dist/index.json | jq -r 'map(select(.lts))[0].version')" | ||
|
||
on_chroot << EOF | ||
uname -a | ||
echo "Installing Node.js $LTS..." | ||
set -e | ||
set -x | ||
case "$(dpkg-architecture -q DEB_TARGET_ARCH)" in | ||
arm64) | ||
curl -Lsf "https://nodejs.org/dist/$LTS/node-$LTS-linux-arm64.tar.xz" | \ | ||
tar xJf - -C /usr/local --strip-components=1 --no-same-owner | ||
;; | ||
armhf) | ||
curl -Lsf "https://unofficial-builds.nodejs.org/download/release/$LTS/node-$LTS-linux-armv6l.tar.gz" | \ | ||
tar xzf - -C /usr/local --strip-components=1 --no-same-owner | ||
;; | ||
esac | ||
node -v | ||
npm -v | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
INDEX=$(curl -s https://nodejs.org/dist/index.json) | ||
LTS=$(echo $INDEX | jq -r 'map(select(.lts))[0].version') | ||
CURRENT=$(node -v) | ||
|
||
echo "Installed: $CURRENT" | ||
echo "Current Node.js LTS: $LTS" | ||
|
||
if [ $LTS != $CURRENT ]; then | ||
echo "Updating Node.js to $LTS..." | ||
|
||
PREFIX=$(npm -g prefix || echo "/usr/local") | ||
case "$(dpkg-architecture -q DEB_TARGET_ARCH)" in | ||
arm64) | ||
curl -Lsf "https://nodejs.org/dist/$LTS/node-$LTS-linux-arm64.tar.xz" | \ | ||
sudo tar xJf - -C ${PREFIX} --strip-components=1 --no-same-owner | ||
;; | ||
armhf) | ||
curl -Lsf "https://unofficial-builds.nodejs.org/download/release/$LTS/node-$LTS-linux-armv6l.tar.gz" | \ | ||
sudo tar xzf - -C ${PREFIX} --strip-components=1 --no-same-owner | ||
;; | ||
esac | ||
|
||
echo "Node.js $(node -v)" | ||
echo "npm $(npm -v)" | ||
|
||
echo "Node.js updated to $LTS" | ||
|
||
echo "Rebuilding modules..." | ||
cd "$PREFIX/lib/node_modules" | ||
sudo npm --unsafe-perm rebuild | ||
|
||
echo "Update Complete" | ||
else | ||
echo "Node.js is already up-to-date" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters