mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: remove nghttp3 and only bundle nodejs
This commit is contained in:
40
.github/workflows/main.yml
vendored
40
.github/workflows/main.yml
vendored
@@ -166,53 +166,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: unraid-web
|
name: unraid-web
|
||||||
path: ./plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
|
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
|
- name: Build Plugin
|
||||||
run: |
|
run: |
|
||||||
cd source/dynamix.unraid.net
|
cd source/dynamix.unraid.net
|
||||||
export API_VERSION=${{needs.build-test-api.outputs.API_VERSION}}
|
export API_VERSION=${{needs.build-test-api.outputs.API_VERSION}}
|
||||||
export API_MD5=${{needs.build-test-api.outputs.API_MD5}}
|
export API_MD5=${{needs.build-test-api.outputs.API_MD5}}
|
||||||
export API_SHA256=${{needs.build-test-api.outputs.API_SHA256}}
|
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}" ] ||
|
if [ -z "${API_VERSION}" ] ||
|
||||||
[ -z "${API_MD5}" ] ||
|
[ -z "${API_MD5}" ] ||
|
||||||
[ -z "${API_SHA256}" ] ||
|
[ -z "${API_SHA256}" ]; then
|
||||||
[ -z "${NGHTTP3_FILENAME}" ] ||
|
|
||||||
[ -z "${NGHTTP3_SHA256}" ]; then
|
|
||||||
echo "Error: One or more required variables are not set."
|
echo "Error: One or more required variables are not set."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -10,15 +10,9 @@
|
|||||||
<!ENTITY SHA256 "">
|
<!ENTITY SHA256 "">
|
||||||
<!ENTITY API_version "">
|
<!ENTITY API_version "">
|
||||||
<!ENTITY API_SHA256 "">
|
<!ENTITY API_SHA256 "">
|
||||||
<!ENTITY NODEJS_FILENAME "">
|
<!ENTITY NODEJS_FILENAME "node-v20.18.1-linux-x64.tar.xz">
|
||||||
<!ENTITY NODEJS_SHA256 "">
|
<!ENTITY NODEJS_SHA256 "c6fa75c841cbffac851678a472f2a5bd612fff8308ef39236190e1f8dbb0e567">
|
||||||
<!ENTITY NODEJS_TXZ "">
|
<!ENTITY NODEJS_TXZ "https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz">
|
||||||
<!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 MAIN_TXZ "">
|
<!ENTITY MAIN_TXZ "">
|
||||||
<!ENTITY API_TGZ "">
|
<!ENTITY API_TGZ "">
|
||||||
]>
|
]>
|
||||||
@@ -111,17 +105,16 @@ sha256check() {
|
|||||||
</INLINE>
|
</INLINE>
|
||||||
</FILE>
|
</FILE>
|
||||||
<!-- download node - older OS releases -->
|
<!-- download node - older OS releases -->
|
||||||
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NODE_612_FILENAME;"
|
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NODEJS_FILENAME;" max="7.0.0-beta.5">
|
||||||
max="7.0.0-beta.5">
|
<URL>&NODEJS_TXZ;</URL>
|
||||||
<URL>&NODE_612_TXZ;</URL>
|
<SHA256>&NODEJS_SHA256;</SHA256>
|
||||||
<SHA256>&NODE_612_SHA256;</SHA256>
|
|
||||||
</FILE>
|
</FILE>
|
||||||
<FILE Run="/bin/bash" Method="install">
|
<FILE Run="/bin/bash" Method="install">
|
||||||
<INLINE>
|
<INLINE>
|
||||||
NODE_UNRIAD_612_TXZ="&NODE_612_FILENAME;"
|
NODE_FILE="&NODEJS_FILENAME;"
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if [[ -f "/boot/config/plugins/dynamix.my.servers/${NODE_UNRIAD_612_TXZ}" ]]; then
|
if [[ -f "/boot/config/plugins/dynamix.my.servers/${NODE_FILE}" ]]; then
|
||||||
tar --strip-components=1 -xf /boot/config/plugins/dynamix.my.servers/${NODE_UNRIAD_612_TXZ} -C /usr/local/;
|
tar --strip-components=1 -xf /boot/config/plugins/dynamix.my.servers/${NODE_FILE} -C /usr/local/;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
@@ -129,13 +122,6 @@ sha256check() {
|
|||||||
</INLINE>
|
</INLINE>
|
||||||
</FILE>
|
</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 -->
|
<!-- download main txz -->
|
||||||
<FILE Name="&source;.txz">
|
<FILE Name="&source;.txz">
|
||||||
<URL>&MAIN_TXZ;</URL>
|
<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 ✨"
|
echo "✨ Sign In to Unraid.net to use Unraid Connect ✨"
|
||||||
fi
|
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
|
# configure flash backup to stop when the system starts shutting down
|
||||||
[[ ! -d /etc/rc.d/rc6.d ]] && mkdir /etc/rc.d/rc6.d
|
[[ ! -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
|
[[ ! -h /etc/rc.d/rc0.d ]] && ln -s /etc/rc.d/rc6.d /etc/rc.d/rc0.d
|
||||||
|
|||||||
@@ -10,16 +10,13 @@ source "${flash}/env"
|
|||||||
api_base_directory="/usr/local/unraid-api"
|
api_base_directory="/usr/local/unraid-api"
|
||||||
unraid_binary_path="/usr/local/bin/unraid-api"
|
unraid_binary_path="/usr/local/bin/unraid-api"
|
||||||
|
|
||||||
restart() {
|
|
||||||
"${unraid_binary_path}" restart
|
|
||||||
}
|
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
# Ensure installation tgz exists
|
# Ensure installation tgz exists
|
||||||
[[ ! -f "${flash}/unraid-api.tgz" ]] && echo "Please reinstall the Unraid Connect plugin" && exit 1
|
[[ ! -f "${flash}/unraid-api.tgz" ]] && echo "Please reinstall the Unraid Connect plugin" && exit 1
|
||||||
|
|
||||||
# Stop old process
|
# Stop old process
|
||||||
[[ -f "${unraid_binary_path}" ]] && stop
|
[[ -f "${unraid_binary_path}" ]] && ${unraid_binary_path} stop
|
||||||
|
|
||||||
# Install unraid-api
|
# Install unraid-api
|
||||||
rm -rf "${api_base_directory}"
|
rm -rf "${api_base_directory}"
|
||||||
@@ -40,6 +37,13 @@ install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${api_base_directory}" && npm link
|
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
|
# bail if expected file does not exist
|
||||||
[[ ! -f "${api_base_directory}/package.json" ]] && echo "unraid-api install failed" && exit 1
|
[[ ! -f "${api_base_directory}/package.json" ]] && echo "unraid-api install failed" && exit 1
|
||||||
|
|
||||||
|
|||||||
@@ -51,25 +51,17 @@ cd "${DIR}" || exit 1
|
|||||||
PLUGIN_URL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
|
PLUGIN_URL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
|
||||||
MAIN_TXZ="https://stable.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
|
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"
|
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
|
# Check if PR is set, use a different path if so
|
||||||
if [[ -n "${PR}" ]]; then
|
if [[ -n "${PR}" ]]; then
|
||||||
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}-${version}.txz"
|
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"
|
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"
|
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
|
elif [[ "${env}" == "staging" ]]; then
|
||||||
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
|
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
|
||||||
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
|
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"
|
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
|
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
|
# update plg file
|
||||||
sed -i -E "s#(ENTITY name\s*)\".*\"#\1\"${plugin}\"#g" "${plgfile}"
|
sed -i -E "s#(ENTITY name\s*)\".*\"#\1\"${plugin}\"#g" "${plgfile}"
|
||||||
sed -i -E "s#(ENTITY env\s*)\".*\"#\1\"${env}\"#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 MAIN_TXZ\s*)\".*\"#\1\"${MAIN_TXZ}\"#g" "${plgfile}"
|
||||||
sed -i -E "s#(ENTITY API_TGZ\s*)\".*\"#\1\"${API_TGZ}\"#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
|
# set from environment vars
|
||||||
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"
|
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"
|
||||||
|
|||||||
Reference in New Issue
Block a user