build_linux.sh 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. background-transparency-percent=8
  198. EOF
  199. sed -i "s/XXX/$UUID/g" zap2
  200. chmod +x zap
  201. sudo cp zap /usr/local/bin
  202. sudo cp zap2 /usr/local/bin
  203. sudo rm zap
  204. sudo rm zap2
  205. bash -c /usr/local/bin/zap
  206. fi
  207. if [ $Mode = "NVIDIARTX" ]
  208. then
  209. cat <<'EOF'>> liquidcfg.service
  210. [Unit]
  211. Description=AIO startup service
  212. [Service]
  213. Type=oneshot
  214. ExecStart=liquidctl initialize --match "smart device"
  215. ExecStart=liquidctl --match "smart device" set sync speed 55
  216. ExecStart=liquidctl --match "smart" set fan1 speed 90
  217. ExecStart=liquidctl --match "smart" set fan2 speed 90
  218. ExecStart=liquidctl --match "smart" set fan3 speed 90
  219. ExecStart=liquidctl --match "smart" set led color fixed f32a9e
  220. [Install]
  221. WantedBy=default.target
  222. EOF
  223. sudo cp liquidcfg.service /etc/systemd/system/
  224. rm liquidcfg.service
  225. sudo systemctl daemon-reload
  226. sudo systemctl start liquidcfg
  227. sudo systemctl enable liquidcfg
  228. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/875469.png
  229. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  230. fi
  231. if [ $Mode = "AMD" ]
  232. then
  233. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/wallpaperAMD.jpg
  234. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  235. fi
  236. }
  237. function intro {
  238. clear
  239. print_centered "$(tput bold)$(tput setaf 6)"
  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 "·▀▀▀▀ ▀▀▀ ▀▀▀.▀▀▀ ▀▀▀▀▀• ▀▀▀ .▀ ▀"
  250. print_centered "$(tput setaf 7)$(tput bold)"
  251. print_centered "Autoconfig Ubuntu pour le backup des Users"
  252. if [ $Mode = "NVIDIAGTX" ]
  253. then
  254. print_centered "NVIDIA-GTX + NZXT + windows 10"
  255. fi
  256. if [ $Mode = "NVIDIARTX" ]
  257. then
  258. print_centered "NVIDIA-RTX + NZXT + windows 10"
  259. fi
  260. if [ $Mode = "AMD" ]
  261. then
  262. print_centered "AMD RX580 + windows 10"
  263. fi
  264. echo "$(tput setaf 7)"
  265. sleep 4
  266. }
  267. function print_centered {
  268. [[ $# == 0 ]] && return 1
  269. declare -i TERM_COLS="$(tput cols)"
  270. declare -i str_len="${#1}"
  271. [[ $str_len -ge $TERM_COLS ]] && {
  272. echo "$1";
  273. return 0;
  274. }
  275. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  276. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  277. filler=""
  278. for (( i = 0; i < filler_len; i++ )); do
  279. filler="${filler}${ch}"
  280. done
  281. printf "%s%s%s" "$filler" "$1" "$filler"
  282. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  283. printf "\n"
  284. return 0
  285. }
  286. function password_hack {
  287. cd /home/wareck/
  288. git clone https://github.com/hashcat/hashcat.git
  289. cd /home/wareck/hashcat
  290. make -j$(nproc)
  291. cd /home/wareck/
  292. tar xvfJ hashcat.tar.xz
  293. rm /home/wareck/hashcat.tar.xz
  294. cd /home/wareck/
  295. echo -e ""
  296. git clone https://github.com/openwall/john.git
  297. cd john
  298. sudo apt-get -y install git build-essential libssl-dev zlib1g-dev
  299. sudo apt-get -y install yasm pkg-config libgmp-dev libpcap-dev libbz2-dev clang
  300. cd src
  301. ./configure
  302. make -s clean
  303. make -j$(nproc)
  304. }
  305. function outro {
  306. print_centered "$(tput setaf 3)$(tput bold)"
  307. print_centered "Système pret, reboot recommandé !"
  308. echo "$(tput setaf 7)"
  309. touch /home/wareck/.pass1
  310. }
  311. intro
  312. update_one
  313. liquidcontrol
  314. sleep 1
  315. update_two
  316. makesud_
  317. build_miner
  318. password_hack
  319. outro