linux_install.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. avr-binutils \
  58. avr-libc \
  59. avr-gcc \
  60. base-devel \
  61. dfu-util \
  62. diffutils \
  63. gcc \
  64. git \
  65. python \
  66. unzip \
  67. wget \
  68. zip
  69. git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
  70. cd /tmp/dfu-programmer || exit 1
  71. makepkg -sic
  72. rm -rf /tmp/dfu-programmer/
  73. elif grep ID /etc/os-release | grep -q gentoo; then
  74. echo "$GENTOO_WARNING" | fmt
  75. printf "\nProceed (y/N)? "
  76. read -r answer
  77. if echo "$answer" | grep -iq "^y"; then
  78. sudo touch /etc/portage/package.use/qmkfirmware
  79. # tee is used here since sudo doesn't apply to >>
  80. echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
  81. sudo emerge -auN \
  82. app-arch/unzip \
  83. app-arch/zip \
  84. app-mobilephone/dfu-util \
  85. dev-embedded/avrdude \
  86. dev-lang/python:3.5 \
  87. net-misc/wget \
  88. sys-devel/gcc \
  89. sys-devel/crossdev
  90. sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
  91. echo "Done!"
  92. else
  93. echo "Quitting..."
  94. fi
  95. elif grep ID /etc/os-release | grep -q sabayon; then
  96. sudo equo install \
  97. app-arch/unzip \
  98. app-arch/zip \
  99. app-mobilephone/dfu-util \
  100. dev-embedded/avrdude \
  101. dev-lang/python \
  102. net-misc/wget \
  103. sys-devel/gcc \
  104. sys-devel/crossdev
  105. sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
  106. echo "Done!"
  107. elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
  108. CROSS_AVR_GCC=cross-avr-gcc8
  109. CROSS_ARM_GCC=cross-arm-none-gcc8
  110. if grep ID /etc/os-release | grep -q "15.0"; then
  111. CROSS_AVR_GCC=cross-avr-gcc7
  112. CROSS_ARM_GCC=cross-arm-none-gcc7
  113. fi
  114. sudo zypper install \
  115. avr-libc \
  116. $CROSS_AVR_GCC \
  117. $CROSS_ARM_GCC \
  118. cross-avr-binutils \
  119. cross-arm-none-newlib-devel \
  120. cross-arm-binutils cross-arm-none-newlib-devel \
  121. dfu-tool \
  122. dfu-programmer \
  123. gcc \
  124. python3 \
  125. unzip \
  126. wget \
  127. zip
  128. elif grep ID /etc/os-release | grep -q slackware; then
  129. printf "$SLACKWARE_WARNING\n"
  130. printf "\nProceed (y/N)? "
  131. read -r answer
  132. if echo "$answer" | grep -iq "^y" ;then
  133. sudo sboinstall \
  134. avr-binutils \
  135. avr-gcc \
  136. avr-libc \
  137. avrdude \
  138. dfu-programmer \
  139. dfu-util \
  140. arm-binutils \
  141. arm-gcc \
  142. newlib \
  143. python3
  144. echo "Done!"
  145. else
  146. echo "Quitting..."
  147. fi
  148. elif grep ID /etc/os-release | grep -q solus; then
  149. sudo eopkg ur
  150. sudo eopkg it \
  151. -c system.devel \
  152. arm-none-eabi-gcc \
  153. arm-none-eabi-binutils \
  154. arm-none-eabi-newlib \
  155. avr-libc \
  156. avr-binutils \
  157. avr-gcc \
  158. avrdude \
  159. dfu-util \
  160. dfu-programmer \
  161. python3 \
  162. git \
  163. wget \
  164. zip \
  165. unzip
  166. printf "\n$SOLUS_INFO\n"
  167. else
  168. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  169. echo
  170. echo "https://docs.qmk.fm/#/contributing"
  171. fi