build_linux.sh 9.4 KB

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