]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/linux_install.sh
QMK CLI and JSON keymap support (#6176)
[qmk_firmware.git] / util / linux_install.sh
1 #!/bin/sh
2
3 # Note: This file uses tabs to indent. Please don't mix tabs and spaces.
4
5 GENTOO_WARNING="This script will make a USE change in order to ensure that that QMK works on your system. All changes will be sent to the the file /etc/portage/package.use/qmkfirmware -- please review it, and read Portage's output carefully before installing any packages on your system. You will also need to ensure that your kernel is compiled with support for the keyboard chip that you are using (e.g. enable Arduino for the Pro Micro). Further information can be found on the Gentoo wiki."
6
7 SLACKWARE_WARNING="You will need the following packages from slackbuilds.org:\n\tarm-binutils\n\tarm-gcc\n\tavr-binutils\n\tavr-gcc\n\tavr-libc\n\tavrdude\n\tdfu-programmer\n\tdfu-util\n\tnewlib\nThese packages will be installed with sudo and sboinstall, so ensure that your user is added to sudoers and that sboinstall is configured."
8
9 SOLUS_INFO="Your tools are now installed. To start using them, open new terminal or source these scripts:\n\t/usr/share/defaults/etc/profile.d/50-arm-toolchain-path.sh\n\t/usr/share/defaults/etc/profile.d/50-avr-toolchain-path.sh"
10
11 util_dir=$(dirname "$0")
12
13 if grep ID /etc/os-release | grep -qE "fedora"; then
14         sudo dnf install \
15                 arm-none-eabi-binutils-cs \
16                 arm-none-eabi-gcc-cs \
17                 arm-none-eabi-newlib \
18                 avr-binutils \
19                 avr-gcc \
20                 avr-libc \
21                 binutils-avr32-linux-gnu \
22                 dfu-util \
23                 dfu-programmer \
24                 diffutils \
25                 git \
26                 gcc \
27                 glibc-headers \
28                 kernel-devel \
29                 kernel-headers \
30                 make \
31                 perl \
32                 python3 \
33                 unzip \
34                 wget \
35                 zip
36
37 elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
38         DEBIAN_FRONTEND=noninteractive
39         DEBCONF_NONINTERACTIVE_SEEN=true
40         export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
41         sudo apt-get update
42         sudo apt-get -yq install \
43                 build-essential \
44                 avr-libc \
45                 binutils-arm-none-eabi \
46                 binutils-avr \
47                 dfu-programmer \
48                 dfu-util \
49                 diffutils \
50                 gcc \
51                 gcc-arm-none-eabi \
52                 gcc-avr \
53                 git \
54                 libnewlib-arm-none-eabi \
55                 python3 \
56                 unzip \
57                 wget \
58                 zip
59
60 elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
61         sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz
62         sudo pacman -S \
63                 arm-none-eabi-binutils \
64                 arm-none-eabi-gcc \
65                 arm-none-eabi-newlib \
66                 avrdude \
67                 avr-binutils \
68                 avr-libc \
69                 avr-gcc \
70                 base-devel \
71                 dfu-util \
72                 diffutils \
73                 gcc \
74                 git \
75                 python \
76                 unzip \
77                 wget \
78                 zip
79         git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
80         cd /tmp/dfu-programmer || exit 1
81         makepkg -sic
82         rm -rf /tmp/dfu-programmer/
83
84 elif grep ID /etc/os-release | grep -q gentoo; then
85         echo "$GENTOO_WARNING" | fmt
86         printf "\nProceed (y/N)? "
87         read -r answer
88         if echo "$answer" | grep -iq "^y"; then
89                 sudo touch /etc/portage/package.use/qmkfirmware
90                 # tee is used here since sudo doesn't apply to >>
91                 echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
92                 sudo emerge -auN \
93                         app-arch/unzip \
94                         app-arch/zip \
95                         app-mobilephone/dfu-util \
96                         dev-embedded/avrdude \
97                         dev-lang/python:3.5 \
98                         net-misc/wget \
99                         sys-devel/gcc \
100                         sys-devel/crossdev
101                 sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
102                 echo "Done!"
103         else
104                 echo "Quitting..."
105         fi
106
107 elif grep ID /etc/os-release | grep -q sabayon; then
108         sudo equo install \
109                 app-arch/unzip \
110                 app-arch/zip \
111                 app-mobilephone/dfu-util \
112                 dev-embedded/avrdude \
113                 dev-lang/python \
114                 net-misc/wget \
115                 sys-devel/gcc \
116                 sys-devel/crossdev
117         sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
118         echo "Done!"
119
120 elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
121         CROSS_AVR_GCC=cross-avr-gcc8
122         CROSS_ARM_GCC=cross-arm-none-gcc8
123         if grep ID /etc/os-release | grep -q "15."; then
124                 CROSS_AVR_GCC=cross-avr-gcc7
125                 CROSS_ARM_GCC=cross-arm-none-gcc7
126         fi
127         sudo zypper install \
128                 avr-libc \
129                 $CROSS_AVR_GCC \
130                 $CROSS_ARM_GCC \
131                 cross-avr-binutils \
132                 cross-arm-none-newlib-devel \
133                 cross-arm-binutils cross-arm-none-newlib-devel \
134                 dfu-tool \
135                 dfu-programmer \
136                 gcc \
137                 python3 \
138                 unzip \
139                 wget \
140                 zip
141
142 elif grep ID /etc/os-release | grep -q slackware; then
143         printf "$SLACKWARE_WARNING\n"
144         printf "\nProceed (y/N)? "
145         read -r answer
146         if echo "$answer" | grep -iq "^y" ;then
147                 sudo sboinstall \
148                         avr-binutils \
149                         avr-gcc \
150                         avr-libc \
151                         avrdude \
152                         dfu-programmer \
153                         dfu-util \
154                         arm-binutils \
155                         arm-gcc \
156                         newlib \
157                         python3
158                 echo "Done!"
159         else
160                 echo "Quitting..."
161         fi
162
163 elif grep ID /etc/os-release | grep -q solus; then
164         sudo eopkg ur
165         sudo eopkg it \
166                 -c system.devel \
167                 arm-none-eabi-gcc \
168                 arm-none-eabi-binutils \
169                 arm-none-eabi-newlib \
170                 avr-libc \
171                 avr-binutils \
172                 avr-gcc \
173                 avrdude \
174                 dfu-util \
175                 dfu-programmer \
176                 python3 \
177                 git \
178                 wget \
179                 zip \
180                 unzip
181         printf "\n$SOLUS_INFO\n"
182
183 else
184         echo "Sorry, we don't recognize your OS. Help us by contributing support!"
185         echo
186         echo "https://docs.qmk.fm/#/contributing"
187 fi
188
189 # Global install tasks
190 pip3 install -r ${util_dir}/../requirements.txt