linux_install.sh 4.3 KB

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