fix: variables passed properly

This commit is contained in:
Eli Bosley
2024-11-06 10:52:26 -05:00
parent a230a33df5
commit 61ba324ca0
2 changed files with 52 additions and 43 deletions

View File

@@ -164,6 +164,7 @@ jobs:
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 - name: Download Node.js From Slackbuilds
id: download-nodejs
run: | run: |
# Get latest node version (based on main_node_version) from slackware # Get latest node version (based on main_node_version) from slackware
main_node_version=$(sed 's/^v//' ../api/.nvmrc) main_node_version=$(sed 's/^v//' ../api/.nvmrc)
@@ -179,7 +180,10 @@ jobs:
exit 1 exit 1
fi fi
node_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nodejs}" | cut -f 1 -d ' ') 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 - name: Download nghttp3
id: download-nghttp3
run: | run: |
# Get latest nghttp3 version # Get latest nghttp3 version
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/" base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
@@ -190,16 +194,18 @@ jobs:
exit 1 exit 1
fi fi
nghttp3_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nghttp3}" | cut -f 1 -d ' ') 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 NODEJS_FILENAME=${latest_nodejs} export NODEJS_FILENAME=${{ steps.download-nodejs.outputs.NODEJS_FILENAME }}
export NODEJS_SHA256=${node_sha256} export NODEJS_SHA256=${{ steps.download-nodejs.outputs.NODEJS_SHA256 }}
export NGHTTP3_FILENAME=${latest_nghttp3} export NGHTTP3_FILENAME=${{ steps.download-nghttp3.outputs.NGHTTP3_FILENAME }}
export NGHTTP3_SHA256=${nghttp3_sha256} export NGHTTP3_SHA256=${{ steps.download-nghttp3.outputs.NGHTTP3_SHA256 }}
bash ./pkg_build.sh s ${{github.event.pull_request.number}} bash ./pkg_build.sh s ${{github.event.pull_request.number}}
bash ./pkg_build.sh p bash ./pkg_build.sh p
- name: Upload binary txz and plg to Github artifacts - name: Upload binary txz and plg to Github artifacts

View File

