mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
feat: remove nghttp3 and only bundle nodejs
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user