linux_install.sh 4.8 KB

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