@@ -1,38 +1,38 @@
<?xml version='1.0' standalone='yes'?> <?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name ""> <!ENTITY name "">
<!ENTITY launch "Connect"> <!ENTITY launch "Connect">
<!ENTITY author "limetech"> <!ENTITY author "limetech">
<!ENTITY env ""> <!ENTITY env "">
<!ENTITY version ""> <!ENTITY version "">
<!ENTITY pluginURL ""> <!ENTITY pluginURL "">
<!ENTITY source "/boot/config/plugins/dynamix.my.servers/&name;"> <!ENTITY source "/boot/config/plugins/dynamix.my.servers/&name;">
<!ENTITY SHA256 ""> <!ENTITY SHA256 "">
<!ENTITY API_version ""> <!ENTITY API_version "">
<!ENTITY API_SHA256 ""> <!ENTITY API_SHA256 "">
<!ENTITY NODE ""> <!ENTITY NODEJS_FILENAME "">
<!ENTITY NODE_SHA256 ""> <!ENTITY NODEJS_SHA256 "">
<!ENTITY NODE_TXZ ""> <!ENTITY NODEJS_TXZ "">
<!ENTITY NGHTTP3 ""> <!ENTITY NGHTTP3_FILENAME "">
<!ENTITY NGHTTP3_TXZ ""> <!ENTITY NGHTTP3_TXZ "">
<!ENTITY NGHTTP3_SHA256 ""> <!ENTITY NGHTTP3_SHA256 "">
<!ENTITY MAIN_TXZ ""> <!ENTITY MAIN_TXZ "">
<!ENTITY API_TGZ ""> <!ENTITY API_TGZ "">
]> ]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" launch="&launch;" min="6.9.0-rc1" icon="globe"> <PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;"
launch="&launch;" min="6.9.0-rc1" icon="globe">
<CHANGES> <CHANGES>
##a long time ago in a galaxy far far away ##a long time ago in a galaxy far far away
- initial release - initial release
</CHANGES> </CHANGES>
<!-- prevent prod plugin from installing when staging already installed, and vice versa --> <!-- prevent prod plugin from installing when staging already installed, and vice versa -->
<FILE Run="/bin/bash" Method="install"> <FILE Run="/bin/bash" Method="install">
<INLINE> <INLINE>
name="&name;" version="&version;" API_version="&API_version;" PLGTYPE="&env;" name="&name;" version="&version;" API_version="&API_version;" PLGTYPE="&env;"
<![CDATA[ <![CDATA[
echo "Installing ${name}.plg ${version} with Unraid API ${API_version}" echo "Installing ${name}.plg ${version} with Unraid API ${API_version}"
if [ "${PLGTYPE}" = "production" ] && [ -f /boot/config/plugins/dynamix.unraid.net.staging.plg ]; then if [ "${PLGTYPE}" = "production" ] && [ -f /boot/config/plugins/dynamix.unraid.net.staging.plg ]; then
echo "⚠️ Please uninstall the Unraid Connect staging plugin before installing the production version" echo "⚠️ Please uninstall the Unraid Connect staging plugin before installing the production version"
@@ -91,7 +91,8 @@ sha256check() {
FILE=$1 FILE=$1
EXPECTED=$2 EXPECTED=$2
if [[ -f "${FILE}" ]]; then if [[ -f "${FILE}" ]]; then
echo -n "Validating ${FILE}... " ACTUAL=$(sha256sum "${FILE}" 2>/dev/null | grep -Po '^\S+') echo -n "Validating ${FILE}... "
ACTUAL=$(sha256sum "${FILE}" 2>/dev/null | grep -Po '^\S+')
if [[ "$EXPECTED" != "$ACTUAL" ]]; then if [[ "$EXPECTED" != "$ACTUAL" ]]; then
rm "${FILE}" rm "${FILE}"
echo " old. Deleted file." echo " old. Deleted file."
@@ -101,20 +102,22 @@ sha256check() {
fi fi
} }
]]> ]]>
sha256check "&source;.txz" "&SHA256;" sha256check "&source;.txz" "&SHA256;"
sha256check "/boot/config/plugins/dynamix.my.servers/unraid-api.tgz" "&API_SHA256;" sha256check "/boot/config/plugins/dynamix.my.servers/unraid-api.tgz" "&API_SHA256;"
exit 0 exit 0
</INLINE> </INLINE>
</FILE> </FILE>
<!-- download node --> <!-- download node -->
<FILE Name="/boot/config/plugins/dynamix.my.servers/&NODE;" Run="upgradepkg --install-new" max="7.0.0-beta.5"> <FILE Name="/boot/config/plugins/dynamix.my.servers/&NODEJS_FILENAME;" Run="upgradepkg --install-new"
<URL>&NODE_TXZ;</URL> max="7.0.0-beta.5">
<SHA256>&NODE_SHA256;</SHA256> <URL>&NODEJS_TXZ;</URL>
<SHA256>&NODEJS_SHA256;</SHA256>
</FILE> </FILE>
<!-- download nghttp3 --> <!-- download nghttp3 -->
<FILE name="/boot/config/plugins/dynamix.my.servers/&NGHTTP3;" Run="upgradepkg --install-new" max="7.0.0-beta.5"> <FILE name="/boot/config/plugins/dynamix.my.servers/&NGHTTP3_FILENAME;" Run="upgradepkg --install-new"
max="7.0.0-beta.5">
<URL>&NGHTTP3_TXZ;</URL> <URL>&NGHTTP3_TXZ;</URL>
<SHA256>&NGHTTP3_SHA256;</SHA256> <SHA256>&NGHTTP3_SHA256;</SHA256>
</FILE> </FILE>
@@ -133,8 +136,8 @@ exit 0
<FILE Run="/bin/bash" Method="install"> <FILE Run="/bin/bash" Method="install">
<INLINE> <INLINE>
MAINTXZ="&source;.txz" MAINTXZ="&source;.txz"
<![CDATA[ <![CDATA[
# before proceeding with install, doubly confirm downloaded files exist. just being pedantic. # before proceeding with install, doubly confirm downloaded files exist. just being pedantic.
FILE=${MAINTXZ} && [[ ! -f "$FILE" ]] && echo "⚠️ file missing - $FILE" && exit 1 FILE=${MAINTXZ} && [[ ! -f "$FILE" ]] && echo "⚠️ file missing - $FILE" && exit 1
FILE=/boot/config/plugins/dynamix.my.servers/unraid-api.tgz && [[ ! -f "$FILE" ]] && echo "⚠️ file missing - $FILE" && exit 1 FILE=/boot/config/plugins/dynamix.my.servers/unraid-api.tgz && [[ ! -f "$FILE" ]] && echo "⚠️ file missing - $FILE" && exit 1
@@ -291,8 +294,8 @@ exit(0);
<!-- uninstall existing plugin during update or removal --> <!-- uninstall existing plugin during update or removal -->
<FILE Run="/bin/bash" Method="install remove"> <FILE Run="/bin/bash" Method="install remove">
<INLINE> <INLINE>
MAINNAME="&name;" MAINNAME="&name;"
<![CDATA[ <![CDATA[
version= version=
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source /etc/unraid-version source /etc/unraid-version
@@ -359,8 +362,8 @@ exit 0
<!-- install all the things --> <!-- install all the things -->
<FILE Run="/bin/bash" Method="install"> <FILE Run="/bin/bash" Method="install">
<INLINE> <INLINE>
PLGTYPE="&env;" MAINTXZ="&source;.txz" PLGTYPE="&env;" MAINTXZ="&source;.txz"
<![CDATA[ <![CDATA[
appendTextIfMissing() { appendTextIfMissing() {
FILE="$1" TEXT="$2" FILE="$1" TEXT="$2"
if test -f "${FILE}" && ! grep -q "${TEXT}" "${FILE}" &>/dev/null; then if test -f "${FILE}" && ! grep -q "${TEXT}" "${FILE}" &>/dev/null; then