You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
6.9 KiB

  1. #!/bin/sh
  2. # Note: This file uses tabs to indent. Please don't mix tabs and spaces.
  3. 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."
  4. 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."
  5. 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"
  6. util_dir=$(dirname "$0")
  7. # For those distros that do not package bootloadHID
  8. install_bootloadhid() {
  9. if ! command -v bootloadHID >/dev/null; then
  10. wget https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz -O - | tar -xz -C /tmp
  11. cd /tmp/bootloadHID.2012-12-08/commandline/
  12. if make; then
  13. sudo cp bootloadHID /usr/local/bin
  14. fi
  15. cd -
  16. fi
  17. }
  18. if grep ID /etc/os-release | grep -qE "fedora"; then
  19. sudo dnf install \
  20. arm-none-eabi-binutils-cs \
  21. arm-none-eabi-gcc-cs \
  22. arm-none-eabi-newlib \
  23. avr-binutils \
  24. avr-gcc \
  25. avr-libc \
  26. binutils-avr32-linux-gnu \
  27. clang \
  28. avrdude \
  29. dfu-util \
  30. dfu-programmer \
  31. diffutils \
  32. git \
  33. gcc \
  34. glibc-headers \
  35. kernel-devel \
  36. kernel-headers \
  37. libusb-devel \
  38. make \
  39. perl \
  40. python3 \
  41. unzip \
  42. wget \
  43. zip
  44. elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
  45. DEBIAN_FRONTEND=noninteractive
  46. DEBCONF_NONINTERACTIVE_SEEN=true
  47. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  48. sudo apt-get update
  49. sudo apt-get -yq install \
  50. build-essential \
  51. avr-libc \
  52. binutils-arm-none-eabi \
  53. binutils-avr \
  54. clang-format \
  55. dfu-programmer \
  56. dfu-util \
  57. diffutils \
  58. gcc \
  59. gcc-arm-none-eabi \
  60. gcc-avr \
  61. git \
  62. libnewlib-arm-none-eabi \
  63. avrdude \
  64. libusb-dev \
  65. python3 \
  66. python3-pip \
  67. unzip \
  68. wget \
  69. zip
  70. elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
  71. sudo pacman --needed -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz
  72. sudo pacman -S --needed \
  73. arm-none-eabi-binutils \
  74. arm-none-eabi-gcc \
  75. arm-none-eabi-newlib \
  76. avrdude \
  77. avr-binutils \
  78. avr-libc \
  79. base-devel \
  80. clang \
  81. dfu-programmer \
  82. dfu-util \
  83. diffutils \
  84. gcc \
  85. git \
  86. libusb-compat \
  87. python \
  88. python-pip \
  89. unzip \
  90. wget \
  91. zip
  92. elif grep ID /etc/os-release | grep -q gentoo; then
  93. echo "$GENTOO_WARNING" | fmt
  94. printf "\nProceed (y/N)? "
  95. read -r answer
  96. if echo "$answer" | grep -iq "^y"; then
  97. sudo touch /etc/portage/package.use/qmkfirmware
  98. # tee is used here since sudo doesn't apply to >>
  99. echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
  100. sudo emerge -auN sys-devel/gcc
  101. sudo emerge -au --noreplace \
  102. app-arch/unzip \
  103. app-arch/zip \
  104. app-mobilephone/dfu-util \
  105. dev-embedded/dfu-programmer \
  106. dev-embedded/avrdude \
  107. net-misc/wget \
  108. sys-devel/clang \
  109. sys-devel/crossdev
  110. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr
  111. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi
  112. echo "Done!"
  113. else
  114. echo "Quitting..."
  115. fi
  116. elif grep ID /etc/os-release | grep -q sabayon; then
  117. sudo equo install \
  118. app-arch/unzip \
  119. app-arch/zip \
  120. app-mobilephone/dfu-util \
  121. dev-embedded/dfu-programmer \
  122. dev-embedded/avrdude \
  123. dev-lang/python \
  124. net-misc/wget \
  125. sys-devel/clang \
  126. sys-devel/gcc \
  127. sys-devel/crossdev
  128. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr
  129. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi
  130. echo "Done!"
  131. elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
  132. CROSS_AVR_GCC=cross-avr-gcc8
  133. CROSS_ARM_GCC=cross-arm-none-gcc8
  134. if grep ID /etc/os-release | grep -q "15."; then
  135. CROSS_AVR_GCC=cross-avr-gcc7
  136. CROSS_ARM_GCC=cross-arm-none-gcc7
  137. fi
  138. sudo zypper install \
  139. avr-libc \
  140. clang \
  141. $CROSS_AVR_GCC \
  142. $CROSS_ARM_GCC \
  143. cross-avr-binutils \
  144. cross-arm-none-newlib-devel \
  145. cross-arm-binutils cross-arm-none-newlib-devel \
  146. avrdude \
  147. dfu-util \
  148. dfu-programmer \
  149. gcc \
  150. libusb-devel \
  151. python3 \
  152. unzip \
  153. wget \
  154. zip
  155. elif grep ID /etc/os-release | grep -q slackware; then
  156. printf "$SLACKWARE_WARNING\n"
  157. printf "\nProceed (y/N)? "
  158. read -r answer
  159. if echo "$answer" | grep -iq "^y" ;then
  160. sudo sboinstall \
  161. avr-binutils \
  162. avr-gcc \
  163. avr-libc \
  164. avrdude \
  165. dfu-programmer \
  166. dfu-util \
  167. arm-binutils \
  168. arm-gcc \
  169. newlib \
  170. python3
  171. echo "Done!"
  172. else
  173. echo "Quitting..."
  174. fi
  175. elif grep ID /etc/os-release | grep -q solus; then
  176. sudo eopkg ur
  177. sudo eopkg it \
  178. -c system.devel \
  179. arm-none-eabi-gcc \
  180. arm-none-eabi-binutils \
  181. arm-none-eabi-newlib \
  182. avr-libc \
  183. avr-binutils \
  184. avr-gcc \
  185. avrdude \
  186. dfu-util \
  187. dfu-programmer \
  188. libusb-devel \
  189. python3 \
  190. git \
  191. wget \
  192. zip \
  193. unzip
  194. printf "\n$SOLUS_INFO\n"
  195. elif grep ID /etc/os-release | grep -q void; then
  196. sudo xbps-install \
  197. avr-binutils \
  198. avr-gcc \
  199. avr-libc \
  200. cross-arm-none-eabi-binutils \
  201. cross-arm-none-eabi-gcc \
  202. cross-arm-none-eabi-newlib \
  203. avrdude \
  204. dfu-programmer \
  205. dfu-util \
  206. gcc \
  207. git \
  208. libusb-compat-devel \
  209. make \
  210. wget \
  211. unzip \
  212. zip
  213. else
  214. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  215. echo
  216. echo "https://docs.qmk.fm/#/contributing"
  217. fi
  218. # Global install tasks
  219. install_bootloadhid
  220. pip3 install --user -r ${util_dir}/../requirements.txt
  221. if uname -a | grep -qi microsoft; then
  222. echo "********************************************************************************"
  223. echo "* Detected Windows Subsystem for Linux. *"
  224. echo "* Currently, WSL has no access to USB devices and so flashing from within the *"
  225. echo "* WSL terminal will not work. *"
  226. echo "* *"
  227. echo "* Please install the QMK Toolbox instead: *"
  228. echo "* https://github.com/qmk/qmk_toolbox/releases *"
  229. echo "* Then, map your WSL filesystem as a network drive: *"
  230. echo "* \\\\\\\\wsl$\\<distro> *"
  231. echo "********************************************************************************"
  232. echo
  233. fi