build_linux.sh 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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" ]
  48. then
  49. sudo apt install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-470 -y
  50. fi
  51. if [ $Mode = "NVIDIARTX" ]
  52. then
  53. sudo apt install nvidia-cuda-toolkit nvidia-cuda-dev nvidia-driver-510 -y
  54. touch ~/.rtx
  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. #sudo rm /var/cache/apt/archives/*.deb
  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. cd ~/miners
  102. wget -c https://download.open-mpi.org/release/hwloc/v2.5/hwloc-2.5.0.tar.bz2
  103. tar xvfj hwloc-2.5.0.tar.bz2
  104. cd hwloc-2.5.0
  105. ./configure
  106. make -j$(nproc)
  107. sudo make install
  108. cd ..
  109. rm -r hwloc-2.5.0
  110. rm hwloc-2.5.0.tar.bz2
  111. cd xmrig
  112. cd build
  113. cmake ..
  114. make -j$(nproc)
  115. cd ~/miners
  116. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  117. then
  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. cd ~/miners
  124. cd xmrig-upx
  125. cd build
  126. cmake ..
  127. make -j$(nproc)
  128. cd ~/miners
  129. cd xmr-stak
  130. mkdir build
  131. cd build
  132. cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
  133. make -j$(nproc)
  134. cd ~/miners
  135. cd cpuminer-multi
  136. ./build.sh
  137. if [ $Mode = "AMD" ]
  138. then
  139. cd ~/miners/xmrig-amd
  140. mkdir build
  141. cd build
  142. cmake ..
  143. make -j$(nproc)
  144. cd ~
  145. tar xvfJ gpu-miners.tar.xz
  146. rm gpu-miners.tar.xz
  147. fi
  148. }
  149. function makesud_ {
  150. if ! sudo grep -q "wareck ALL=(ALL) NOPASSWD: ALL" /etc/sudoers
  151. then
  152. sudo cp /etc/sudoers /tmp/
  153. sudo chmod 777 /tmp/sudoers
  154. cat <<"EOF">> /tmp/sudoers
  155. wareck ALL=(ALL) NOPASSWD: ALL
  156. EOF
  157. sudo chmod 0644 /tmp/sudoers
  158. sudo cp /tmp/sudoers /etc/
  159. fi
  160. cat <<'EOF'>> wakeup_cube.sh
  161. sudo wakeonlan -i 192.168.1.100 D0:50:99:56:32:C8
  162. EOF
  163. chmod +x wakeup_cube.sh
  164. sudo mv wakeup_cube.sh /usr/local/bin
  165. }
  166. function liquidcontrol {
  167. if [ $Mode = "NVIDIAGTX" ] || [ $Mode = "NVIDIARTX" ]
  168. then
  169. sudo pip3 install liquidctl
  170. fi
  171. if [ $Mode = "NVIDIAGTX" ]
  172. then
  173. cat <<'EOF'>> liquidcfg.service
  174. [Unit]
  175. Description=AIO startup service
  176. [Service]
  177. Type=oneshot
  178. ExecStart=liquidctl initialize --match "smart device"
  179. ExecStart=liquidctl --match "smart device" set sync speed 55
  180. ExecStart=liquidctl --match "smart" set fan1 speed 90
  181. ExecStart=liquidctl --match "smart" set fan2 speed 90
  182. ExecStart=liquidctl --match "smart" set fan3 speed 90
  183. ExecStart=liquidctl --match "smart" set led color fixed eb0869
  184. [Install]
  185. WantedBy=default.target
  186. EOF
  187. sudo cp liquidcfg.service /etc/systemd/system/
  188. rm liquidcfg.service
  189. sudo systemctl daemon-reload
  190. sudo systemctl start liquidcfg
  191. sudo systemctl enable liquidcfg
  192. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperNvidia.jpg
  193. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  194. cat <<'EOF'>> zap
  195. #!/bin/bash
  196. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  197. EOF
  198. sed -i "s/XXX/$zip/g" zap
  199. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  200. cat <<'EOF'>> zap2
  201. [legacy/profiles:/:XXX]
  202. default-size-columns=110
  203. font='Monospace 9'
  204. use-system-font=false
  205. use-theme-colors=false
  206. background-color='rgb(0,0,0)'
  207. background-transparency-percent=9
  208. use-theme-transparency=false
  209. EOF
  210. sed -i "s/XXX/$UUID/g" zap2
  211. chmod +x zap
  212. sudo cp zap /usr/local/bin
  213. sudo cp zap2 /usr/local/bin
  214. sudo rm zap
  215. sudo rm zap2
  216. bash -c /usr/local/bin/zap
  217. fi
  218. if [ $Mode = "NVIDIARTX" ]
  219. then
  220. cat <<'EOF'>> liquidcfg.service
  221. [Unit]
  222. Description=AIO startup service
  223. [Service]
  224. Type=oneshot
  225. ExecStart=liquidctl initialize --match "smart device"
  226. ExecStart=liquidctl --match "smart device" set sync speed 55
  227. ExecStart=liquidctl --match "smart" set fan1 speed 90
  228. ExecStart=liquidctl --match "smart" set fan2 speed 90
  229. ExecStart=liquidctl --match "smart" set fan3 speed 90
  230. ExecStart=liquidctl --match "smart" set led color fixed 00AA00
  231. [Install]
  232. WantedBy=default.target
  233. EOF
  234. sudo cp liquidcfg.service /etc/systemd/system/
  235. rm liquidcfg.service
  236. sudo systemctl daemon-reload
  237. sudo systemctl start liquidcfg
  238. sudo systemctl enable liquidcfg
  239. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/875469.png
  240. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  241. cat <<'EOF'>> zap
  242. #!/bin/bash
  243. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  244. EOF
  245. sed -i "s/XXX/$zip/g" zap
  246. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  247. cat <<'EOF'>> zap2
  248. [legacy/profiles:/:XXX]
  249. default-size-columns=110
  250. font='Monospace 9'
  251. use-system-font=false
  252. use-theme-colors=false
  253. background-color='rgb(0,0,0)'
  254. background-transparency-percent=8
  255. EOF
  256. sed -i "s/XXX/$UUID/g" zap2
  257. chmod +x zap
  258. sudo cp zap /usr/local/bin
  259. sudo cp zap2 /usr/local/bin
  260. sudo rm zap
  261. sudo rm zap2
  262. bash -c /usr/local/bin/zap
  263. fi
  264. if [ $Mode = "AMD" ]
  265. then
  266. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperAMD.jpg
  267. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  268. cat <<'EOF'>> zap
  269. #!/bin/bash
  270. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  271. EOF
  272. sed -i "s/XXX/$zip/g" zap
  273. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  274. cat <<'EOF'>> zap2
  275. [legacy/profiles:/:XXX]
  276. default-size-columns=110
  277. font='Monospace 9'
  278. use-system-font=false
  279. use-theme-colors=false
  280. background-color='rgb(0,0,0)'
  281. background-transparency-percent=8
  282. EOF
  283. sed -i "s/XXX/$UUID/g" zap2
  284. chmod +x zap
  285. sudo cp zap /usr/local/bin
  286. sudo cp zap2 /usr/local/bin
  287. sudo rm zap
  288. sudo rm zap2
  289. bash -c /usr/local/bin/zap
  290. fi
  291. }
  292. function intro {
  293. clear
  294. print_centered "$(tput bold)$(tput setaf 6)"
  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 "██▄▪▐█▐█▄█▌▐█▌▐█▌▐▌██. ██ ▐█▄▄▌▐█•█▌"
  304. print_centered "·▀▀▀▀ ▀▀▀ ▀▀▀.▀▀▀ ▀▀▀▀▀• ▀▀▀ .▀ ▀"
  305. print_centered "$(tput setaf 7)$(tput bold)"
  306. #print_centered "Autoconfig Ubuntu pour le backup des Users"
  307. if [ $Mode = "NVIDIAGTX" ]
  308. then
  309. print_centered "NVIDIA-GTX + NZXT + windows 10"
  310. fi
  311. if [ $Mode = "NVIDIARTX" ]
  312. then
  313. print_centered "NVIDIA-RTX + NZXT + windows 10"
  314. fi
  315. if [ $Mode = "AMD" ]
  316. then
  317. print_centered "AMD RX580 + windows 10"
  318. fi
  319. echo "$(tput setaf 7)"
  320. sleep 3
  321. }
  322. function print_centered {
  323. [[ $# == 0 ]] && return 1
  324. declare -i TERM_COLS="$(tput cols)"
  325. declare -i str_len="${#1}"
  326. [[ $str_len -ge $TERM_COLS ]] && {
  327. echo "$1";
  328. return 0;
  329. }
  330. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  331. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  332. filler=""
  333. for (( i = 0; i < filler_len; i++ )); do
  334. filler="${filler}${ch}"
  335. done
  336. printf "%s%s%s" "$filler" "$1" "$filler"
  337. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  338. printf "\n"
  339. return 0
  340. }
  341. function password_hack {
  342. cd /home/wareck/
  343. git clone https://github.com/hashcat/hashcat.git
  344. cd /home/wareck/hashcat
  345. make -j$(nproc)
  346. cd /home/wareck/
  347. tar xvfJ hashcat.tar.xz
  348. rm /home/wareck/hashcat.tar.xz
  349. cd /home/wareck/
  350. echo -e ""
  351. git clone https://github.com/openwall/john.git
  352. cd /home/wareck/john
  353. sudo apt-get -y install git build-essential libssl-dev zlib1g-dev
  354. sudo apt-get -y install yasm pkg-config libgmp-dev libpcap-dev libbz2-dev clang
  355. cd /home/wareck/john/src
  356. ./configure
  357. make -s clean
  358. make -j$(nproc)
  359. }
  360. function outro {
  361. print_centered "$(tput setaf 3)$(tput bold)"
  362. print_centered "Système pret, reboot recommandé !"
  363. echo "$(tput setaf 7)"
  364. }
  365. choice
  366. intro
  367. update_one
  368. liquidcontrol
  369. sleep 1
  370. update_two
  371. makesud_
  372. build_miner
  373. password_hack
  374. outro