build_linux.sh 11 KB

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