linux_install.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. if grep ID /etc/os-release | grep -qE "fedora"; then
  6. sudo dnf install \
  7. arm-none-eabi-binutils-cs \
  8. arm-none-eabi-gcc-cs \
  9. arm-none-eabi-newlib \
  10. avr-binutils \
  11. avr-gcc \
  12. avr-libc \
  13. binutils-avr32-linux-gnu \
  14. dfu-util \
  15. dfu-programmer \
  16. diffutils \
  17. git \
  18. gcc \
  19. glibc-headers \
  20. kernel-devel \
  21. kernel-headers \
  22. make \
  23. perl \
  24. python3 \
  25. unzip \
  26. wget \
  27. zip
  28. elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
  29. DEBIAN_FRONTEND=noninteractive
  30. DEBCONF_NONINTERACTIVE_SEEN=true
  31. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  32. sudo apt-get update
  33. sudo apt-get -yq install \
  34. build-essential \
  35. avr-libc \
  36. binutils-arm-none-eabi \
  37. binutils-avr \
  38. dfu-programmer \
  39. dfu-util \
  40. diffutils \
  41. gcc \
  42. gcc-arm-none-eabi \
  43. gcc-avr \
  44. git \
  45. libnewlib-arm-none-eabi \
  46. python3 \
  47. unzip \
  48. wget \
  49. zip
  50. elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
  51. # install avr-gcc 8.1 until 8.3 is available. See #3657 for details of the bug.
  52. sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.1.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. else
  149. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  150. echo
  151. echo "https://docs.qmk.fm/#/contributing"
  152. fi