CLI: Improve experience when running `qmk setup` on FreeBSD. (#8798)

* CLI: Improve experience when running `qmk setup` on FreeBSD.

* Install the `avrdude` package as well.
* Switch to installing python packages w/ `--user` flag.
* Basic getting started sections for FreeBSD.
* Update `util/freebsd_install.sh` for root/non-root branches.

* Add ID to doc section.

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>

* Add ID to another docs section.

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>

* Use `; then` in script for consistency.

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>

* Updated to use sudo in one shot if available.

* Apply suggestions from code review

Co-authored-by: Erovia <Erovia@users.noreply.github.com>

* Style fixes for latest version in master.

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: skullydazed <skullydazed@users.noreply.github.com>
Co-authored-by: Erovia <Erovia@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
master
Pete Johanson 2020-05-20 11:09:13 -04:00 committed by GitHub
parent 0fbcb41c85
commit 3ad2be52a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 6 deletions

View File

@ -69,10 +69,21 @@ You will need to install Git and Python. It's very likely that you already have
* Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip` * Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip`
* Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi` * Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi`
Install the global CLI to bootstrap your system: Install the global CLI to bootstrap your system:
`python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`) `python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`)
### FreeBSD
You will need to install Git and Python. It's possible that you already have both, but if not, run the following commands to install them:
pkg install git python3
Make sure that `$HOME/.local/bin` is added to your `$PATH` so that locally install Python packages are available.
Once installed, you can install QMK CLI:
python3 -m pip install --user qmk
## 3. Run QMK Setup :id=set-up-qmk ## 3. Run QMK Setup :id=set-up-qmk
@ -88,6 +99,12 @@ This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155)
Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562). Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562).
Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc` Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc`
?>**Note on FreeBSD**:
It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your
base system using `pkg`. However the installation will probably fail when run as an unprivileged user.
To manually install the base dependencies, run `./util/qmk_install.sh` either as `root`, or with `sudo`.
Once that completes, re-run `qmk setup` to complete the setup and checks.
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message. ?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message.
## 4. Test Your Build Environment ## 4. Test Your Build Environment

View File

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
util_dir=$(dirname "$0") packages=$(cat <<EOF
pkg update
pkg install -y \
git \ git \
wget \ wget \
gmake \ gmake \
@ -13,9 +11,29 @@ pkg install -y \
avr-libc \ avr-libc \
dfu-programmer \ dfu-programmer \
dfu-util \ dfu-util \
avrdude \
arm-none-eabi-gcc \ arm-none-eabi-gcc \
arm-none-eabi-binutils \ arm-none-eabi-binutils \
arm-none-eabi-newlib \ arm-none-eabi-newlib \
diffutils \ diffutils \
python3 python3
pip3 install -r ${util_dir}/../requirements.txt EOF
)
util_dir=$(dirname "$0")
if [ $(id -u) = 0 ]; then
pkg update
pkg install -y ${packages}
echo ""
echo "Re-run the setup as your normal user to install the qmk python dependencies"
exit 1
else
if command -v sudo > /dev/null 2>&1; then
sudo pkg update
sudp pkg install -y ${packages}
else
echo "Make sure you run setup as root first to install base OS dependencies..."
echo ""
fi
python3 -m pip install --user -r ${util_dir}/../requirements.txt
fi