build_linux.sh 11 KB

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