From bc069bd50026216fc0260e215dadfca8eb5fa7ed Mon Sep 17 00:00:00 2001 From: Jason Wallace Date: Fri, 23 Jun 2023 19:36:42 +0200 Subject: [PATCH] Refactor install-bundle to align with get-tinypilot.sh style (#1465) Related https://github.com/tiny-pilot/tinypilot/issues/1462 Dependent on https://github.com/tiny-pilot/tinypilot/pull/1464 Our `install-bundle` script is based on the `get-tinypilot.sh` script, with a few changes to install TinyPilot from a specified bundle file. This PR is a non-functional change to avoid creating an extra temporary directory and to keep the code aligned with `get-tinypilot.sh`. Review
on CodeApprove --------- Co-authored-by: Michael Lynch --- scripts/install-bundle | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/install-bundle b/scripts/install-bundle index cd8a7561a..9dc30b1f4 100755 --- a/scripts/install-bundle +++ b/scripts/install-bundle @@ -60,15 +60,6 @@ set -x readonly BUNDLE_PATH="$1" -if [[ "${BUNDLE_PATH}" == http* ]]; then - cd "$(mktemp --directory)" - wget "${BUNDLE_PATH}" - BUNDLE_FILE_PATH="${PWD}/$(find . -name '*.tgz')" - readonly BUNDLE_FILE_PATH -else - readonly BUNDLE_FILE_PATH="${BUNDLE_PATH}" -fi - # Historically, the TinyPilot bundle was unpacked to the device's disk, where it # persisted. Since then, we've moved to the use of a volatile RAMdisk, which # avoids excessive writes to the filesystem. As a result, this legacy installer @@ -142,11 +133,22 @@ readonly TMPDIR="${INSTALLER_DIR}/tmp" export TMPDIR mkdir "${TMPDIR}" +if [[ "${BUNDLE_PATH}" == http* ]]; then + readonly BUNDLE_FILE="${INSTALLER_DIR}/bundle.tgz" + curl "${BUNDLE_PATH}" \ + --location \ + --output "${BUNDLE_FILE}" \ + --show-error \ + --silent +else + readonly BUNDLE_FILE="${BUNDLE_PATH}" +fi + # Extract tarball to installer directory. tar \ --gunzip \ --extract \ - --file "${BUNDLE_FILE_PATH}" \ + --file "${BUNDLE_FILE}" \ --directory "${INSTALLER_DIR}" # Run install.