Skip to content

Commit bc069bd

Browse files
Refactor install-bundle to align with get-tinypilot.sh style (#1465)
Related #1462 Dependent on #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`. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1465"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> --------- Co-authored-by: Michael Lynch <[email protected]>
1 parent d94ff9a commit bc069bd

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

scripts/install-bundle

+12-10
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ set -x
6060

6161
readonly BUNDLE_PATH="$1"
6262

63-
if [[ "${BUNDLE_PATH}" == http* ]]; then
64-
cd "$(mktemp --directory)"
65-
wget "${BUNDLE_PATH}"
66-
BUNDLE_FILE_PATH="${PWD}/$(find . -name '*.tgz')"
67-
readonly BUNDLE_FILE_PATH
68-
else
69-
readonly BUNDLE_FILE_PATH="${BUNDLE_PATH}"
70-
fi
71-
7263
# Historically, the TinyPilot bundle was unpacked to the device's disk, where it
7364
# persisted. Since then, we've moved to the use of a volatile RAMdisk, which
7465
# avoids excessive writes to the filesystem. As a result, this legacy installer
@@ -142,11 +133,22 @@ readonly TMPDIR="${INSTALLER_DIR}/tmp"
142133
export TMPDIR
143134
mkdir "${TMPDIR}"
144135

136+
if [[ "${BUNDLE_PATH}" == http* ]]; then
137+
readonly BUNDLE_FILE="${INSTALLER_DIR}/bundle.tgz"
138+
curl "${BUNDLE_PATH}" \
139+
--location \
140+
--output "${BUNDLE_FILE}" \
141+
--show-error \
142+
--silent
143+
else
144+
readonly BUNDLE_FILE="${BUNDLE_PATH}"
145+
fi
146+
145147
# Extract tarball to installer directory.
146148
tar \
147149
--gunzip \
148150
--extract \
149-
--file "${BUNDLE_FILE_PATH}" \
151+
--file "${BUNDLE_FILE}" \
150152
--directory "${INSTALLER_DIR}"
151153

152154
# Run install.

0 commit comments

Comments
 (0)