feat: remove nghttp3 and only bundle nodejs

This commit is contained in:
Eli Bosley
2024-12-04 15:01:37 -05:00
parent 9a0d63d4ee
commit bb555f8296
4 changed files with 18 additions and 87 deletions

View File

@@ -166,53 +166,15 @@ jobs:
with:
name: unraid-web
path: ./plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
- name: Download Node.js From Slackbuilds (skipped due to node.js issues)
if: false
id: download-nodejs
run: |
# Get latest node version (based on main_node_version) from slackware
main_node_version=$(sed 's/^v//' ../api/.nvmrc)
base_node_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/"
latest_nodejs=$(wget -q -O- "${base_node_url}" | grep -o "nodejs-${main_node_version}\.[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
if [[ -z "${latest_nodejs}" ]]; then
echo "Error: Failed to fetch the latest nodejs version."
exit 1
fi
node_download_url="${base_node_url}${latest_nodejs}"
if ! wget -q "${node_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nodejs}"; then
echo "Error: Failed to download nodejs package."
exit 1
fi
node_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nodejs}" | cut -f 1 -d ' ')
echo "NODEJS_FILENAME=${latest_nodejs}" >> $GITHUB_OUTPUT
echo "NODEJS_SHA256=${node_sha256}" >> $GITHUB_OUTPUT
- name: Download nghttp3
id: download-nghttp3
run: |
# Get latest nghttp3 version
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
latest_nghttp3=$(wget -q -O- "${base_nghttp3_url}" | grep -o "nghttp3-[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
nghttp3_download_url="${base_nghttp3_url}${latest_nghttp3}"
if ! wget -q "${nghttp3_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nghttp3}"; then
echo "Error: Failed to download nghttp3 package."
exit 1
fi
nghttp3_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nghttp3}" | cut -f 1 -d ' ')
echo "NGHTTP3_FILENAME=${latest_nghttp3}" >> $GITHUB_OUTPUT
echo "NGHTTP3_SHA256=${nghttp3_sha256}" >> $GITHUB_OUTPUT
- name: Build Plugin
run: |
cd source/dynamix.unraid.net
export API_VERSION=${{needs.build-test-api.outputs.API_VERSION}}
export API_MD5=${{needs.build-test-api.outputs.API_MD5}}
export API_SHA256=${{needs.build-test-api.outputs.API_SHA256}}
export NGHTTP3_FILENAME=${{ steps.download-nghttp3.outputs.NGHTTP3_FILENAME }}
export NGHTTP3_SHA256=${{ steps.download-nghttp3.outputs.NGHTTP3_SHA256 }}
if [ -z "${API_VERSION}" ] ||
[ -z "${API_MD5}" ] ||
[ -z "${API_SHA256}" ] ||
[ -z "${NGHTTP3_FILENAME}" ] ||
[ -z "${NGHTTP3_SHA256}" ]; then
[ -z "${API_SHA256}" ]; then
echo "Error: One or more required variables are not set."
exit 1
fi

View File

