diff options
| author | Konstantin Đorđević <vomindoraan@gmail.com> | 2018-12-26 17:01:26 +0100 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-12-26 08:01:26 -0800 |
| commit | 0c1256e60ab430402ad5dcd11f2368bb065fa958 (patch) | |
| tree | 5ead22ddf3eabffde5ac7a2fc0b1d06b04e0427e /util/linux_install.sh | |
| parent | b7d2a9f980be009f5d40950cf649ce1086b821a9 (diff) | |
| download | qmk_firmware-0c1256e60ab430402ad5dcd11f2368bb065fa958.tar.gz qmk_firmware-0c1256e60ab430402ad5dcd11f2368bb065fa958.zip | |
Read user input properly in linux_install.sh for Gentoo (#4395)
* Change spaces to tabs on two lines
The rest of the file uses tabs
* Read user input in a non-terrible, non-hacky way
* Remove unnecessary tee call
* read -p is not POSIX
* Add missing $ to echo GENTOO_WARNING
* Replace non-POSIX echo -n with printf
* Use cd ... || exit 1 in case git clone fails
* Add missing sudo
Thanks @snortwolf
* Undo replacing tee with >>
Diffstat (limited to 'util/linux_install.sh')
| -rwxr-xr-x | util/linux_install.sh | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/util/linux_install.sh b/util/linux_install.sh index 70b389c0d..d6e6b86cd 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh | |||
| @@ -32,7 +32,7 @@ if grep ID /etc/os-release | grep -qE "fedora"; then | |||
| 32 | elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then | 32 | elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then |
| 33 | DEBIAN_FRONTEND=noninteractive | 33 | DEBIAN_FRONTEND=noninteractive |
| 34 | DEBCONF_NONINTERACTIVE_SEEN=true | 34 | DEBCONF_NONINTERACTIVE_SEEN=true |
| 35 | export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN | 35 | export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN |
| 36 | sudo apt-get update | 36 | sudo apt-get update |
| 37 | sudo apt-get install \ | 37 | sudo apt-get install \ |
| 38 | build-essential \ | 38 | build-essential \ |
| @@ -70,20 +70,18 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then | |||
| 70 | wget \ | 70 | wget \ |
| 71 | zip | 71 | zip |
| 72 | git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer | 72 | git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer |
| 73 | cd /tmp/dfu-programmer | 73 | cd /tmp/dfu-programmer || exit 1 |
| 74 | makepkg -sic | 74 | makepkg -sic |
| 75 | rm -rf /tmp/dfu-programmer/ | 75 | rm -rf /tmp/dfu-programmer/ |
| 76 | 76 | ||
| 77 | elif grep ID /etc/os-release | grep -q gentoo; then | 77 | elif grep ID /etc/os-release | grep -q gentoo; then |
| 78 | echo GENTOO_WARNING | fmt | 78 | echo "$GENTOO_WARNING" | fmt |
| 79 | echo -n "Proceed (y/N)? " | 79 | printf "\nProceed (y/N)? " |
| 80 | old_stty_cfg=$(stty -g) | 80 | read -r answer |
| 81 | stty raw -echo | 81 | if echo "$answer" | grep -iq "^y"; then |
| 82 | answer=$( while ! head -c 1 | grep -i '[ny]' ;do true ;done ) | ||
| 83 | stty $old_stty_cfg | ||
| 84 | if echo "$answer" | grep -iq "^y" ;then | ||
| 85 | sudo touch /etc/portage/package.use/qmkfirmware | 82 | sudo touch /etc/portage/package.use/qmkfirmware |
| 86 | echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware > /dev/null | 83 | # tee is used here since sudo doesn't apply to >> |
| 84 | echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null | ||
| 87 | sudo emerge -auN \ | 85 | sudo emerge -auN \ |
| 88 | app-arch/unzip \ | 86 | app-arch/unzip \ |
| 89 | app-arch/zip \ | 87 | app-arch/zip \ |
