linux_install.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. if grep ID /etc/os-release | grep -qE "fedora"; then
  8. sudo dnf install \
  9. arm-none-eabi-binutils-cs \
  10. arm-none-eabi-gcc-cs \
  11. arm-none-eabi-newlib \
  12. avr-binutils \
  13. avr-gcc \
  14. avr-libc \
  15. binutils-avr32-linux-gnu \
  16. clang \
  17. dfu-util \
  18. dfu-programmer \
  19. diffutils \
  20. git \
  21. gcc \
  22. glibc-headers \
  23. kernel-devel \
  24. kernel-headers \
  25. make \
  26. perl \
  27. python3 \
  28. unzip \
  29. wget \
  30. zip
  31. elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
  32. DEBIAN_FRONTEND=noninteractive
  33. DEBCONF_NONINTERACTIVE_SEEN=true
  34. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  35. sudo apt-get update
  36. sudo apt-get -yq install \
  37. build-essential \
  38. avr-libc \
  39. binutils-arm-none-eabi \
  40. binutils-avr \
  41. clang-format \
  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. python3 \
  51. unzip \
  52. wget \
  53. zip
  54. elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
  55. sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz
  56. sudo pacman -S --needed \
  57. arm-none-eabi-binutils \
  58. arm-none-eabi-gcc \
  59. arm-none-eabi-newlib \
  60. avrdude \
  61. avr-binutils \
  62. avr-libc \
  63. avr-gcc \
  64. base-devel \
  65. clang \
  66. dfu-programmer \
  67. dfu-util \
  68. diffutils \
  69. gcc \
  70. git \
  71. python \
  72. unzip \
  73. wget \
  74. zip
  75. elif grep ID /etc/os-release | grep -q gentoo; then
  76. echo "$GENTOO_WARNING" | fmt
  77. printf "\nProceed (y/N)? "
  78. read -r answer
  79. if echo "$answer" | grep -iq "^y"; then
  80. sudo touch /etc/portage/package.use/qmkfirmware
  81. # tee is used here since sudo doesn't apply to >>
  82. echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
  83. sudo emerge -auN \
  84. app-arch/unzip \
  85. app-arch/zip \
  86. app-mobilephone/dfu-util \
  87. dev-embedded/avrdude \
  88. dev-lang/python:3.5 \
  89. net-misc/wget \
  90. sys-devel/clang \
  91. sys-devel/gcc \
  92. sys-devel/crossdev
  93. sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
  94. echo "Done!"
  95. else
  96. echo "Quitting..."
  97. fi
  98. elif grep ID /etc/os-release | grep -q sabayon; then
  99. sudo equo install \
  100. app-arch/unzip \
  101. app-arch/zip \
  102. app-mobilephone/dfu-util \
  103. dev-embedded/avrdude \
  104. dev-lang/python \
  105. net-misc/wget \
  106. sys-devel/clang \
  107. sys-devel/gcc \
  108. sys-devel/crossdev
  109. sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
  110. echo "Done!"
  111. elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
  112. CROSS_AVR_GCC=cross-avr-gcc8
  113. CROSS_ARM_GCC=cross-arm-none-gcc8
  114. if grep ID /etc/os-release | grep -q "15."; then
  115. CROSS_AVR_GCC=cross-avr-gcc7
  116. CROSS_ARM_GCC=cross-arm-none-gcc7
  117. fi
  118. sudo zypper install \
  119. avr-libc \
  120. clang \
  121. $CROSS_AVR_GCC \
  122. $CROSS_ARM_GCC \
  123. cross-avr-binutils \
  124. cross-arm-none-newlib-devel \
  125. cross-arm-binutils cross-arm-none-newlib-devel \
  126. dfu-tool \
  127. dfu-programmer \
  128. gcc \
  129. python3 \
  130. unzip \
  131. wget \
  132. zip
  133. elif grep ID /etc/os-release | grep -q slackware; then
  134. printf "$SLACKWARE_WARNING\n"
  135. printf "\nProceed (y/N)? "
  136. read -r answer
  137. if echo "$answer" | grep -iq "^y" ;then
  138. sudo sboinstall \
  139. avr-binutils \
  140. avr-gcc \
  141. avr-libc \
  142. avrdude \
  143. dfu-programmer \
  144. dfu-util \
  145. arm-binutils \
  146. arm-gcc \
  147. newlib \
  148. python3
  149. echo "Done!"
  150. else
  151. echo "Quitting..."
  152. fi
  153. elif grep ID /etc/os-release | grep -q solus; then
  154. sudo eopkg ur
  155. sudo eopkg it \
  156. -c system.devel \
  157. arm-none-eabi-gcc \
  158. arm-none-eabi-binutils \
  159. arm-none-eabi-newlib \
  160. avr-libc \
  161. avr-binutils \
  162. avr-gcc \
  163. avrdude \
  164. dfu-util \
  165. dfu-programmer \
  166. python3 \
  167. git \
  168. wget \
  169. zip \
  170. unzip
  171. printf "\n$SOLUS_INFO\n"
  172. elif grep ID /etc/os-release | grep -q void; then
  173. # musl Void systems don't have glibc cross compilers avaliable in their repos.
  174. # glibc Void systems do have musl cross compilers though, for some reason.
  175. # So, default to musl, and switch to glibc if it is installed.
  176. CROSS_ARM=cross-arm-linux-musleabi
  177. if xbps-query glibc > /dev/null; then # Check is glibc if installed
  178. CROSS_ARM=cross-arm-linux-gnueabi
  179. fi
  180. sudo xbps-install \
  181. avr-binutils \
  182. avr-gcc \
  183. avr-libc \
  184. $CROSS_ARM \
  185. dfu-programmer \
  186. dfu-util \
  187. gcc \
  188. git \
  189. make \
  190. wget \
  191. unzip \
  192. zip
  193. else
  194. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  195. echo
  196. echo "https://docs.qmk.fm/#/contributing"
  197. fi
  198. # Global install tasks
  199. pip3 install -r ${util_dir}/../requirements.txt