]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/linux_install.sh
Make `readPin` output a 0 or 1 when using AVR to match ChibiOS's version of `readPin`
[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/qmk_firmware -- 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 if grep ID /etc/os-release | grep -qE "fedora"; then
10         sudo dnf install \
11                 arm-none-eabi-binutils-cs \
12                 arm-none-eabi-gcc-cs \
13                 arm-none-eabi-newlib \
14                 avr-binutils \
15                 avr-gcc \
16                 avr-libc \
17                 binutils-avr32-linux-gnu \
18                 dfu-util \
19                 dfu-programmer \
20                 diffutils \
21                 git \
22                 gcc \
23                 glibc-headers \
24                 kernel-devel \
25                 kernel-headers \
26                 make \
27                 perl \
28                 unzip \
29                 wget \
30                 zip
31
32 elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
33         DEBIAN_FRONTEND=noninteractive
34         DEBCONF_NONINTERACTIVE_SEEN=true
35         export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
36         sudo apt-get update
37         sudo apt-get install \
38                 build-essential \
39                 avr-libc \
40                 binutils-arm-none-eabi \
41                 binutils-avr \
42                 dfu-programmer \
43                 dfu-util \
44                 diffutils \
45                 gcc \
46                 gcc-arm-none-eabi \
47                 gcc-avr \
48                 git \
49                 libnewlib-arm-none-eabi \
50                 unzip \
51                 wget \
52                 zip
53
54 elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
55         # install avr-gcc 8.1 until 8.3 is available. See #3657 for details of the bug.
56         sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.1.0-1-x86_64.pkg.tar.xz
57         sudo pacman -S \
58                 arm-none-eabi-binutils \
59                 arm-none-eabi-gcc \
60                 arm-none-eabi-newlib \
61                 avr-binutils \
62                 avr-libc \
63                 avr-gcc \
64                 base-devel \
65                 dfu-util \
66                 diffutils \
67                 gcc \
68                 git \
69                 unzip \
70                 wget \
71                 zip
72         git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
73         cd /tmp/dfu-programmer
74         makepkg -sic
75         rm -rf /tmp/dfu-programmer/
76
77 elif grep ID /etc/os-release | grep -q gentoo; then
78         echo GENTOO_WARNING | fmt
79         echo -n "Proceed (y/N)? "
80         old_stty_cfg=$(stty -g)
81         stty raw -echo
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
86                 echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware > /dev/null
87                 sudo emerge -auN \
88                         app-arch/unzip \
89                         app-arch/zip \
90                         app-mobilephone/dfu-util \
91                         dev-embedded/avrdude \
92                         net-misc/wget \
93                         sys-devel/gcc \
94                         sys-devel/crossdev
95                 sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
96                 echo "Done!"
97         else
98                 echo "Quitting..."
99         fi
100
101 elif grep ID /etc/os-release | grep -q sabayon; then
102         sudo equo install \
103                 app-arch/unzip \
104                 app-arch/zip \
105                 app-mobilephone/dfu-util \
106                 dev-embedded/avrdude \
107                 net-misc/wget \
108                 sys-devel/gcc \
109                 sys-devel/crossdev
110         sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
111         echo "Done!"
112
113 elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
114         CROSS_AVR_GCC=cross-avr-gcc8
115         CROSS_ARM_GCC=cross-arm-none-gcc8
116         if grep ID /etc/os-release | grep -q "15.0"; then
117                 CROSS_AVR_GCC=cross-avr-gcc7
118                 CROSS_ARM_GCC=cross-arm-none-gcc7
119         fi
120         sudo zypper install \
121                 avr-libc \
122                 $CROSS_AVR_GCC \
123                 $CROSS_ARM_GCC \
124                 cross-avr-binutils \
125                 cross-arm-none-newlib-devel \
126                 cross-arm-binutils cross-arm-none-newlib-devel \
127                 dfu-tool \
128                 dfu-programmer \
129                 gcc \
130                 unzip \
131                 wget \
132                 zip
133
134 elif grep ID /etc/os-release | grep -q slackware; then
135         printf "$SLACKWARE_WARNING\n"
136         printf "\nProceed (y/N)? "
137         read -r answer
138         if echo "$answer" | grep -iq "^y" ;then
139                 sudo sboinstall \
140                         avr-binutils \
141                         avr-gcc \
142                         avr-libc \
143                         avrdude \
144                         dfu-programmer \
145                         dfu-util \
146                         arm-binutils \
147                         arm-gcc \
148                         newlib
149                 echo "Done!"
150         else
151                 echo "Quitting..."
152         fi
153
154 else
155         echo "Sorry, we don't recognize your OS. Help us by contributing support!"
156         echo
157         echo "https://docs.qmk.fm/#/contributing"
158 fi