mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-27 11:31:13 +00:00
Use --confirm
or CONFIRM=1
to skip delay, fixup use of sudo
when unavailable as root.
This commit is contained in:
parent
73b0a6d37c
commit
0d18136fdb
@ -6,7 +6,7 @@
|
||||
# This script will install the QMK CLI, toolchains, and flashing utilities.
|
||||
################################################################################
|
||||
# Environment variables:
|
||||
# QUICK: Skip the pre-install delay. (or: --quick)
|
||||
# CONFIRM: Skip the pre-install delay. (or: --confirm)
|
||||
# QMK_DISTRIB_DIR: The directory to install the QMK distribution to. (or: --qmk-distrib-dir=...)
|
||||
# UV_INSTALL_DIR: The directory to install `uv` to. (or: --uv-install-dir=...)
|
||||
# SKIP_CLEAN: Skip cleaning the distribution directory. (or: --skip-clean)
|
||||
@ -43,7 +43,7 @@
|
||||
script_args() {
|
||||
cat <<__EOT__
|
||||
--help -- Shows this help text
|
||||
--quick -- Skips the delay before installation
|
||||
--confirm -- Skips the delay before installation
|
||||
--uv-install-dir={path} -- The directory to install \`uv\` into
|
||||
--qmk-distrib-dir={path} -- The directory to install the QMK distribution into
|
||||
--skip-clean -- Skip cleaning the QMK distribution directory
|
||||
@ -103,6 +103,12 @@ __EOT__
|
||||
done
|
||||
}
|
||||
|
||||
nsudo() {
|
||||
[[ ${EUID} -ne 0 ]] && echo "sudo"
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
download_url() {
|
||||
local url=$1
|
||||
local filename=${2:-$(basename "$url")}
|
||||
@ -162,7 +168,7 @@ __EOT__
|
||||
}
|
||||
|
||||
preinstall_delay() {
|
||||
[ -z "${QUICK:-}" ] || return 0
|
||||
[ -z "${CONFIRM:-}" ] || return 0
|
||||
echo >&2
|
||||
echo "Waiting 10 seconds before proceeding. Press Ctrl+C to cancel installation." >&2
|
||||
sleep 10
|
||||
@ -189,16 +195,16 @@ __EOT__
|
||||
echo "It will also install the following system packages using 'pacman':" >&2
|
||||
echo " zstd base-devel clang diffutils unzip wget zip hidapi" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo pacman --needed --noconfirm -S zstd base-devel clang diffutils unzip wget zip
|
||||
sudo pacman --needed --noconfirm -S hidapi || true # This will fail if the community repo isn't enabled
|
||||
$(nsudo) pacman --needed --noconfirm -S zstd base-devel clang diffutils unzip wget zip
|
||||
$(nsudo) pacman --needed --noconfirm -S hidapi || true # This will fail if the community repo isn't enabled
|
||||
;;
|
||||
*debian* | *ubuntu*)
|
||||
echo "It will also install the following system packages using 'apt':" >&2
|
||||
echo " zstd build-essential clang-format diffutils unzip wget zip libhidapi-hidraw0" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo apt-get update
|
||||
$(nsudo) apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt-get --quiet --yes install zstd build-essential clang-format diffutils unzip wget zip libhidapi-hidraw0
|
||||
$(nsudo) apt-get --quiet --yes install zstd build-essential clang-format diffutils unzip wget zip libhidapi-hidraw0
|
||||
;;
|
||||
*fedora*)
|
||||
echo "It will also install the following system packages using 'dnf':" >&2
|
||||
@ -206,35 +212,35 @@ __EOT__
|
||||
echo "And whichever of the following is available, depending on which packages are provided by the distro:" >&2
|
||||
echo " libusb-devel, libusb1-devel, libusb-compat-0.1-devel, or libusb0-devel" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo dnf -y install zstd clang diffutils gcc git unzip wget zip hidapi libusb-devel libusb1-devel libusb-compat-0.1-devel libusb0-devel --skip-unavailable
|
||||
$(nsudo) dnf -y install zstd clang diffutils gcc git unzip wget zip hidapi libusb-devel libusb1-devel libusb-compat-0.1-devel libusb0-devel --skip-unavailable
|
||||
;;
|
||||
*gentoo*)
|
||||
echo "It will also the following packages using 'emerge':" >&2
|
||||
echo " app-arch/zstd app-arch/unzip app-arch/zip net-misc/wget llvm-core/clang sys-apps/hwloc dev-libs/hidapi" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo emerge -au --noreplace \
|
||||
$(nsudo) emerge -au --noreplace \
|
||||
app-arch/zstd app-arch/unzip app-arch/zip net-misc/wget llvm-core/clang sys-apps/hwloc dev-libs/hidapi
|
||||
;;
|
||||
*slackware*)
|
||||
echo "It will also the following packages using 'sboinstall':" >&2
|
||||
echo " python3" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo sboinstall python3 # Rest tbd?
|
||||
$(nsudo) sboinstall python3 # Rest tbd?
|
||||
;;
|
||||
*solus*)
|
||||
echo "It will also install the following system packages using 'eopkg':" >&2
|
||||
echo " system.devel zstd git wget zip unzip python3" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo eopkg -y update-repo
|
||||
sudo eopkg -y upgrade
|
||||
sudo eopkg -y install \
|
||||
$(nsudo) eopkg -y update-repo
|
||||
$(nsudo) eopkg -y upgrade
|
||||
$(nsudo) eopkg -y install \
|
||||
-c system.devel zstd git wget zip unzip python3
|
||||
;;
|
||||
*void*)
|
||||
echo "It will also the following packages using 'xbps-install':" >&2
|
||||
echo " zstd git make wget unzip zip python3" >&2
|
||||
preinstall_delay || exit 1
|
||||
sudo xbps-install -y \
|
||||
$(nsudo) xbps-install -y \
|
||||
zstd git make wget unzip zip python3
|
||||
;;
|
||||
*)
|
||||
|
Loading…
Reference in New Issue
Block a user