build_linux.sh 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. #!/bin/bash
  2. function choice {
  3. echo -e "$(tput bold)$(tput setaf 11)Linux backup/miner config v3.1$(tput setaf 7)"
  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. exit
  23. break
  24. ;;
  25. *) echo "invalid option $REPLY";;
  26. esac
  27. done
  28. echo -e ""
  29. }
  30. function update_one {
  31. sudo timedatectl set-local-rtc 1 --adjust-system-clock
  32. sudo apt-get update -y
  33. sudo apt-get upgrade -y
  34. sudo apt-get dist-upgrade -y
  35. sudo apt-get install htop python3-pip openssh-server screen wakeonlan -y
  36. if [ -f "~/hashcat" ];then rm ~/hashcat;fi
  37. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/gpu-miners.tar.xz -O /home/wareck/gpu-miners.tar.xz
  38. wget -c -q --show-progress http://folivier.homelinux.org/bkpwinbuilder/pack/miners.tar.xz -O /home/wareck/miners.tar.xz
  39. wget -c -q --show-progress http://folivier.homelinux.org/bkpwinbuilder/pack/hashcat.tar.xz -O ~/hashcat.tar.xz
  40. wget -c -q --show-progress http://folivier.homelinux.org/bkpwinbuilder/pack/wallpaper.tar.xz -O ~/wallpaper.tar.xz
  41. cd ~/
  42. echo ""
  43. tar xvfJ wallpaper.tar.xz
  44. sudo rm wallpaper.tar.xz
  45. echo -n ""
  46. }
  47. function update_two {
  48. if [ $Mode = "NVIDIAGTX" ]
  49. then
  50. sudo apt install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-470 -y
  51. fi
  52. if [ $Mode = "NVIDIARTX" ]
  53. then
  54. sudo apt install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-510 -y
  55. touch ~/.rtx
  56. fi
  57. if [ $Mode = "AMD" ]
  58. then
  59. cd /home/wareck
  60. echo -e ""
  61. echo -e "Install drivers:"
  62. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/amdgpu-install_22.10.2.50102-1_all.deb -O /home/wareck/Build_Cube/pack/amdgpu-install_22.10.2.50102-1_all.deb
  63. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/linux-firmware.tar.xz
  64. tar xvfJ linux-firmware.tar.xz
  65. sudo cp /home/wareck/linux-firmware/amdgpu/* /lib/firmware/amdgpu/
  66. sudo rm -r -f /home/wareck/linux-firmware /home/wareck/linux-firmware.tar.xz
  67. sudo apt-get install /home/wareck/Build_Cube/pack/amdgpu-install_22.10.2.50102-1_all.deb -y
  68. sudo apt-get update
  69. sudo amdgpu-install --opencl=legacy --accept-eula -y
  70. sudo apt install ocl-icd-opencl-dev -y
  71. sudo apt install build-essential cmake git libuv1-dev libssl-dev libhwloc-dev libmicrohttpd-dev lm-sensors htop clinfo -y
  72. fi
  73. sudo apt 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
  74. sudo apt install gcc-8 g++-8 mesa-utils libmicrohttpd-dev libcurl4-openssl-dev lvm2 llvm-dev gparted msr-tools nasm btrfs-progs -y
  75. sudo apt install libssl-dev p7zip-full -y
  76. sudo apt autoremove -y
  77. }
  78. function build_miner {
  79. #gnome-terminal -- htop
  80. cd ~
  81. if [ ! -d miners ];then mkdir miners;fi
  82. cd ~/miners
  83. echo ""
  84. git clone https://github.com/tpruvot/ccminer.git && echo ""
  85. git clone https://github.com/tpruvot/cpuminer-multi.git && echo ""
  86. git clone https://github.com/xmrig/xmrig.git && echo ""
  87. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  88. then
  89. git clone https://github.com/xmrig/xmrig-nvidia.git && echo ""
  90. fi
  91. git clone https://github.com/uPlexa/xmrig-upx.git && echo ""
  92. git clone https://github.com/fireice-uk/xmr-stak.git && echo ""
  93. git clone https://github.com/fireice-uk/xmr-stak.git -b xmr-stak-rx xmr-stak-rx && echo ""
  94. if [ $Mode = "AMD" ]
  95. then
  96. git clone https://github.com/xmrig/xmrig-amd.git && echo ""
  97. fi
  98. cd ~
  99. tar xvfJ miners.tar.xz
  100. rm miners.tar.xz
  101. if ! grep -q "modded" /usr/include/CL/cl_version.h
  102. then
  103. sudo cp /usr/include/CL/cl_version.h /home/wareck/
  104. echo "/*modded*/" > cl_version_m.h
  105. echo "#define CL_TARGET_OPENCL_VERSION 220" >> cl_version_m.h
  106. cat cl_version.h >>cl_version_m.h
  107. rm cl_version.h
  108. mv cl_version_m.h cl_version.h
  109. sudo cp /home/wareck/cl_version.h /usr/include/CL/cl_version.h
  110. fi
  111. cd ~/miners
  112. wget -c https://download.open-mpi.org/release/hwloc/v2.8/hwloc-2.8.0.tar.bz2
  113. tar xvfj hwloc-2.8.0.tar.bz2
  114. cd hwloc-2.8.0
  115. ./configure
  116. make -j$(nproc)
  117. sudo make install
  118. sudo ldconfig
  119. cd ..
  120. rm -r hwloc-2.8.0
  121. rm hwloc-2.8.0.tar.bz2
  122. echo ""
  123. cd xmrig
  124. cd build
  125. cmake ..
  126. make -j$(nproc)
  127. cd ~/miners
  128. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  129. then
  130. echo ""
  131. cd xmrig-nvidia
  132. cd build
  133. cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
  134. make -j$(nproc)
  135. fi
  136. echo ""
  137. cd ~/miners
  138. cd xmrig-upx
  139. cd build
  140. cmake ..
  141. make -j$(nproc)
  142. echo ""
  143. cd ~/miners
  144. cd xmr-stak
  145. mkdir build
  146. cd build
  147. cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
  148. make -j$(nproc)
  149. echo ""
  150. cd ~/miners
  151. cd cpuminer-multi
  152. ./build.sh
  153. if [ $Mode = "AMD" ]
  154. then
  155. cd ~/miners/xmrig-amd
  156. mkdir build
  157. cd build
  158. cmake ..
  159. make -j$(nproc)
  160. cd ~
  161. tar xvfJ gpu-miners.tar.xz
  162. rm gpu-miners.tar.xz
  163. fi
  164. }
  165. function makesud_ {
  166. if ! sudo grep -q "wareck ALL=(ALL) NOPASSWD: ALL" /etc/sudoers
  167. then
  168. sudo cp /etc/sudoers /tmp/
  169. sudo chmod 777 /tmp/sudoers
  170. cat <<"EOF">> /tmp/sudoers
  171. wareck ALL=(ALL) NOPASSWD: ALL
  172. EOF
  173. sudo chmod 0644 /tmp/sudoers
  174. sudo cp /tmp/sudoers /etc/
  175. fi
  176. cat <<'EOF'>> wakeup_cube.sh
  177. sudo wakeonlan -i 192.168.1.100 D0:50:99:56:32:C8
  178. EOF
  179. chmod +x wakeup_cube.sh
  180. sudo mv wakeup_cube.sh /usr/local/bin
  181. }
  182. function liquidcontrol {
  183. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  184. then
  185. sudo pip3 install liquidctl
  186. fi
  187. if [ $Mode = "NVIDIAGTX" ]
  188. then
  189. cat <<'EOF'>> liquidcfg.service
  190. [Unit]
  191. Description=AIO startup service
  192. [Service]
  193. Type=oneshot
  194. ExecStart=liquidctl initialize --match "smart device"
  195. ExecStart=liquidctl --match "smart device" set sync speed 55
  196. ExecStart=liquidctl --match "smart" set fan1 speed 90
  197. ExecStart=liquidctl --match "smart" set fan2 speed 90
  198. ExecStart=liquidctl --match "smart" set fan3 speed 90
  199. ExecStart=liquidctl --match "smart" set led color fixed eb0869
  200. [Install]
  201. WantedBy=default.target
  202. EOF
  203. sudo cp liquidcfg.service /etc/systemd/system/
  204. rm liquidcfg.service
  205. sudo systemctl daemon-reload
  206. sudo systemctl start liquidcfg
  207. sudo systemctl enable liquidcfg
  208. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperNvidia.jpg
  209. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  210. cat <<'EOF'>> zap
  211. #!/bin/bash
  212. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  213. EOF
  214. sed -i "s/XXX/$zip/g" zap
  215. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  216. cat <<'EOF'>> zap2
  217. [legacy/profiles:/:XXX]
  218. default-size-columns=110
  219. font='Monospace 9'
  220. use-system-font=false
  221. use-theme-colors=false
  222. background-color='rgb(0,0,0)'
  223. background-transparency-percent=9
  224. use-theme-transparency=false
  225. EOF
  226. sed -i "s/XXX/$UUID/g" zap2
  227. chmod +x zap
  228. sudo cp zap /usr/local/bin
  229. sudo cp zap2 /usr/local/bin
  230. sudo rm zap
  231. sudo rm zap2
  232. bash -c /usr/local/bin/zap
  233. fi
  234. if [ $Mode = "NVIDIARTX" ]
  235. then
  236. cat <<'EOF'>> liquidcfg.service
  237. [Unit]
  238. Description=AIO startup service
  239. [Service]
  240. Type=oneshot
  241. ExecStart=liquidctl initialize --match "smart device"
  242. ExecStart=liquidctl --match "smart device" set sync speed 55
  243. ExecStart=liquidctl --match "smart" set fan1 speed 90
  244. ExecStart=liquidctl --match "smart" set fan2 speed 90
  245. ExecStart=liquidctl --match "smart" set fan3 speed 90
  246. ExecStart=liquidctl --match "smart" set led color fixed 00AA00
  247. [Install]
  248. WantedBy=default.target
  249. EOF
  250. sudo cp liquidcfg.service /etc/systemd/system/
  251. rm liquidcfg.service
  252. sudo systemctl daemon-reload
  253. sudo systemctl start liquidcfg
  254. sudo systemctl enable liquidcfg
  255. #gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/875469.png
  256. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/Evolve.png
  257. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  258. cat <<'EOF'>> zap
  259. #!/bin/bash
  260. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  261. EOF
  262. sed -i "s/XXX/$zip/g" zap
  263. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  264. cat <<'EOF'>> zap2
  265. [legacy/profiles:/:XXX]
  266. #background-color='rgb(32,36,37)'
  267. background-color='rgb(0,0,0)'
  268. background-transparency-percent=7
  269. default-size-columns=110
  270. font='Monospace 9'
  271. foreground-color='rgb(211,215,207)'
  272. use-system-font=false
  273. use-theme-colors=false
  274. use-theme-transparency=false
  275. use-transparent-background=true
  276. EOF
  277. sed -i "s/XXX/$UUID/g" zap2
  278. chmod +x zap
  279. sudo cp zap /usr/local/bin
  280. sudo cp zap2 /usr/local/bin
  281. sudo rm zap
  282. sudo rm zap2
  283. bash -c /usr/local/bin/zap
  284. fi
  285. if [ $Mode = "AMD" ]
  286. then
  287. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperAMD.jpg
  288. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  289. cat <<'EOF'>> zap
  290. #!/bin/bash
  291. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  292. EOF
  293. sed -i "s/XXX/$zip/g" zap
  294. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  295. cat <<'EOF'>> zap2
  296. [legacy/profiles:/:XXX]
  297. default-size-columns=110
  298. font='Monospace 9'
  299. use-system-font=false
  300. use-theme-colors=false
  301. background-color='rgb(0,0,0)'
  302. background-transparency-percent=8
  303. EOF
  304. sed -i "s/XXX/$UUID/g" zap2
  305. chmod +x zap
  306. sudo cp zap /usr/local/bin
  307. sudo cp zap2 /usr/local/bin
  308. sudo rm zap
  309. sudo rm zap2
  310. bash -c /usr/local/bin/zap
  311. fi
  312. }
  313. function intro {
  314. clear
  315. print_centered "$(tput bold)$(tput setaf 6)"
  316. print_centered "▄▄▄▄· ▄▄▄· ▄▄· ▄ •▄ ▄• ▄▌ ▄▄▄· "
  317. print_centered "▐█ ▀█▪▐█ ▀█ ▐█ ▌▪█▌▄▌▪█▪██▌▐█ ▄█ "
  318. print_centered "▐█▀▀█▄▄█▀▀█ ██ ▄▄▐▀▀▄·█▌▐█▌ ██▀· "
  319. print_centered "██▄▪▐█▐█ ▪▐▌▐███▌▐█.█▌▐█▄█▌▐█▪·• "
  320. print_centered "·▀▀▀▀ ▀ ▀ ·▀▀▀ ·▀ ▀ ▀▀▀ .▀ "
  321. print_centered "▄▄▄▄· ▄• ▄▌▪ ▄▄▌ ·▄▄▄▄ ▄▄▄ .▄▄▄ "
  322. print_centered "▐█ ▀█▪█▪██▌██ ██• ██▪ ██ ▀▄.▀·▀▄ █·"
  323. print_centered "▐█▀▀█▄█▌▐█▌▐█·██▪ ▐█· ▐█▌▐▀▀▪▄▐▀▀▄ "
  324. print_centered "██▄▪▐█▐█▄█▌▐█▌▐█▌▐▌██. ██ ▐█▄▄▌▐█•█▌"
  325. print_centered "·▀▀▀▀ ▀▀▀ ▀▀▀.▀▀▀ ▀▀▀▀▀• ▀▀▀ .▀ ▀"
  326. print_centered "$(tput setaf 7)$(tput bold)"
  327. #print_centered "Autoconfig Ubuntu pour le backup des Users"
  328. if [ $Mode = "NVIDIAGTX" ]
  329. then
  330. print_centered "NVIDIA-GTX + NZXT + windows 10"
  331. fi
  332. if [ $Mode = "NVIDIARTX" ]
  333. then
  334. print_centered "NVIDIA-RTX + NZXT + windows 10"
  335. fi
  336. if [ $Mode = "AMD" ]
  337. then
  338. print_centered "AMD RX580 + windows 10"
  339. fi
  340. echo "$(tput setaf 7)"
  341. sleep 3
  342. }
  343. function print_centered {
  344. [[ $# == 0 ]] && return 1
  345. declare -i TERM_COLS="$(tput cols)"
  346. declare -i str_len="${#1}"
  347. [[ $str_len -ge $TERM_COLS ]] && {
  348. echo "$1";
  349. return 0;
  350. }
  351. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  352. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  353. filler=""
  354. for (( i = 0; i < filler_len; i++ )); do
  355. filler="${filler}${ch}"
  356. done
  357. printf "%s%s%s" "$filler" "$1" "$filler"
  358. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  359. printf "\n"
  360. return 0
  361. }
  362. function password_hack {
  363. cd /home/wareck/
  364. git clone https://github.com/hashcat/hashcat.git
  365. cd /home/wareck/hashcat
  366. make -j$(nproc)
  367. cd /home/wareck/
  368. tar xvfJ hashcat.tar.xz
  369. rm /home/wareck/hashcat.tar.xz
  370. cd /home/wareck/
  371. echo -e ""
  372. git clone https://github.com/openwall/john.git
  373. cd /home/wareck/john
  374. sudo apt-get -y install git build-essential libssl-dev zlib1g-dev
  375. sudo apt-get -y install yasm pkg-config libgmp-dev libpcap-dev libbz2-dev clang
  376. cd /home/wareck/john/src
  377. ./configure
  378. make -s clean
  379. make -j$(nproc)
  380. echo ""
  381. }
  382. function outro {
  383. if [ -f "/home/wareck/gpu-miners.tar.xz" ];then rm /home/wareck/gpu-miners.tar.xz;fi
  384. if [ -f "/home/wareck/miners.tar.xz" ];then rm /home/wareck/miners.tar.xz;fi
  385. if [ -f "/home/wareck/hashcat.tar.xz" ];then rm /home/wareck/hashcat.tar.xz;fi
  386. clear
  387. sudo rm /home/wareck/cl_version.h
  388. print_centered "$(tput setaf 3)$(tput bold)"
  389. print_centered "Système pret, reboot recommandé !"
  390. echo "$(tput setaf 7)"
  391. }
  392. choice
  393. intro
  394. update_one
  395. liquidcontrol
  396. update_two
  397. makesud_
  398. build_miner
  399. password_hack
  400. outro