build_linux.sh 12 KB

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