Run daemon on packaged Bare runtime
This commit is contained in:
@@ -40,16 +40,36 @@ done
|
||||
|
||||
command -v curl >/dev/null || { echo "curl is required" >&2; exit 1; }
|
||||
command -v tar >/dev/null || { echo "tar is required" >&2; exit 1; }
|
||||
command -v npm >/dev/null || { echo "Node.js/npm 22.17+ is required" >&2; exit 1; }
|
||||
node -e 'const [major,minor]=process.versions.node.split(".").map(Number); if (major < 22 || (major === 22 && minor < 17)) process.exit(1)' \
|
||||
|| { echo "Node.js 22.17+ is required" >&2; exit 1; }
|
||||
|
||||
TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/jarvis-web-install.XXXXXX")"
|
||||
cleanup() { rm -rf "$TMP_DIR"; }
|
||||
trap cleanup EXIT
|
||||
|
||||
ARCHIVE_URL="${SERVER%/}/${REPO}/archive/${REF}.tar.gz"
|
||||
ARCHIVE="${TMP_DIR}/jarvis.tar.gz"
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64) BUNDLE_NAME="jarvis-qvac-bare-linux-x64.tar.gz" ;;
|
||||
aarch64|arm64) BUNDLE_NAME="jarvis-qvac-bare-linux-arm64.tar.gz" ;;
|
||||
*) BUNDLE_NAME="" ;;
|
||||
esac
|
||||
BUNDLE_URL="${JARVIS_BUNDLE_URL:-${SERVER%/}/${REPO}/releases/download/rolling/${BUNDLE_NAME}}"
|
||||
BUNDLE="${TMP_DIR}/${BUNDLE_NAME}"
|
||||
if [[ -n "${BUNDLE_NAME}" ]]; then
|
||||
echo "Trying the self-contained Bare bundle ${BUNDLE_NAME}"
|
||||
if curl --fail --location --silent --show-error --retry 3 --proto '=https' --tlsv1.2 \
|
||||
--user-agent "${USER_AGENT}" "${BUNDLE_URL}" -o "${BUNDLE}" && test -s "${BUNDLE}"; then
|
||||
mkdir -p "${TMP_DIR}/bundle"
|
||||
tar -xzf "${BUNDLE}" -C "${TMP_DIR}/bundle"
|
||||
SOURCE_DIR="$(find "${TMP_DIR}/bundle" -mindepth 1 -maxdepth 1 -type d -print -quit)"
|
||||
test -n "${SOURCE_DIR}" || { echo "Bare bundle contained no application directory" >&2; exit 1; }
|
||||
test -x "${SOURCE_DIR}/packaging/install.sh" || { echo "Bare bundle contained no installer" >&2; exit 1; }
|
||||
echo "Installing the bundled Bare runtime; Node.js is not required"
|
||||
exec bash "${SOURCE_DIR}/packaging/install.sh" "$@"
|
||||
fi
|
||||
fi
|
||||
if ! command -v npm >/dev/null || ! command -v node >/dev/null; then
|
||||
echo "No published Bare bundle was found. Use JARVIS_REF=rolling or set JARVIS_BUNDLE_URL; Node.js is only needed for a source fallback." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Downloading JARVIS-QVAC source ref '${REF}' from ${SERVER}"
|
||||
curl --fail --location --silent --show-error --retry 3 --proto '=https' --tlsv1.2 \
|
||||
--user-agent "${USER_AGENT}" \
|
||||
|
||||
Reference in New Issue
Block a user