Skip to content

Commit 11abc31

Browse files
authored
Additional bootstrapper safety checks (qmk#26242)
* Unset `grep` options to prevent issues with forcing colour. * Treat `musl`-based Linux distros are unsupported. * Fix bootstrapper tests
1 parent f0c79ee commit 11abc31

3 files changed

Lines changed: 34 additions & 12 deletions

File tree

.github/workflows/bootstrap_testing.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ jobs:
4949
- debian:11
5050
- debian:12
5151
- debian:13
52-
- ubuntu:20.04
5352
- ubuntu:22.04
5453
- ubuntu:24.04
54+
- ubuntu:26.04
5555

5656
# RHEL/CentOS/Fedora based
57-
- fedora:41
5857
- fedora:42
5958
- fedora:43
59+
- fedora:44
6060
- rockylinux:8
6161
- rockylinux:9
6262
- rockylinux/rockylinux:10
6363
- almalinux:8
6464
- almalinux:9
6565
- almalinux:10
6666

67-
# OpenSUSE based (we skip Tumbleweed as it has issues with package versions between pattern installs and other dependencies preinstalled into the base container)
67+
# OpenSUSE based (we skip Tumbleweed as it has issues with package mirrors regularly being out of date)
6868
- opensuse/leap:latest
6969

7070
# Gentoo-based
@@ -96,7 +96,7 @@ jobs:
9696
;;
9797
*suse*)
9898
zypper --non-interactive refresh
99-
zypper --non-interactive install sudo git shadow findutils # findutils=xargs
99+
zypper --non-interactive install sudo git shadow findutils tar # findutils=xargs
100100
;;
101101
*gentoo*)
102102
emerge-webrsync

docs/newbs_getting_started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ curl -fsSL https://install.qmk.fm | sh
7575

7676
::: info
7777
Many Linux distributions are supported, but not all. Mainstream distributions will have best success -- if possible, choose either Debian or its derivatives (such as Ubuntu, or Mint), CentOS or its derivatives (such as Fedora, or Rocky Linux), and Arch or its derivatives (such as Manjaro, or CachyOS).
78+
79+
**The standard QMK build environment installed below does not support `musl`-based Linux distributions.**
7880
:::
7981

8082
Install the QMK CLI by running:

util/env-bootstrap.sh

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
{ # this ensures the entire script is downloaded #
4040
set -eu
4141

42+
# Prevent user grep settings from injecting flags (e.g. --color=always) that
43+
# corrupt captured output and break pattern matching throughout this script.
44+
unset GREP_OPTIONS GREP_COLOR GREP_COLORS
45+
4246
BOOTSTRAP_TMPDIR="$(mktemp -d /tmp/qmk-bootstrap-failure.XXXXXX)"
4347
trap 'rm -rf "$BOOTSTRAP_TMPDIR" >/dev/null 2>&1 || true' EXIT
4448
FAILURE_FILE="${BOOTSTRAP_TMPDIR}/fail"
@@ -225,11 +229,28 @@ __EOT__
225229
macos) echo "zstd clang-format make hidapi libusb dos2unix git" ;;
226230
windows) echo "base-devel: zstd:p toolchain:p clang:p hidapi:p dos2unix: git: unzip:" ;;
227231
linux)
232+
if ldd --version 2>&1 | grep -qi musl; then
233+
echo >&2
234+
echo "Sorry, QMK's pre-built toolchains are compiled against glibc and will not run on musl-based Linux distributions." >&2
235+
echo >&2
236+
echo "Try using a glibc-based distribution, or use Docker instead:" >&2
237+
echo " - https://docs.qmk.fm/newbs_getting_started#set-up-your-environment" >&2
238+
echo " - https://docs.qmk.fm/#/getting_started_docker" >&2
239+
echo >&2
240+
echo "If you cannot use a compatible distro, you can try installing the \`qmk\` Python package manually using \`pip\`, most likely requiring a virtual environment:" >&2
241+
echo " % python3 -m pip install qmk" >&2
242+
echo >&2
243+
echo "All other dependencies will need to be installed manually, such as make, git, AVR and ARM toolchains, and associated flashing utilities." >&2
244+
echo >&2
245+
echo "**NOTE**: QMK does not provide official support for musl-based environments. Here be dragons, you are on your own." >&2
246+
signal_execution_failure
247+
return
248+
fi
228249
case $(grep ID /etc/os-release) in
229250
*arch* | *manjaro* | *cachyos*) echo "zstd base-devel clang diffutils wget unzip zip hidapi dos2unix git" ;;
230251
*debian* | *ubuntu*) echo "zstd build-essential clang-format diffutils wget unzip zip libhidapi-hidraw0 dos2unix git" ;;
231252
*fedora*) echo "zstd clang diffutils which gcc git wget unzip zip hidapi dos2unix libusb-devel libusb1-devel libusb-compat-0.1-devel libusb0-devel git epel-release" ;;
232-
*suse*) echo "zstd clang diffutils wget unzip zip libhidapi-hidraw0 dos2unix git libusb-1_0-devel gzip which" ;;
253+
*suse*) echo "zstd make gcc binutils clang diffutils wget unzip zip libhidapi-hidraw0 dos2unix git libusb-1_0-devel gzip which" ;;
233254
*gentoo*) echo "zstd sys-apps/diffutils wget unzip zip dev-libs/hidapi dos2unix dev-vcs/git dev-libs/libusb app-arch/gzip which" ;;
234255
*)
235256
echo >&2
@@ -321,25 +342,24 @@ __EOT__
321342
*fedora*)
322343
echo "It will also install the following system packages using 'dnf':" >&2
323344
print_package_manager_deps_and_delay
324-
# Some RHEL-likes need EPEL for hidapi
345+
# Some RHEL-likes need EPEL for hidapi and libusb packages
325346
$(nsudo) dnf -y install epel-release 2>/dev/null || true
326-
# RHEL-likes have some naming differences in libusb packages, so manually handle those
327-
$(nsudo) dnf -y install $(get_package_manager_deps | tr ' ' '\n' | grep -v 'epel-release' | grep -v libusb | tr '\n' ' ')
328-
for pkg in $(get_package_manager_deps | tr ' ' '\n' | grep libusb); do
347+
# RHEL-likes have naming differences in libusb/hidapi packages; try each individually
348+
$(nsudo) dnf -y install $(get_package_manager_deps | tr ' ' '\n' | grep -v 'epel-release' | grep -v libusb | grep -v hidapi | tr '\n' ' ')
349+
for pkg in $(get_package_manager_deps | tr ' ' '\n' | grep -E 'libusb|hidapi'); do
329350
$(nsudo) dnf -y install "$pkg" 2>/dev/null || true
330351
done
331352
;;
332353
*opensuse* | *suse*)
333-
echo "It will also install development tools as well as the following system packages using 'zypper':" >&2
354+
echo "It will also install the following system packages using 'zypper':" >&2
334355
print_package_manager_deps_and_delay
335356
$(nsudo) zypper --non-interactive refresh
336-
$(nsudo) zypper --non-interactive install -t pattern devel_basis devel_C_C++
337357
$(nsudo) zypper --non-interactive install $(get_package_manager_deps)
338358
;;
339359
*gentoo*)
340360
echo "It will also install the following system packages using 'emerge':" >&2
341361
print_package_manager_deps_and_delay
342-
$(nsudo) emerge --sync
362+
$(nsudo) emerge-webrsync
343363
$(nsudo) emerge --noreplace --ask=n $(get_package_manager_deps | tr ' ' '\n') || signal_execution_failure
344364
exit_if_execution_failed
345365
;;

0 commit comments

Comments
 (0)