feat: install node

This commit is contained in:
Eli Bosley
2024-10-22 14:35:25 -04:00
parent 4d33908e01
commit 7352bbe77a
2 changed files with 12 additions and 6 deletions

View File

@@ -14,7 +14,6 @@
<!ENTITY API_MD5 "">
<!ENTITY API_SHA256 "">
<!ENTITY downloadserver "">
<!ENTITY js_dl_server "">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" launch="&launch;" min="6.9.0-rc1" icon="globe">
@@ -50,7 +49,7 @@ exit 0
<FILE Run="/bin/bash" Method="install">
<INLINE>
DLHOST=$(echo "&downloadserver;" | awk -F/ '{print $3}')
JSHOST=$(echo "&js_dl_server;" | awk -F/ '{print $3}')
NODEHOST=$(echo "&node_dl_server;" | awk -F/ '{print $3}')
<![CDATA[
version=
# shellcheck disable=SC1091
@@ -62,6 +61,13 @@ if [ ! -x /bin/gzip ] || ! /bin/gzip -V &>/dev/null; then
exit 1
fi
# Check if node is installed in Unraid and install it if not
if [ ! -f /boot/extra/nodejs-20.18.0-x86_64-1.txz ]; then
echo "Downloading nodejs-20.18.0-x86_64-1.txz package"
mkdir -p /boot/extra wget https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/nodejs-20.18.0-x86_64-1.txz -O /boot/extra/nodejs-20.18.0-x86_64-1.txz
upgradepkg --install-new /boot/extra/nodejs-20.18.0-x86_64-1.txz
fi
dnscheck() {
HOST=$1
if [ -x /usr/bin/host ] && ! /usr/bin/host -W 10 "${HOST}" &>/dev/null; then
@@ -76,7 +82,7 @@ DNSERR=no
echo "Checking DNS..."
#dnscheck "${DLHOST}"
#dnscheck "${JSHOST}"
#dnscheck "${NODEHOST}"
dnscheck "mothership.unraid.net"
#dnscheck "wanip4.unraid.net"
#dnscheck "backup.unraid.net"

View File

@@ -47,11 +47,11 @@ cd "${DIR}" || exit 1
# define vars for plg
pluginURL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
downloadserver="https://stable.dl.unraid.net"
js_dl_server="https://registration.unraid.net"
node_dl_server="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/nodejs-20.18.0-x86_64-1.txz"
if [[ "${env}" == "staging" ]]; then
pluginURL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
downloadserver="https://preview.dl.unraid.net"
js_dl_server="https://registration-dev.unraid.net"
node_dl_server="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/nodejs-20.18.0-x86_64-1.txz"
fi
# update plg file
@@ -62,7 +62,7 @@ sed -i -E "s#(ENTITY pluginURL\s*)\".*\"#\1\"${pluginURL}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY MD5\s*)\".*\"#\1\"${md5}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY SHA256\s*)\".*\"#\1\"${sha256}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY downloadserver\s*)\".*\"#\1\"${downloadserver}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY js_dl_server\s*)\".*\"#\1\"${js_dl_server}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY node_dl_server\s*)\".*\"#\1\"${node_dl_server}\"#g" "${plgfile}"
# set from environment vars
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"