Skip to content

Commit f127ad2

Browse files
authored
Fix install blocks (#1858)
Resolves #1857 This change refactors our installation blocks to use single conditions, fixing a bug when checking for Raspbian-based systems that allowed installations to proceed on 64-bit systems regardless of the OS version. This also adds a check for a `FORCE_INSTALL` flag - setting the `FORCE_INSTALL` environment variable allows you to bypass the system checks to attempt an install on unsupported systems. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1858"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a>
1 parent 66d3d02 commit f127ad2

1 file changed

Lines changed: 41 additions & 29 deletions

File tree

bundler/bundle/install

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,54 @@ set -u
1111
# Echo commands before executing them, by default to stderr.
1212
set -x
1313

14-
# Prevent installation on the Raspberry Pi 3.
15-
if grep -q "^Model *: Raspberry Pi 3" /proc/cpuinfo ; then
16-
echo 'You are trying to install on incompatible hardware.' >&2
17-
echo 'Visit https://github.com/tiny-pilot/tinypilot/ for more details.' >&2
18-
exit 1
19-
fi
20-
21-
# Prevent installation on OS versions lower than Raspberry Pi OS 11 "Bullseye".
22-
# Note: the distro ID is called "Raspbian" because the 32-bit version of the
23-
# Raspberry Pi operating system is based on Raspbian repos (an independent
24-
# open-source project). Similarly, the the 64-bit version of the Raspberry Pi
25-
# operating system is based on Debian and its distro ID would be "Debian".
26-
if [[ "$(lsb_release --id --short)" == 'Raspbian' ]] \
27-
&& (( "$(lsb_release --release --short)" < 11 )); then
28-
echo "TinyPilot no longer supports Raspberry Pi OS 10 \"Buster\" or lower." >&2
29-
echo "To install TinyPilot, you'll need to upgrade your operating system to Raspberry Pi OS 11 \"Bullseye\"." >&2
30-
exit 1
31-
fi
32-
33-
# Prevent installation on Raspberry Pi OS 12 "Bookworm".
34-
if [[ "$(lsb_release --id --short)" == 'Raspbian' ]] \
35-
&& (( "$(lsb_release --release --short)" > 11 )); then
36-
echo "TinyPilot is not yet compatible with Raspberry Pi OS 12 \"Bookworm\"." >&2
37-
echo "You can track our progress by visiting https://github.com/tiny-pilot/tinypilot/issues/1668" >&2
38-
echo "To install TinyPilot, you'll need to downgrade your operating system to Raspberry Pi OS 11 \"Bullseye\"." >&2
39-
exit 1
40-
fi
41-
42-
# Abort installation if the read-only filesystem is enabled
14+
# Abort installation if the read-only filesystem is enabled.
4315
if grep -q "boot=overlay" /proc/cmdline ; then
4416
echo 'The read-only filesystem is enabled.' >&2
4517
echo 'Disable the read-only filesystem before proceeding.' >&2
4618
echo 'See https://tinypilotkvm.com/faq/read-only-filesystem for details.' >&2
4719
exit 1
4820
fi
4921

22+
# Check if the user is forcing an install.
23+
if [[ -n "${FORCE_INSTALL+x}" ]]; then
24+
echo 'Forcing installation on unsupported setup.'
25+
else
26+
# Restrict installation to only specific configurations.
27+
28+
# Install only on Raspberry Pi 4 Model B.
29+
if ! grep --quiet "^Model\s*: Raspberry Pi 4 Model B" /proc/cpuinfo ; then
30+
echo 'You are trying to install on unsupported hardware.' >&2
31+
echo 'Visit https://github.com/tiny-pilot/tinypilot/ for more details.' >&2
32+
exit 1
33+
fi
34+
35+
# Prevent installation on 64-bit operating systems.
36+
# Note: the distro ID is called "Raspbian" because the 32-bit version of the
37+
# Raspberry Pi operating system is based on Raspbian repos (an independent
38+
# open-source project). Similarly, the the 64-bit version of the Raspberry Pi
39+
# operating system is based on Debian and its distro ID would be "Debian".
40+
if [[ "$(lsb_release --id --short)" != 'Raspbian' ]]; then
41+
echo "TinyPilot currently only supports the 32-bit version of Raspberry Pi OS 11 \"Bullseye\"." >&2
42+
echo "To install TinyPilot, you'll need Raspberry Pi OS 11 \"Bullseye\" (32-bit)." >&2
43+
exit 1
44+
fi
45+
46+
# Prevent installation on OS versions lower than Raspberry Pi OS 11 "Bullseye".
47+
if (( "$(lsb_release --release --short)" < 11 )); then
48+
echo "TinyPilot no longer supports Raspberry Pi OS 10 \"Buster\" or lower." >&2
49+
echo "To install TinyPilot, you'll need to upgrade your operating system to Raspberry Pi OS 11 \"Bullseye\" (32-bit)." >&2
50+
exit 1
51+
fi
52+
53+
# Prevent installation on Raspberry Pi OS 12 "Bookworm".
54+
if (( "$(lsb_release --release --short)" > 11 )); then
55+
echo "TinyPilot is not yet compatible with Raspberry Pi OS 12 \"Bookworm\"." >&2
56+
echo "You can track our progress by visiting https://github.com/tiny-pilot/tinypilot/issues/1668" >&2
57+
echo "To install TinyPilot, you'll need to downgrade your operating system to Raspberry Pi OS 11 \"Bullseye\" (32-bit)." >&2
58+
exit 1
59+
fi
60+
fi
61+
5062
# Get the filename of the Janus Debian package.
5163
JANUS_DEBIAN_PACKAGE="$(ls janus*.deb)"
5264
readonly JANUS_DEBIAN_PACKAGE

0 commit comments

Comments
 (0)