jupiter.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. #!/bin/bash
  2. set -e
  3. Version=18.4.2
  4. Cuda=YES
  5. kernel_custom=YES
  6. Miners=Yes
  7. driver=NVIDIA
  8. if (( $EUID != 0 )); then
  9. echo -e "$(tput setaf 11)This must be run as root. Try 'sudo $0'.$(tput sgr0)"
  10. exit 1
  11. fi
  12. clear
  13. if [ ! -f /home/wareck/.ipass ]
  14. then
  15. echo "passe=1" > /home/wareck/.ipass
  16. fi
  17. source /home/wareck/.ipass
  18. export TERM=xterm-256color
  19. Cuda=${Cuda^^}
  20. kernel_custom=${kernel_custom^^}
  21. driver=${driver^^}
  22. Miners=${Miners^^}
  23. cpass=""
  24. function ubuntu_version_check {
  25. if [[ $(lsb_release -rs) == "20.04" ]]
  26. then
  27. Ubuntu_version="20.04.6"
  28. else
  29. echo "Non-compatible version !"
  30. exit 0
  31. fi
  32. }
  33. function print_centered {
  34. [[ $# == 0 ]] && return 1
  35. declare -i TERM_COLS="$(tput cols)"
  36. declare -i str_len="${#1}"
  37. [[ $str_len -ge $TERM_COLS ]] && {
  38. echo "$1";
  39. return 0;
  40. }
  41. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  42. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  43. filler=""
  44. for (( i = 0; i < filler_len; i++ )); do
  45. filler="${filler}${ch}"
  46. done
  47. printf "%s%s%s" "$filler" "$1" "$filler"
  48. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  49. printf "\n"
  50. return 0
  51. }
  52. function decompte_ {
  53. echo -e "$(tput setaf 10)\nReboot in 10 seconds (CRTL+C to abord):$(tput sgr0)"
  54. for i in {9..0}
  55. do
  56. echo -e -n "$i "
  57. sleep 1
  58. done
  59. echo ""
  60. sudo reboot
  61. }
  62. function intro_ {
  63. print_centered "$(tput setaf 1)"
  64. print_centered " ██╗██╗ ██╗██████╗ ██╗████████╗███████╗██████╗ "
  65. print_centered " ██║██║ ██║██╔══██╗██║╚══██╔══╝██╔════╝██╔══██╗"
  66. print_centered " ██║██║ ██║██████╔╝██║ ██║ █████╗ ██████╔╝"
  67. print_centered "██ ██║██║ ██║██╔═══╝ ██║ ██║ ██╔══╝ ██╔══██╗"
  68. print_centered "╚█████╔╝╚██████╔╝██║ ██║ ██║ ███████╗██║ ██║"
  69. print_centered " ╚════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝"
  70. print_centered " "
  71. echo -n "$(tput sgr0)"
  72. print_centered "Jupiter Server script v$Version"
  73. print_centered "Ubuntu version 20.04.6"
  74. if [ $Cuda = "YES" ]
  75. then
  76. print_centered "CUDA Compute Drivers"
  77. fi
  78. print_centered "Stage $passe/4"
  79. }
  80. function update_ {
  81. case $passe in
  82. 1)
  83. echo -e "$(tput setaf 10)\nUpdate and install packages (second pass):$(tput sgr0)"
  84. sudo apt-get update
  85. echo -e ""
  86. sudo apt-get install cifs-utils mdadm git build-essential libtool pkg-config automake autoconf ethtool net-tools \
  87. tasksel lzma-dev lzma cmake libuv1-dev libssl-dev openssh-server xfsprogs htop -y
  88. echo -e ""
  89. sudo apt-get install zstd pixz pbzip2 pigz btrfs-progs gparted gpart gnome-remote-desktop libcanberra-gtk-module \
  90. bison byacc screen curl nvme-cli -y
  91. echo -e ""
  92. sudo apt-get install libglib2.0-dev locate cmake glances -y
  93. echo -e "Done."
  94. ;;
  95. 2)
  96. if [ $Cuda = "YES" ]
  97. then
  98. echo -e "$(tput setaf 10)\nInstall Cuda packages:$(tput sgr0)"
  99. sudo apt-get install libgmp-dev libnuma-dev cmake libuv1-dev nvidia-cuda-dev libmicrohttpd-dev gcc-8 g++-8 nvidia-cuda-toolkit -y
  100. fi
  101. echo -e "Done.\n"
  102. ;;
  103. esac
  104. }
  105. function kernel_check_ {
  106. unamestr=$(uname -r)
  107. if ! [[ "$unamestr" == "5.15.159-jupiter" ]]
  108. then
  109. echo -e "\n$(tput setaf 10)Custom kernel install 5.15.159-jupiter:$(tput sgr0)"
  110. cd /tmp/
  111. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/custom_kernel/kernel_5.15.159-jupiter.run
  112. chmod +x kernel_5.15.159-jupiter.run
  113. sudo ./kernel_5.15.159-jupiter.run
  114. if ! [ -f /etc/modprobe.d/blacklist-nvidia-nouveau.conf ]
  115. then
  116. echo "Blacklist nvidia-nouveau driver..."
  117. echo "System will reboot"
  118. sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
  119. sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
  120. fi
  121. fi
  122. }
  123. function nvidia_driver_ {
  124. if [ $passe = "1" ]
  125. then
  126. if ! [ -f /etc/modprobe.d/blacklist-nvidia-nouveau.conf ]
  127. then
  128. echo "Blacklist nvidia-nouveau driver..."
  129. echo "System will reboot"
  130. sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
  131. sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
  132. fi
  133. if [ $Cuda = "NO" ]
  134. then
  135. sudo apt-get install build-essential libglvnd-dev cmake -y
  136. else
  137. sudo apt-get install build-essential libglvnd-dev cmake libhugetlbfs-dev libc-dev libc6-dev g++ -y
  138. fi
  139. echo "passe=2" > /home/wareck/.ipass
  140. decompte_
  141. fi
  142. if [ $passe = "2" ]
  143. then
  144. case $Cuda in
  145. NO)
  146. echo -e "$(tput setaf 10)\nInstall NVIDIA GTX1080 Drivers :$(tput sgr0)"
  147. sleep 3
  148. sudo apt-get install nvidia-driver-525 -y
  149. touch /home/wareck/.pass2
  150. decompte_
  151. ;;
  152. YES)
  153. echo -e "$(tput setaf 10)\nInstall CUDA Drivers :$(tput sgr0)"
  154. cd /home/wareck/
  155. echo -e "Download MegaDownload:"
  156. git clone https://github.com/wareck/megadown.git
  157. sudo cp /home/wareck/megadown/megadown /usr/local/bin/megadown
  158. sudo rm -r /home/wareck/megadown
  159. wget -c https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run
  160. chmod +x cuda_12.4.1_550.54.15_linux.run
  161. sudo ./cuda_12.4.1_550.54.15_linux.run --silent --driver --toolkit
  162. sudo rm cuda_12.4.1_550.54.15_linux.run
  163. echo "passe=3" > /home/wareck/.ipass
  164. decompte_
  165. ;;
  166. esac
  167. fi
  168. }
  169. function download_packs_ {
  170. echo -e "$(tput setaf 10)\nDownload complement packs:$(tput sgr0)"
  171. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz -O /home/wareck/Build_Cube/pack/chia-miner.tar.xz
  172. #wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/$Webmin.tar.xz -O /home/wareck/Build_Cube/pack/$Webmin.tar.xz
  173. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/xmrig.tar.xz -O /home/wareck/Build_Cube/pack/xmrig.tar.xz
  174. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/gpu-miners.tar.xz -O /home/wareck/Build_Cube/pack/gpu-miners.tar.xz
  175. cp /home/wareck/Build_Cube/pack/gpu-miners.tar.xz /home/wareck
  176. cp /home/wareck/Build_Cube/pack/pack1.tar.xz /home/wareck
  177. cp /home/wareck/Build_Cube/pack/pack2.tar.xz /home/wareck
  178. cp /home/wareck/Build_Cube/pack/pack3.tar.xz /home/wareck
  179. cp /home/wareck/Build_Cube/pack/xmrig.tar.xz /home/wareck
  180. echo -e "Done."
  181. echo -e "$(tput setaf 10)\nDownloading miners:$(tput sgr0)"
  182. cd /home/wareck
  183. if ! [ -d miners ]; then mkdir -p miners;fi
  184. cd /home/wareck/miners
  185. if ! [ -d xmrig ]
  186. then
  187. git clone https://github.com/xmrig/xmrig.git
  188. echo -e ""
  189. fi
  190. echo -e "Done.\n"
  191. }
  192. function build_miners_ {
  193. cmake_ #check cmake version
  194. cd /home/wareck
  195. tar xfJ gpu-miners.tar.xz
  196. cd /home/wareck/miners
  197. echo -e "$(tput setaf 10)\nUncompress xmr files:$(tput sgr0)"
  198. tar xfJ /home/wareck/xmrig.tar.xz --checkpoint=.100
  199. echo "Done."
  200. echo -n -e "\n"
  201. echo -e "$(tput setaf 10)\nBuild xmrig:$(tput sgr0)"
  202. cd xmrig
  203. git config --global --add safe.directory /home/wareck/miners/xmrig
  204. git pull
  205. sed -i "s/kDefaultDonateLevel = 5;/kDefaultDonateLevel = 0;/g" src/donate.h
  206. sed -i "s/kMinimumDonateLevel = 1;/kMinimumDonateLevel = 0;/g" src/donate.h
  207. cd scripts
  208. ./build_deps.sh
  209. cd ..
  210. cd build
  211. cmake .. -DXMRIG_DEPS=scripts/deps
  212. make -j$((`nproc`))
  213. cd ..
  214. echo "Done."
  215. #Reduce mode
  216. if [ -d /home/wareck/miners/xmrig-upx ];then rm -r /home/wareck/miners/xmrig-upx;fi
  217. if [ -d /home/wareck/miners/xmr-stak ];then rm -r /home/wareck/miners/xmr-stak;fi
  218. if [ -d /home/wareck/miners/xmr-stak-rx ];then rm -r /home/wareck/miners/xmr-stak-rx;fi
  219. sudo chmod -R 775 /home/wareck/miners
  220. }
  221. function configure_ {
  222. echo -e "$(tput setaf 10)\nConfig files:$(tput sgr0)"
  223. cd /home/wareck/
  224. zip="['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop']"
  225. cat <<'EOF'>> zap
  226. #!/bin/bash
  227. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  228. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/mad-max-wallpapers.jpg
  229. gsettings set org.gnome.shell favorite-apps "XXX"
  230. #su wareck -c 'gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts false'
  231. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  232. EOF
  233. sed -i "s/XXX/$zip/g" zap
  234. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  235. cat <<'EOF'>> zap2
  236. [legacy/profiles:/:XXX]
  237. background-transparency-percent=7
  238. font='Monospace 8'
  239. use-system-font=false
  240. use-theme-colors=false
  241. use-theme-transparency=false
  242. use-transparent-background=true
  243. background-transparency-percent=7
  244. default-size-columns=110
  245. EOF
  246. sed -i "s/XXX/$UUID/g" zap2
  247. chmod +x zap
  248. sudo cp zap /usr/local/bin
  249. sudo cp zap2 /usr/local/bin
  250. sudo rm zap
  251. sudo rm zap2
  252. sleep 1
  253. sudo rm -r -f /etc/update-motd.d/*
  254. tar xfJ pack1.tar.xz --checkpoint=.10
  255. echo -n -e "\n"
  256. sudo cp /home/wareck/pack2.tar.xz /
  257. sudo cp /home/wareck/pack3.tar.xz /
  258. cd /
  259. sudo tar xfJ pack2.tar.xz --checkpoint=.10
  260. sudo tar xfJ pack3.tar.xz --checkpoint=.10
  261. echo -n -e "\n"
  262. cd /home/wareck
  263. sudo sed -i -e "s/# set constantshow/set constantshow/g" /etc/nanorc
  264. if ! grep "wareck" /etc/sudoers >/dev/null
  265. then
  266. sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
  267. fi
  268. echo -e "$(tput setaf 10)\nBuild folder and mount drives:$(tput sgr0)"
  269. if ! [ -r /raid ]
  270. then
  271. sudo mkdir /raid
  272. fi
  273. if ! grep "#/swapfile" /etc/fstab >/dev/null
  274. then
  275. cp /etc/fstab /tmp/fstab
  276. sed -i '/ swap / s/^\(.*\)$/#\1/g' /tmp/fstab
  277. sudo cp /tmp/fstab /etc/fstab
  278. fi
  279. sudo rm /etc/hosts
  280. sudo cat <<'EOF'>> /etc/hosts
  281. 127.0.0.1 localhost
  282. 127.0.1.1 Jupiter
  283. 192.168.1.8 miniserver miniserver gogserver.dnsalias.com
  284. 192.168.1.10 nzxt
  285. 192.168.1.11 garage
  286. 192.168.1.100 cube
  287. 192.168.1.254 mafreebox.freebox.fr
  288. 192.168.1.200 node
  289. # The following lines are desirable for IPv6 capable hosts
  290. ::1 ip6-localhost ip6-loopback
  291. fe00::0 ip6-localnet
  292. ff00::0 ip6-mcastprefix
  293. ff02::1 ip6-allnodes
  294. ff02::2 ip6-allrouters
  295. EOF
  296. echo "Done."
  297. echo -e "$(tput setaf 10)\nW.O.L drivers:$(tput sgr0)"
  298. sudo apt install ethtool -y
  299. iface=$(ip link | awk -F: '$0 !~ "lo|vir|^[^0-9]"{printf $2a}' | cut -d ' ' -f2)
  300. sudo ethtool --change $iface wol g
  301. cat <<'EOF'>> /tmp/wakemeup.sh
  302. #!/bin/bash
  303. set -e
  304. if ! [ -x "$(command -v etherwake)" ];then sudo apt-get install etherwake -y;fi
  305. clear
  306. echo -e "$(tput setaf 10)Wake On Lan v1.0:$(tput sgr0)"
  307. PS3="Select : "
  308. items=("Nzxt" "Garage" "Cube")
  309. select item in "${items[@]}" Quit
  310. do
  311. case $REPLY in
  312. 1) sudo etherwake -i enp5s0 98:03:CF:07:31:72 ; break;;
  313. 2) sudo etherwake -i enp5s0 58:11:22:CD:FC:7A ; break;;
  314. 3) sudo etherwake -i enp5s0 94:DE:80:2F:83:43 ; break;;
  315. $((${#items[@]}+1))) echo "We're done!"; break 2;;
  316. *) echo "Ooops - unknown choice $REPLY"; break;
  317. esac
  318. done
  319. echo -e ""
  320. EOF
  321. sudo chmod +x /tmp/wakemeup.sh
  322. sudo cp /tmp/wakemeup.sh /usr/local/bin
  323. echo "Done."
  324. echo -e "$(tput setaf 10)\nOpening ports:$(tput sgr0)"
  325. sudo ufw allow 8333 >/dev/null
  326. sudo ufw allow 22 >/dev/null
  327. sudo ufw allow 5900 >/dev/null
  328. sudo ufw allow 10000 >/dev/null
  329. sudo ufw allow 139 >/dev/null
  330. sudo ufw allow 5901 >/dev/null
  331. sudo ufw allow 5902 >/dev/null
  332. sudo ufw allow 445 >/dev/null
  333. sudo ufw allow 1337 >/dev/null
  334. sudo ufw allow 1447 >/dev/null
  335. echo "Done."
  336. echo -e "$(tput setaf 10)\nBashrc mod:$(tput sgr0)"
  337. if [ $Cuda = "YES" ]
  338. then
  339. if ! grep "#mod for cuda" /home/wareck/.bashrc >/dev/null
  340. then
  341. echo '#mod for cuda' >>/home/wareck/.bashrc
  342. echo 'export PATH=/usr/local/cuda-12.4/bin/:$PATH'>>/home/wareck/.bashrc
  343. echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH'>>/home/wareck/.bashrc
  344. echo '' >>/home/wareck/.bashrc
  345. fi
  346. fi
  347. echo -e "$(tput setaf 10)\nDisable IPv6:$(tput sgr0)"
  348. if ! grep "ipv6.disable=1" /etc/default/grub >/dev/null
  349. then
  350. sed -i -e "s/quiet splash/quiet splash ipv6.disable=1/g" /etc/default/grub
  351. sed -i -e "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"ipv6.disable=1 acpi_enforce_resources=lax/g" /etc/default/grub
  352. sudo update-grub2
  353. fi
  354. sudo chown -R wareck:wareck /home/wareck/miners/xmr*
  355. sudo apt-get remove light-locker* -y
  356. if [ ! -d /home/wareck/.config/lxterminal ]
  357. then
  358. mkdir /home/wareck/.config/lxterminal
  359. fi
  360. sudo cp /home/wareck/Build_Cube/pack/lxterminal.conf /home/wareck/.config/lxterminal/
  361. sudo chmod 777 /home/wareck/.config/lxterminal/lxterminal.conf
  362. echo "Done."
  363. echo "passe=4" >/home/wareck/.ipass
  364. decompte_
  365. }
  366. function mounting_drives_ {
  367. echo -e "$(tput setaf 10)\nMounting Drives$(tput sgr0)"
  368. #if ! findmnt /store >/dev/null ; then sudo mount /store |null ;fi
  369. #sudo chmod 777 /store
  370. sudo chmod 777 /raid
  371. echo "Done."
  372. }
  373. function cleaning_ {
  374. echo -e "$(tput setaf 10)\nCleaning install files:$(tput sgr0)"
  375. if [ -f /pack2.tar.xz ]; then sudo rm /pack2.tar.xz ;fi
  376. if [ -f /pack3.tar.xz ]; then sudo rm /pack3.tar.xz ;fi
  377. if [ -f /home/wareck/pack1.tar.xz ]; then rm /home/wareck/pack1.tar.xz ;fi
  378. if [ -f /home/wareck/pack2.tar.xz ]; then rm /home/wareck/pack2.tar.xz ;fi
  379. if [ -f /home/wareck/pack3.tar.xz ]; then rm /home/wareck/pack3.tar.xz ;fi
  380. if [ -f /home/wareck/xmrig.tar.xz ]; then rm /home/wareck/xmrig.tar.xz ;fi
  381. if [ -f /home/wareck/gpu-miners.tar.xz ]; then rm /home/wareck/gpu-miners.tar.xz;fi
  382. if [ -r /home/wareck/Music ]; then sudo rm -r -f /home/wareck/Music ;fi
  383. if [ -r /home/wareck/Public ]; then sudo rm -r -f /home/wareck/Public ;fi
  384. if [ -r /home/wareck/Templates ]; then sudo rm -r -f /home/wareck/Templates ;fi
  385. if [ -r /home/wareck/Vidéos ]; then sudo rm -r -f /home/wareck/Vidéos ;fi
  386. if [ -f /home/wareck/NVIDIA-Linux-x86_64-470.74.run ]; then rm /home/wareck/NVIDIA-Linux-x86_64-470.74.run ;fi
  387. if [ -f /home/wareck/NVIDIA-Linux-x86_64-470.82.00.run ]; then rm /home/wareck/NVIDIA-Linux-x86_64-470.82.00.run ;fi
  388. if [ -f /home/wareck/.ipass ]; then rm /home/wareck/.ipass ;fi
  389. if [ -f /usr/local/bin/zap ]; then sudo rm /usr/local/bin/zap* ;fi
  390. if [ -f /home/wareck/.config/autostart/install_os.desktop ];then sudo rm /home/wareck/.config/autostart/install_os.desktop;fi
  391. if [ -f /home/wareck/.config/autostart/zappy.desktop ];then sudo rm /home/wareck/.config/autostart/zappy.desktop;fi
  392. if [ -r /lib/modules/5.15.0-60-generic ]; then sudo rm -r /lib/modules/5.15.0-60-generic ;fi
  393. if [ -r /lib/modules/5.15.0-46-generic ]; then sudo rm -r /lib/modules/5.15.0-46-generic ;fi
  394. if [ -r /lib/modules/5.15.0-70-generic ]; then sudo rm -r /lib/modules/5.15.0-70-generic ;fi
  395. cd /home/wareck/Build_Cube/pack
  396. sudo chown -R wareck:wareck /home/wareck/miners
  397. sudo chmod -R 775 /home/wareck/miners
  398. ./clean.sh
  399. echo -e "Done. \n"
  400. echo `date` "install/update" >/home/wareck/.buildcube
  401. sudo apt-get autoremove -y
  402. sleep 1
  403. }
  404. function autoroot_ {
  405. if ! grep "#color putty" ~/.bashrc >/dev/null
  406. then
  407. echo "#color putty" >> ~/.bashrc
  408. echo "export TERM=xterm-256color" >> ~/.bashrc
  409. fi
  410. if [ ! -d /home/wareck/.config/autostart ]
  411. then
  412. echo -e "$(tput setaf 10)\nInit install & autostart:$(tput sgr0)"
  413. mkdir /home/wareck/.config/autostart
  414. echo -e "Done."
  415. sleep 1
  416. fi
  417. if [ ! -f /home/wareck/.config/autostart/install_os.desktop ]
  418. then
  419. cat <<'EOF'>> /home/wareck/.config/autostart/install_os.desktop
  420. [Desktop Entry]
  421. # VERSION=3.36.2
  422. Name=Terminal
  423. Comment=Use the command line
  424. Keywords=shell;prompt;command;commandline;cmd;
  425. TryExec=gnome-terminal
  426. Exec=gnome-terminal -- bash -c "sudo /home/wareck/Build_Cube/jupiter.sh; exec bash"
  427. Icon=org.gnome.Terminal
  428. Type=Application
  429. Categories=GNOME;GTK;System;TerminalEmulator;
  430. StartupNotify=true
  431. X-GNOME-SingleWindow=false
  432. OnlyShowIn=GNOME;Unity;
  433. Actions=new-window;preferences;
  434. X-Ubuntu-Gettext-Domain=gnome-terminal
  435. [Desktop Action new-window]
  436. Name=New Window
  437. Exec=gnome-terminal --window
  438. [Desktop Action preferences]
  439. Name=Preferences
  440. Exec=gnome-terminal --preferences
  441. EOF
  442. chmod +x /home/wareck/.config/autostart/install_os.desktop
  443. fi
  444. if [ ! -f /home/wareck/.config/autostart/zappy.desktop ]
  445. then
  446. cat <<'EOF'>> /home/wareck/.config/autostart/zappy.desktop
  447. [Desktop Entry]
  448. # VERSION=3.36.2
  449. Name=Terminal
  450. Comment=Use the command line
  451. Keywords=shell;prompt;command;commandline;cmd;
  452. TryExec=gnome-terminal
  453. Exec=gnome-terminal -- bash -c "/usr/local/bin/zap"
  454. Icon=org.gnome.Terminal
  455. Type=Application
  456. Categories=GNOME;GTK;System;TerminalEmulator;
  457. StartupNotify=true
  458. X-GNOME-SingleWindow=false
  459. OnlyShowIn=GNOME;Unity;
  460. Actions=new-window;preferences;
  461. X-Ubuntu-Gettext-Domain=gnome-terminal
  462. [Desktop Action new-window]
  463. Name=New Window
  464. Exec=gnome-terminal --window
  465. [Desktop Action preferences]
  466. Name=Preferences
  467. Exec=gnome-terminal --preferences
  468. EOF
  469. chmod +x /home/wareck/.config/autostart/zappy.desktop
  470. fi
  471. if ! grep "wareck" /etc/sudoers >/dev/null
  472. then
  473. sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
  474. fi
  475. if [ $passe="2" ]
  476. then
  477. echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
  478. sudo apt-get update
  479. sleep 1
  480. fi
  481. }
  482. function remove_screensaver {
  483. #remove screensaver
  484. cat <<EOF>> autostart
  485. @lxpanel --profile LXDE
  486. @pcmanfm --desktop --profile LXDE
  487. EOF
  488. sudo chmod 744 autostart
  489. sudo rm autostart
  490. sudo apt-get remove xscreensaver xscreensaver-data -y
  491. }
  492. function cmake_ {
  493. pids=""
  494. /home/wareck/Build_Cube/options/tools/_cmake.sh rollback & pids="$pids $!"
  495. wait $pids
  496. sudo ldconfig
  497. }
  498. function watchdog_ {
  499. pids=""
  500. /home/wareck/Build_Cube/options/watchdog.sh ext & pids="$pids $!"
  501. wait $pids
  502. }
  503. function chia_ {
  504. echo -e "$(tput setaf 10)\nInstall Chia:$(tput sgr0)"
  505. cd /home/wareck/Build_Cube/
  506. cp /home/wareck/Build_Cube/options/chia.sh .
  507. sed -i "s/Gui=Yes/Gui=No/g" chia.sh
  508. sed -i "s/ChiaPos=Yes/ChiaPos=No/g" chia.sh
  509. sed -i "s/Miner=Yes/Miner=No/g" chia.sh
  510. sed -i "s/ChiaService=Yes/ChiaService=No/g" chia.sh
  511. sed -i "s/Miner=Yes/Miner=No/g" chia.sh
  512. sed -i "s/ChiaProxy=Yes/ChiaProxy=No/g" chia.sh
  513. sed -i "s/Toolkit for Chia v$Version/Toolkit for Chia AlmaLinux /g" chia.sh
  514. sed -i "s/sudo apt-get install/#sudo apt-get install/g" chia.sh
  515. sed -i "s/-j 6/-j 32/g" chia.sh
  516. chmod +x chia.sh
  517. bash chia.sh
  518. #rm chia.sh
  519. echo -e "\nDone"
  520. }
  521. function wol_ {
  522. iface=$(ip link | awk -F: '$0 !~ "lo|vir|^[^0-9]"{printf $2a}' | cut -d ' ' -f2)
  523. ether=$(which ethtool)
  524. echo "[Unit]" >>/tmp/wol.service
  525. echo "Description=Enable Wake On Lan" >>/tmp/wol.service
  526. echo "" >>/tmp/wol.service
  527. echo "[Service]" >>/tmp/wol.service
  528. echo "Type=oneshot" >>/tmp/wol.service
  529. echo "ExecStart = $ether --change $iface wol g" >>/tmp/wol.service
  530. echo "" >>/tmp/wol.service
  531. echo "[Install]" >>/tmp/wol.service
  532. echo "WantedBy=basic.target" >>/tmp/wol.service
  533. sudo cp /tmp/wol.service /etc/systemd/system/wol.service
  534. sudo systemctl daemon-reload >/dev/null
  535. sudo systemctl enable wol.service >/dev/null
  536. sudo systemctl start wol.service >/dev/null
  537. sleep 2
  538. clear
  539. }
  540. intro_
  541. case $passe in
  542. 1)
  543. watchdog_
  544. autoroot_
  545. ubuntu_version_check
  546. update_
  547. kernel_check_
  548. nvidia_driver_
  549. ;;
  550. 2)
  551. nvidia_driver_
  552. update_
  553. ;;
  554. 3)
  555. download_packs_
  556. build_miners_
  557. configure_
  558. ;;
  559. 4)
  560. mounting_drives_
  561. cleaning_
  562. remove_screensaver
  563. clear
  564. wol_
  565. dynmotd
  566. ;;
  567. *) ;;
  568. esac
  569. echo -e "$(tput setaf 10)\nEnd of script:$(tput sgr0) \n"
  570. echo -e ""