build_linux.sh 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. #!/bin/bash
  2. echo "linux config v2.1 wareck@gmail.com"
  3. echo ""
  4. PS3='Please enter your choice: '
  5. options=("NVIDIA-RTX" "NVIDIA-GTX" "AMD" "Quit")
  6. select opt in "${options[@]}"
  7. do
  8. case $opt in
  9. "NVIDIA-RTX")
  10. Mode="NVIDIARTX"
  11. break
  12. ;;
  13. "NVIDIA-GTX")
  14. Mode="NVIDIAGTX"
  15. break
  16. ;;
  17. "AMD")
  18. Mode="AMD"
  19. break
  20. ;;
  21. "Quit")
  22. break
  23. ;;
  24. *) echo "invalid option $REPLY";;
  25. esac
  26. done
  27. function update_one {
  28. sudo timedatectl set-local-rtc 1 --adjust-system-clock
  29. sudo apt-get update -y
  30. sudo apt-get upgrade -y
  31. sudo apt-get dist-upgrade -y
  32. sudo apt-get install htop python3-pip openssh-server screen wakeonlan -y
  33. cp miners.tar.xz /home/wareck/
  34. cp wallpaper.tar.xz /home/wareck/
  35. cp hashcat.tar.xz /home/wareck/
  36. cd /home/wareck/
  37. tar xvfJ wallpaper.tar.xz
  38. sudo rm wallpaper.tar.xz
  39. }
  40. function update_two {
  41. if [ $Mode = "NVIDIAGTX" ]
  42. then
  43. sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-470 -y
  44. fi
  45. if [ $Mode = "NVIDIARTX" ]
  46. then
  47. sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-510 -y
  48. fi
  49. sudo apt-get install samba cifs-utils mdadm git build-essential libtool pkg-config automake autoconf ethtool net-tools openvpn filezilla libuv1-dev libuvc-dev cmake git nmap -y
  50. sudo apt-get install gcc-8 g++-8 mesa-utils libmicrohttpd-dev libcurl4-openssl-dev lvm2 llvm-dev gparted msr-tools nasm btrfs-progs -y
  51. sudo apt-get install libssl-dev p7zip-full -y
  52. sudo apt autoremove -y
  53. if [ $Mode = "AMD" ]
  54. then
  55. cd ~/Téléchargements
  56. sudo dpkg --add-architecture i386
  57. sudo apt install wget gnupg2 -y
  58. sudo usermod -aG video $LOGNAME
  59. #wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
  60. echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
  61. sudo apt update
  62. sudo apt install rocm-smi-lib4.3.0 libnuma-dev -y
  63. #wget -c https://drivers.amd.com/drivers/linux/amdgpu-pro-20.40-1147287-ubuntu-18.04.tar.xz --referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-40
  64. #tar -Jxvf amdgpu-pro-20.40-1147287-ubuntu-18.04.tar.xz
  65. #cd amdgpu-pro-20.40-1147287-ubuntu-18.04
  66. #./amdgpu-pro-install -y --opencl=pal,legacy,rocm --headless -y
  67. sudo apt install build-essential cmake git libuv1-dev libssl-dev libhwloc-dev libmicrohttpd-dev lm-sensors htop opencl-amdgpu-pro-dev opencl-amdgpu-pro ocl-icd-opencl-dev clinfo -y
  68. fi
  69. }
  70. function build_miner {
  71. #gnome-terminal -- htop
  72. cd ~
  73. if [ ! -d miners ];then mkdir miners;fi
  74. cd ~/miners
  75. echo ""
  76. git clone https://github.com/tpruvot/ccminer.git && echo ""
  77. git clone https://github.com/tpruvot/cpuminer-multi.git && echo ""
  78. git clone https://github.com/xmrig/xmrig.git && echo ""
  79. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  80. then
  81. git clone https://github.com/xmrig/xmrig-nvidia.git && echo ""
  82. fi
  83. git clone https://github.com/uPlexa/xmrig-upx.git && echo ""
  84. git clone https://github.com/fireice-uk/xmr-stak.git && echo ""
  85. git clone https://github.com/fireice-uk/xmr-stak.git -b xmr-stak-rx xmr-stak-rx && echo ""
  86. if [ $Mode = "AMD" ]
  87. then
  88. git clone https://github.com/xmrig/xmrig-amd.git && echo ""
  89. fi
  90. cd ~
  91. tar xvfJ miners.tar.xz
  92. rm miners.tar.xz
  93. cd ~/miners
  94. wget -c https://download.open-mpi.org/release/hwloc/v2.5/hwloc-2.5.0.tar.bz2
  95. tar xvfj hwloc-2.5.0.tar.bz2
  96. cd hwloc-2.5.0
  97. ./configure
  98. make -j$(nproc)
  99. sudo make install
  100. cd ..
  101. rm -r hwloc-2.5.0
  102. rm hwloc-2.5.0.tar.bz2
  103. cd xmrig
  104. cd build
  105. cmake ..
  106. make -j$(nproc)
  107. cd ~/miners
  108. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  109. then
  110. cd xmrig-nvidia
  111. cd build
  112. cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
  113. make -j$(nproc)
  114. fi
  115. cd ~/miners
  116. cd xmrig-upx
  117. cd build
  118. cmake ..
  119. make -j$(nproc)
  120. cd ~/miners
  121. cd xmr-stak
  122. mkdir build
  123. cd build
  124. cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
  125. make -j$(nproc)
  126. cd ~/miners
  127. cd cpuminer-multi
  128. ./build.sh
  129. if [ $Mode = "AMD" ]
  130. then
  131. cd ~/miners/xmrig-amd
  132. mkdir build
  133. cd build
  134. cmake ..
  135. make -j$(nproc)
  136. cd ~
  137. fi
  138. }
  139. function makesud_ {
  140. if ! sudo grep -q "wareck ALL=(ALL) NOPASSWD: ALL" /etc/sudoers
  141. then
  142. sudo cp /etc/sudoers /tmp/
  143. sudo chmod 777 /tmp/sudoers
  144. cat <<"EOF">> /tmp/sudoers
  145. wareck ALL=(ALL) NOPASSWD: ALL
  146. EOF
  147. sudo chmod 0644 /tmp/sudoers
  148. sudo cp /tmp/sudoers /etc/
  149. fi
  150. cat <<'EOF'>> wakeup_cube.sh
  151. sudo wakeonlan -i 192.168.1.100 D0:50:99:56:32:C8
  152. EOF
  153. chmod +x wakeup_cube.sh
  154. sudo mv wakeup_cube.sh /usr/local/bin
  155. }
  156. function liquidcontrol {
  157. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  158. then
  159. pip3 install liquidctl
  160. fi
  161. if [ $Mode = "NVIDIAGTX" ]
  162. then
  163. cat <<'EOF'>> liquidcfg.service
  164. [Unit]
  165. Description=AIO startup service
  166. [Service]
  167. Type=oneshot
  168. ExecStart=liquidctl initialize --match "smart device"
  169. ExecStart=liquidctl --match "smart device" set sync speed 55
  170. ExecStart=liquidctl --match "smart" set fan1 speed 90
  171. ExecStart=liquidctl --match "smart" set fan2 speed 90
  172. ExecStart=liquidctl --match "smart" set fan3 speed 90
  173. ExecStart=liquidctl --match "smart" set led color fixed eb0869
  174. [Install]
  175. WantedBy=default.target
  176. EOF
  177. sudo cp liquidcfg.service /etc/systemd/system/
  178. rm liquidcfg.service
  179. sudo systemctl daemon-reload
  180. sudo systemctl start liquidcfg
  181. sudo systemctl enable liquidcfg
  182. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperNvidia.jpg
  183. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  184. fi
  185. if [ $Mode = "NVIDIARTX" ]
  186. then
  187. cat <<'EOF'>> liquidcfg.service
  188. [Unit]
  189. Description=AIO startup service
  190. [Service]
  191. Type=oneshot
  192. ExecStart=liquidctl initialize --match "smart device"
  193. ExecStart=liquidctl --match "smart device" set sync speed 55
  194. ExecStart=liquidctl --match "smart" set fan1 speed 90
  195. ExecStart=liquidctl --match "smart" set fan2 speed 90
  196. ExecStart=liquidctl --match "smart" set fan3 speed 90
  197. ExecStart=liquidctl --match "smart" set led color fixed f32a9e
  198. [Install]
  199. WantedBy=default.target
  200. EOF
  201. sudo cp liquidcfg.service /etc/systemd/system/
  202. rm liquidcfg.service
  203. sudo systemctl daemon-reload
  204. sudo systemctl start liquidcfg
  205. sudo systemctl enable liquidcfg
  206. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/875469.png
  207. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  208. fi
  209. if [ $Mode = "AMD" ]
  210. then
  211. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperAMD.jpg
  212. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  213. fi
  214. }
  215. function intro {
  216. clear
  217. print_centered "$(tput bold)$(tput setaf 6)"
  218. print_centered "▄▄▄▄· ▄▄▄· ▄▄· ▄ •▄ ▄• ▄▌ ▄▄▄· "
  219. print_centered "▐█ ▀█▪▐█ ▀█ ▐█ ▌▪█▌▄▌▪█▪██▌▐█ ▄█ "
  220. print_centered "▐█▀▀█▄▄█▀▀█ ██ ▄▄▐▀▀▄·█▌▐█▌ ██▀· "
  221. print_centered "██▄▪▐█▐█ ▪▐▌▐███▌▐█.█▌▐█▄█▌▐█▪·• "
  222. print_centered "·▀▀▀▀ ▀ ▀ ·▀▀▀ ·▀ ▀ ▀▀▀ .▀ "
  223. print_centered "▄▄▄▄· ▄• ▄▌▪ ▄▄▌ ·▄▄▄▄ ▄▄▄ .▄▄▄ "
  224. print_centered "▐█ ▀█▪█▪██▌██ ██• ██▪ ██ ▀▄.▀·▀▄ █·"
  225. print_centered "▐█▀▀█▄█▌▐█▌▐█·██▪ ▐█· ▐█▌▐▀▀▪▄▐▀▀▄ "
  226. print_centered "██▄▪▐█▐█▄█▌▐█▌▐█▌▐▌██. ██ ▐█▄▄▌▐█•█▌"
  227. print_centered "·▀▀▀▀ ▀▀▀ ▀▀▀.▀▀▀ ▀▀▀▀▀• ▀▀▀ .▀ ▀"
  228. print_centered "$(tput setaf 7)$(tput bold)"
  229. print_centered "Autoconfig Ubuntu pour le backup des Users"
  230. if [ $Mode = "NVIDIAGTX" ]
  231. then
  232. print_centered "NVIDIA-GTX + NZXT + windows 10"
  233. fi
  234. if [ $Mode = "NVIDIARTX" ]
  235. then
  236. print_centered "NVIDIA-RTX + NZXT + windows 10"
  237. fi
  238. if [ $Mode = "AMD" ]
  239. then
  240. print_centered "AMD RX580 + windows 10"
  241. fi
  242. echo "$(tput setaf 7)"
  243. sleep 4
  244. }
  245. function print_centered {
  246. [[ $# == 0 ]] && return 1
  247. declare -i TERM_COLS="$(tput cols)"
  248. declare -i str_len="${#1}"
  249. [[ $str_len -ge $TERM_COLS ]] && {
  250. echo "$1";
  251. return 0;
  252. }
  253. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  254. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  255. filler=""
  256. for (( i = 0; i < filler_len; i++ )); do
  257. filler="${filler}${ch}"
  258. done
  259. printf "%s%s%s" "$filler" "$1" "$filler"
  260. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  261. printf "\n"
  262. return 0
  263. }
  264. function password_hack {
  265. cd /home/wareck/
  266. git clone https://github.com/hashcat/hashcat.git
  267. cd /home/wareck/hashcat
  268. make -j$(nproc)
  269. cd /home/wareck/
  270. tar xvfJ hashcat.tar.xz
  271. rm /home/wareck/hashcat.tar.xz
  272. cd /home/wareck/
  273. echo -e ""
  274. git clone https://github.com/openwall/john.git
  275. cd john
  276. sudo apt-get -y install git build-essential libssl-dev zlib1g-dev
  277. sudo apt-get -y install yasm pkg-config libgmp-dev libpcap-dev libbz2-dev clang
  278. cd src
  279. ./configure
  280. make -s clean
  281. make -j$(nproc)
  282. }
  283. function outro {
  284. print_centered "$(tput setaf 3)$(tput bold)"
  285. print_centered "Système pret, reboot recommandé !"
  286. echo "$(tput setaf 7)"
  287. touch /home/wareck/.pass1
  288. }
  289. intro
  290. update_one
  291. liquidcontrol
  292. sleep 1
  293. update_two
  294. makesud_
  295. build_miner
  296. password_hack
  297. outro