@@ -10,15 +10,9 @@
<!ENTITY SHA256 "">
<!ENTITY API_version "">
<!ENTITY API_SHA256 "">
<!ENTITY NODEJS_FILENAME "">
<!ENTITY NODEJS_SHA256 "">
<!ENTITY NODEJS_TXZ "">
<!ENTITY NODE_612_FILENAME "node-v20.18.1-linux-x64.tar.xz">
<!ENTITY NODE_612_SHA256 "c6fa75c841cbffac851678a472f2a5bd612fff8308ef39236190e1f8dbb0e567">
<!ENTITY NODE_612_TXZ "https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz">
<!ENTITY NGHTTP3_FILENAME "">
<!ENTITY NGHTTP3_TXZ "">
<!ENTITY NGHTTP3_SHA256 "">
<!ENTITY NODEJS_FILENAME "node-v20.18.1-linux-x64.tar.xz">
<!ENTITY NODEJS_SHA256 "c6fa75c841cbffac851678a472f2a5bd612fff8308ef39236190e1f8dbb0e567">
<!ENTITY NODEJS_TXZ "https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz">
<!ENTITY MAIN_TXZ "">
<!ENTITY API_TGZ "">
]>
@@ -111,17 +105,16 @@ sha256check() {
</INLINE>
</FILE>
<!-- download node - older OS releases -->
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NODE_612_FILENAME;"
max="7.0.0-beta.5">
<URL>&NODE_612_TXZ;</URL>
<SHA256>&NODE_612_SHA256;</SHA256>
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NODEJS_FILENAME;" max="7.0.0-beta.5">
<URL>&NODEJS_TXZ;</URL>
<SHA256>&NODEJS_SHA256;</SHA256>
</FILE>
<FILE Run="/bin/bash" Method="install">
<INLINE>
NODE_UNRIAD_612_TXZ="&NODE_612_FILENAME;"
NODE_FILE="&NODEJS_FILENAME;"
<![CDATA[
if [[ -f "/boot/config/plugins/dynamix.my.servers/${NODE_UNRIAD_612_TXZ}" ]]; then
tar --strip-components=1 -xf /boot/config/plugins/dynamix.my.servers/${NODE_UNRIAD_612_TXZ} -C /usr/local/;
if [[ -f "/boot/config/plugins/dynamix.my.servers/${NODE_FILE}" ]]; then
tar --strip-components=1 -xf /boot/config/plugins/dynamix.my.servers/${NODE_FILE} -C /usr/local/;
fi
exit 0;
@@ -129,13 +122,6 @@ sha256check() {
</INLINE>
</FILE>
<!-- download nghttp3 -->
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NGHTTP3_FILENAME;" Run="upgradepkg --install-new"
max="7.0.0-beta.5">
<URL>&NGHTTP3_TXZ;</URL>
<SHA256>&NGHTTP3_SHA256;</SHA256>
</FILE>
<!-- download main txz -->
<FILE Name="&source;.txz">
<URL>&MAIN_TXZ;</URL>
@@ -737,10 +723,6 @@ if [[ -z "${email}" ]] || [[ CFG_CLEANED -eq 1 ]]; then
echo "✨ Sign In to Unraid.net to use Unraid Connect ✨"
fi
# make the unraid-api work globally for easy cli access
ln -s /usr/bin/unraid-api /usr/local/sbin/unraid-api
ln -s /usr/bin/unraid-api /usr/local/bin/unraid-api
# configure flash backup to stop when the system starts shutting down
[[ ! -d /etc/rc.d/rc6.d ]] && mkdir /etc/rc.d/rc6.d
[[ ! -h /etc/rc.d/rc0.d ]] && ln -s /etc/rc.d/rc6.d /etc/rc.d/rc0.d

View File

@@ -10,16 +10,13 @@ source "${flash}/env"
api_base_directory="/usr/local/unraid-api"
unraid_binary_path="/usr/local/bin/unraid-api"
restart() {
"${unraid_binary_path}" restart
}
install() {
# Ensure installation tgz exists
[[ ! -f "${flash}/unraid-api.tgz" ]] && echo "Please reinstall the Unraid Connect plugin" && exit 1
# Stop old process
[[ -f "${unraid_binary_path}" ]] && stop
[[ -f "${unraid_binary_path}" ]] && ${unraid_binary_path} stop
# Install unraid-api
rm -rf "${api_base_directory}"
@@ -40,6 +37,13 @@ install() {
fi
cd "${api_base_directory}" && npm link
[[ ! -f "${unraid_binary_path}" ]] && echo "unraid-api install failed with missing executable" && exit 1
# link the executable in sbin and bin
ln -sf "${unraid_binary_path}" /usr/sbin/unraid-api
ln -sf "${unraid_binary_path}" /usr/bin/unraid-api
# bail if expected file does not exist
[[ ! -f "${api_base_directory}/package.json" ]] && echo "unraid-api install failed" && exit 1

View File

@@ -51,25 +51,17 @@ cd "${DIR}" || exit 1
PLUGIN_URL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
MAIN_TXZ="https://stable.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
API_TGZ="https://stable.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
NGHTTP3_TXZ="https://stable.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
# Check if PR is set, use a different path if so
if [[ -n "${PR}" ]]; then
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}-${version}.txz"
API_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/unraid-api-${API_VERSION}.tgz"
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}.plg"
NGHTTP3_TXZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${NGHTTP3_FILENAME}"
elif [[ "${env}" == "staging" ]]; then
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
API_TGZ="https://preview.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
NGHTTP3_TXZ="https://preview.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
fi
# Hardcoded to deal with the new -2 release breaking legacy Unraid versions
NODEJS_FILENAME="nodejs-20.18.0-x86_64-1.txz"
NODEJS_TXZ="https://stable.dl.unraid.net/unraid-api/dependencies/${NODEJS_FILENAME}"
NODEJS_SHA256="332f22a2a6722e9fad92b8d1eeaded228a6499b7335b2b54ee99c55b4fe49742"
# update plg file
sed -i -E "s#(ENTITY name\s*)\".*\"#\1\"${plugin}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY env\s*)\".*\"#\1\"${env}\"#g" "${plgfile}"
@@ -79,15 +71,6 @@ sed -i -E "s#(ENTITY SHA256\s*)\".*\"#\1\"${sha256}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY MAIN_TXZ\s*)\".*\"#\1\"${MAIN_TXZ}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY API_TGZ\s*)\".*\"#\1\"${API_TGZ}\"#g" "${plgfile}"
# update node versions
sed -i -E "s#(ENTITY NODEJS_FILENAME\s*)\".*\"#\1\"${NODEJS_FILENAME}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY NODEJS_SHA256\s*)\".*\"#\1\"${NODEJS_SHA256}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY NODEJS_TXZ\s*)\".*\"#\1\"${NODEJS_TXZ}\"#g" "${plgfile}"
# update nghttp3 versions
sed -i -E "s#(ENTITY NGHTTP3_FILENAME\s*)\".*\"#\1\"${NGHTTP3_FILENAME}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY NGHTTP3_SHA256\s*)\".*\"#\1\"${NGHTTP3_SHA256}\"#g" "${plgfile}"
sed -i -E "s#(ENTITY NGHTTP3_TXZ\s*)\".*\"#\1\"${NGHTTP3_TXZ}\"#g" "${plgfile}"
# set from environment vars
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"