diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7139a7763..8bc207f85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index 0a796493f..d968f793e 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -10,15 +10,9 @@ - - - - - - - - - + + + ]> @@ -111,17 +105,16 @@ sha256check() { - - &NODE_612_TXZ; - &NODE_612_SHA256; + + &NODEJS_TXZ; + &NODEJS_SHA256; - NODE_UNRIAD_612_TXZ="&NODE_612_FILENAME;" + NODE_FILE="&NODEJS_FILENAME;" - - - &NGHTTP3_TXZ; - &NGHTTP3_SHA256; - - &MAIN_TXZ; @@ -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 diff --git a/plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api b/plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api index 6beedd3ca..8acb74b47 100755 --- a/plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api +++ b/plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api @@ -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 diff --git a/plugin/source/dynamix.unraid.net/pkg_build.sh b/plugin/source/dynamix.unraid.net/pkg_build.sh index da0372916..b57ff6144 100755 --- a/plugin/source/dynamix.unraid.net/pkg_build.sh +++ b/plugin/source/dynamix.unraid.net/pkg_build.sh @@ -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}"