|
39 | 39 | { # this ensures the entire script is downloaded # |
40 | 40 | set -eu |
41 | 41 |
|
| 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 | + |
42 | 46 | BOOTSTRAP_TMPDIR="$(mktemp -d /tmp/qmk-bootstrap-failure.XXXXXX)" |
43 | 47 | trap 'rm -rf "$BOOTSTRAP_TMPDIR" >/dev/null 2>&1 || true' EXIT |
44 | 48 | FAILURE_FILE="${BOOTSTRAP_TMPDIR}/fail" |
@@ -225,11 +229,28 @@ __EOT__ |
225 | 229 | macos) echo "zstd clang-format make hidapi libusb dos2unix git" ;; |
226 | 230 | windows) echo "base-devel: zstd:p toolchain:p clang:p hidapi:p dos2unix: git: unzip:" ;; |
227 | 231 | 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 |
228 | 249 | case $(grep ID /etc/os-release) in |
229 | 250 | *arch* | *manjaro* | *cachyos*) echo "zstd base-devel clang diffutils wget unzip zip hidapi dos2unix git" ;; |
230 | 251 | *debian* | *ubuntu*) echo "zstd build-essential clang-format diffutils wget unzip zip libhidapi-hidraw0 dos2unix git" ;; |
231 | 252 | *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" ;; |
233 | 254 | *gentoo*) echo "zstd sys-apps/diffutils wget unzip zip dev-libs/hidapi dos2unix dev-vcs/git dev-libs/libusb app-arch/gzip which" ;; |
234 | 255 | *) |
235 | 256 | echo >&2 |
@@ -321,25 +342,24 @@ __EOT__ |
321 | 342 | *fedora*) |
322 | 343 | echo "It will also install the following system packages using 'dnf':" >&2 |
323 | 344 | 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 |
325 | 346 | $(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 |
329 | 350 | $(nsudo) dnf -y install "$pkg" 2>/dev/null || true |
330 | 351 | done |
331 | 352 | ;; |
332 | 353 | *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 |
334 | 355 | print_package_manager_deps_and_delay |
335 | 356 | $(nsudo) zypper --non-interactive refresh |
336 | | - $(nsudo) zypper --non-interactive install -t pattern devel_basis devel_C_C++ |
337 | 357 | $(nsudo) zypper --non-interactive install $(get_package_manager_deps) |
338 | 358 | ;; |
339 | 359 | *gentoo*) |
340 | 360 | echo "It will also install the following system packages using 'emerge':" >&2 |
341 | 361 | print_package_manager_deps_and_delay |
342 | | - $(nsudo) emerge --sync |
| 362 | + $(nsudo) emerge-webrsync |
343 | 363 | $(nsudo) emerge --noreplace --ask=n $(get_package_manager_deps | tr ' ' '\n') || signal_execution_failure |
344 | 364 | exit_if_execution_failed |
345 | 365 | ;; |
|
0 commit comments