build_linux.sh 11 KB

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