bender.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. #!/bin/bash
  2. set -e
  3. Version=15.1
  4. Cuda=NO
  5. kernel_custom=YES
  6. Webmin="webmin-2.101"
  7. kernel_dkms="5.15.127-custom"
  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. function ubuntu_version_check {
  14. if [[ $(lsb_release -rs) == "20.04" ]]
  15. then
  16. Ubuntu_version="20.04.5"
  17. else
  18. echo "Non-compatible version"
  19. exit 0
  20. fi
  21. }
  22. function print_centered {
  23. [[ $# == 0 ]] && return 1
  24. declare -i TERM_COLS="$(tput cols)"
  25. declare -i str_len="${#1}"
  26. [[ $str_len -ge $TERM_COLS ]] && {
  27. echo "$1";
  28. return 0;
  29. }
  30. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  31. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  32. filler=""
  33. for (( i = 0; i < filler_len; i++ )); do
  34. filler="${filler}${ch}"
  35. done
  36. printf "%s%s%s" "$filler" "$1" "$filler"
  37. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  38. printf "\n"
  39. return 0
  40. }
  41. function decompte_ {
  42. echo -e "$(tput setaf 10)\nReboot in 5 seconds (CRTL+C to abord):$(tput sgr0)"
  43. for i in {5..1}
  44. do
  45. echo -e -n "$i "
  46. sleep 1
  47. done
  48. echo ""
  49. sudo reboot
  50. }
  51. function intro_ {
  52. print_centered "$(tput setaf 244)"
  53. print_centered "██████╗ ███████╗███╗ ██╗██████╗ ███████╗██████╗ "
  54. print_centered "██╔══██╗██╔════╝████╗ ██║██╔══██╗██╔════╝██╔══██╗"
  55. print_centered "██████╔╝█████╗ ██╔██╗ ██║██║ ██║█████╗ ██████╔╝"
  56. print_centered "██╔══██╗██╔══╝ ██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗"
  57. print_centered "██████╔╝███████╗██║ ╚████║██████╔╝███████╗██║ ██║"
  58. print_centered "╚═════╝ ╚══════╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝"
  59. echo -n "$(tput sgr0)$(tput setaf 10)"
  60. print_centered "Bender Server installation script v$Version"
  61. print_centered "Ubuntu version 20.04"
  62. print_centered "Dell R640"
  63. echo -n "$(tput sgr0)"
  64. sleep 3
  65. }
  66. function update_ {
  67. if [ -f /home/wareck/.pass2 ] && [ ! -f /home/wareck/.pass3 ] && [ ! -f /home/wareck/.pass4 ]
  68. then
  69. echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
  70. sudo apt-get update
  71. echo -e ""
  72. sudo apt-get install lxde lxde-icon-theme -y
  73. echo -e ""
  74. sudo apt-get install samba cifs-utils mdadm git build-essential libtool pkg-config automake autoconf ethtool net-tools openvpn filezilla \
  75. tasksel lzma-dev lzma cmake libuv1-dev libssl-dev msr-tools tightvncserver lm-sensors openssh-server xfsprogs -y
  76. echo -e ""
  77. sudo apt-get install pixz pbzip2 pigz btrfs-progs gparted gpart gnome-remote-desktop libcanberra-gtk-module \
  78. ctorrent libcurl4-openssl-dev bison byacc screen libudev-dev libjansson-dev libncurses5-dev libmicrohttpd-dev curl nvme-cli -y
  79. echo -e ""
  80. sudo apt-get install libglib2.0-dev libgtk2.0-dev libsensors4-dev htop vlc locate -y
  81. echo -e ""
  82. fi
  83. }
  84. function kernel_check_ {
  85. unamestr=$(uname -r)
  86. if ! [[ "$unamestr" == $kernel_dkms ]]
  87. then
  88. echo -e "\n$(tput setaf 10)Custom kernel install $(tput setaf 9)$KLversion$(tput setaf 10) (fix DKMS/WOL) :$(tput sgr0)"
  89. cd /tmp/
  90. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/custom_kernel/kernel_5.15.127-skylake.run
  91. chmod +x kernel_5.15.127-skylake.run
  92. sudo ./kernel_5.15.127-skylake.run
  93. fi
  94. nvidia_driver_
  95. }
  96. function nvidia_driver_ {
  97. if ! [ -f /home/wareck/.pass1 ]
  98. then
  99. sudo apt-get install build-essential libglvnd-dev -y
  100. touch /home/wareck/.pass1
  101. touch /home/wareck/.pass2
  102. decompte_
  103. fi
  104. }
  105. function download_packs_ {
  106. if [ ! -f /home/wareck/.pass3 ]
  107. then
  108. echo -e "$(tput setaf 10)\nDownload complement packs:$(tput sgr0)"
  109. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/cgminer.conf -O /home/wareck/Build_Cube/pack/cgminer.conf
  110. 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
  111. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/gerbera.tar.xz -O /home/wareck/Build_Cube/pack/gerbera.tar.xz
  112. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/start_cgminer.tar.xz -O /home/wareck/Build_Cube/pack/start_cgminer.tar.xz
  113. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/$Webmin.tar.xz -O /home/wareck/Build_Cube/pack/$Webmin.tar.xz
  114. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/xmrig.tar.xz -O /home/wareck/Build_Cube/pack/xmrig.tar.xz
  115. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/zfsmanager-0.0.4.wbm.gz -O /home/wareck/Build_Cube/pack/zfsmanager-0.0.4.wbm.gz
  116. 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
  117. cp /home/wareck/Build_Cube/pack/gpu-miners.tar.xz /home/wareck
  118. cp /home/wareck/Build_Cube/pack/pack1.tar.xz /home/wareck
  119. cp /home/wareck/Build_Cube/pack/pack2.tar.xz /home/wareck
  120. cp /home/wareck/Build_Cube/pack/pack3.tar.xz /home/wareck
  121. cp /home/wareck/Build_Cube/pack/xmrig.tar.xz /home/wareck
  122. cp /home/wareck/Build_Cube/pack/start_cgminer.tar.xz /home/wareck
  123. echo "Done."
  124. if [ ! -d /home/wareck/$Webmin ]
  125. then
  126. cp /home/wareck/Build_Cube/pack/$Webmin.tar.xz /home/wareck/
  127. cd /home/wareck/
  128. echo -e "$(tput setaf 10)\nWebmin uncompress:$(tput sgr0)"
  129. tar xfJ $Webmin.tar.xz
  130. rm $Webmin.tar.xz
  131. echo -e "Done"
  132. fi
  133. echo -e "$(tput setaf 10)\nDownloading miners:$(tput sgr0)"
  134. cd /home/wareck
  135. if ! [ -d miners ]; then mkdir -p miners;fi
  136. cd /home/wareck/miners
  137. if ! [ -d xmrig ]
  138. then
  139. git clone https://github.com/xmrig/xmrig.git
  140. echo -e ""
  141. fi
  142. if ! [ -d xmr-stak ]
  143. then
  144. git clone https://github.com/fireice-uk/xmr-stak.git
  145. echo -e ""
  146. fi
  147. if ! [ -d xmr-stak-rx ]
  148. then
  149. git clone https://github.com/fireice-uk/xmr-stak.git -b xmr-stak-rx xmr-stak-rx
  150. echo -e ""
  151. fi
  152. if ! [ -d cgminer-gekko ]
  153. then
  154. git clone https://github.com/wareck/cgminer-gekko.git
  155. echo -e ""
  156. fi
  157. if ! [ -d cgminer-lketc ]
  158. then
  159. git clone https://github.com/wareck/cgminer-lketc.git
  160. fi
  161. fi
  162. echo "Done."
  163. }
  164. function build_miners_ {
  165. if [ ! -f /home/wareck/.pass3 ]
  166. then
  167. cmake_ #check cmake version
  168. cd /home/wareck
  169. tar xfJ gpu-miners.tar.xz
  170. cd /home/wareck/miners
  171. echo -e "$(tput setaf 10)\nUncompress xmr files:$(tput sgr0)"
  172. tar xfJ /home/wareck/xmrig.tar.xz --checkpoint=.100
  173. echo "Done."
  174. echo -n -e "\n"
  175. echo -e "$(tput setaf 10)\nBuild xmrig:$(tput sgr0)"
  176. cd xmrig
  177. git config --global --add safe.directory /home/wareck/miners/xmrig
  178. git pull
  179. sed -i "s/kDefaultDonateLevel = 5;/kDefaultDonateLevel = 0;/g" src/donate.h
  180. sed -i "s/kMinimumDonateLevel = 1;/kMinimumDonateLevel = 0;/g" src/donate.h
  181. wget -c https://download.open-mpi.org/release/hwloc/v2.7/hwloc-2.7.1.tar.bz2
  182. tar xfj hwloc-2.7.1.tar.bz2 --checkpoint=.100
  183. cd hwloc-2.7.1
  184. ./configure
  185. make -j$((`nproc`+1))
  186. sudo make install
  187. cd ..
  188. sudo ldconfig
  189. cd build
  190. cmake ..
  191. make -j$((`nproc`+1))
  192. cd ..
  193. cd ..
  194. echo "Done."
  195. rm -r -f cgminer*
  196. rm -r -f xmrig-upx
  197. echo -e "$(tput setaf 10)\nBuild xmr-stak-rx:$(tput sgr0)"
  198. cd xmr-stak-rx
  199. git config --global --add safe.directory /home/wareck/miners/xmr-stak-rx
  200. git pull
  201. cd build
  202. cmake ..
  203. make -j$((`nproc`+1))
  204. cd ..
  205. cd ..
  206. echo "Done."
  207. echo -e "$(tput setaf 10)\nBuild xmr-stak:$(tput sgr0)"
  208. cd xmr-stak
  209. if ! [ -d build ];then mkdir build ;fi
  210. git config --global --add safe.directory /home/wareck/miners/xmr-stak
  211. git pull
  212. cd build
  213. cmake .. -DOpenCL_ENABLE=OFF -DCUDA_ENABLE=OFF
  214. make -j$((`nproc`+1))
  215. cd ..
  216. cd ..
  217. echo "Done."
  218. touch /home/wareck/.pass3
  219. fi
  220. sudo chmod -R 775 /home/wareck/miners
  221. }
  222. function configure_ {
  223. if [ ! -f /home/wareck/.pass4 ]
  224. then
  225. echo -e "$(tput setaf 10)\nlxPanel sensors:$(tput sgr0)"
  226. cd /home/wareck
  227. echo -e "$(tput setaf 10)\nConfig files:$(tput sgr0)"
  228. cd /home/wareck/
  229. zip="['firefox.desktop', 'thunderbird.desktop', 'org.remmina.Remmina.desktop', 'filezilla.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop']"
  230. cat <<'EOF'>> zap
  231. #!/bin/bash
  232. gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 32
  233. gsettings set org.gnome.desktop.background picture-uri /home/wareck/Images/bender.jpg
  234. gsettings set org.gnome.shell favorite-apps "XXX"
  235. #su wareck -c 'gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts false'
  236. dconf load /org/gnome/terminal/ < /usr/local/bin/zap2
  237. EOF
  238. sed -i "s/XXX/$zip/g" zap
  239. UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
  240. cat <<'EOF'>> zap2
  241. [legacy/profiles:/:XXX]
  242. default-size-columns=110
  243. font='Monospace 9'
  244. use-system-font=false
  245. use-theme-colors=false
  246. EOF
  247. sed -i "s/XXX/$UUID/g" zap2
  248. chmod +x zap
  249. sudo cp zap /usr/local/bin
  250. sudo cp zap2 /usr/local/bin
  251. sudo rm zap
  252. sudo rm zap2
  253. sleep 1
  254. sudo rm -r -f /etc/update-motd.d/*
  255. tar xfJ pack1.tar.xz --checkpoint=.10
  256. echo -n -e "\n"
  257. sudo cp /home/wareck/pack2.tar.xz /
  258. sudo cp /home/wareck/pack3.tar.xz /
  259. cd /
  260. sudo tar xfJ pack2.tar.xz --checkpoint=.10
  261. sudo tar xfJ pack3.tar.xz --checkpoint=.10
  262. echo -n -e "\n"
  263. cd /home/wareck
  264. #clear
  265. dynmotd
  266. sudo sed -i -e "s/# set constantshow/set constantshow/g" /etc/nanorc
  267. if ! grep "wareck" /etc/sudoers >/dev/null
  268. then
  269. sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
  270. fi
  271. echo -e "$(tput setaf 10)\nBuild folder and mount drives:$(tput sgr0)"
  272. if ! [ -r /farm ];then sudo mkdir /farm;fi
  273. echo "Done."
  274. sudo apt install ethtool -y
  275. iface=$(ip link | awk -F: '$0 !~ "lo|vir|^[^0-9]"{print $2a;getline}')
  276. sudo ethtool --change eno1 wol g
  277. sudo ethtool --change eno2 wol g
  278. sudo ethtool --change eno3 wol g
  279. sudo ethtool --change eno4 wol g
  280. cat <<'EOF'>> /tmp/wakemeup.sh
  281. #!/bin/bash
  282. set -e
  283. if ! [ -x "$(command -v etherwake)" ];then sudo apt-get install etherwake -y;fi
  284. clear
  285. echo -e "$(tput setaf 10)Wake On Lan v1.0:$(tput sgr0)"
  286. PS3="Select : "
  287. items=("Nzxt" "Garage")
  288. select item in "${items[@]}" Quit
  289. do
  290. case $REPLY in
  291. 1) sudo etherwake -i enp5s0 E0:D5:5E:2D:9E:CB ; break;;
  292. 2) sudo etherwake -i enp5s0 58:11:22:CD:FC:7A ; break;;
  293. $((${#items[@]}+1))) echo "We're done!"; break 2;;
  294. *) echo "Ooops - unknown choice $REPLY"; break;
  295. esac
  296. done
  297. echo -e ""
  298. EOF
  299. sudo chmod +x /tmp/wakemeup.sh
  300. sudo cp /tmp/wakemeup.sh /usr/local/bin
  301. echo "Done."
  302. echo -e "$(tput setaf 10)\nVnc init:$(tput sgr0)"
  303. sudo update-rc.d vncserver defaults
  304. echo "Done."
  305. echo -e "$(tput setaf 10)\nOpening ports:$(tput sgr0)"
  306. sudo ufw disable
  307. echo "Done."
  308. echo -e "$(tput setaf 10)\nBashrc mod:$(tput sgr0)"
  309. if ! grep "#mod for tightvncserver" /home/wareck/.bashrc
  310. then
  311. echo "#mod for tightvncserver" >>/home/wareck/.bashrc
  312. echo "cd ~" >>/home/wareck/.bashrc
  313. fi
  314. echo "Done."
  315. echo -e "$(tput setaf 10)\nDisable IPv6:$(tput sgr0)"
  316. if ! grep "ipv6.disable=1" /etc/default/grub >/dev/null
  317. then
  318. sed -i -e "s/quiet splash/quiet splash ipv6.disable=1/g" /etc/default/grub
  319. sed -i -e "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"ipv6.disable=1 acpi_enforce_resources=lax/g" /etc/default/grub
  320. sudo update-grub2
  321. fi
  322. sudo chown -R wareck:wareck /home/wareck/miners/xmr*
  323. sudo apt-get remove light-locker* -y
  324. if [ ! -d /home/wareck/.config/lxpanel/LXDE/panels ]
  325. then
  326. mkdir /home/wareck/.config/lxpanel
  327. mkdir /home/wareck/.config/lxpanel/LXDE
  328. mkdir /home/wareck/.config/lxpanel/LXDE/panels
  329. fi
  330. sudo cp /home/wareck/Build_Cube/pack/panel /home/wareck/.config/lxpanel/LXDE/panels/panel
  331. sudo chmod 777 /home/wareck/.config/lxpanel/LXDE/panels/panel
  332. if [ ! -d /home/wareck/.config/lxterminal ]
  333. then
  334. mkdir /home/wareck/.config/lxterminal
  335. fi
  336. sudo cp /home/wareck/Build_Cube/pack/lxterminal.conf /home/wareck/.config/lxterminal/
  337. sudo chmod 777 /home/wareck/.config/lxterminal/lxterminal.conf
  338. echo "Done."
  339. touch /home/wareck/.pass4
  340. decompte_
  341. fi
  342. }
  343. function printer_ {
  344. if [ ! -f /home/wareck/.pass3 ]
  345. then
  346. if [ ! -d /usr/local/share/foomatic/ ]
  347. then
  348. if [ ! -d /tmp/foomatic-db/ ]
  349. then
  350. cd /tmp/
  351. echo -e "$(tput setaf 10)\nInstall printers generic drivers:$(tput sgr0)"
  352. git clone https://github.com/OpenPrinting/foomatic-db.git
  353. fi
  354. cd /tmp/foomatic-db
  355. if [ ! -d /usr/local/share/foomatic/ ]
  356. then
  357. ./make_configure
  358. ./configure
  359. sudo make install
  360. echo "Done."
  361. fi
  362. fi
  363. fi
  364. }
  365. function mounting_drives_ {
  366. if [ ! -f /home/wareck/.pass4 ]
  367. then
  368. echo -e "$(tput setaf 10)\nMounting Drives$(tput sgr0)"
  369. echo "Done."
  370. fi
  371. }
  372. function cleaning_ {
  373. if [ -f /home/wareck/.pass4 ]
  374. then
  375. echo -e "$(tput setaf 10)\nCleaning install files:$(tput sgr0)"
  376. if [ -f /pack2.tar.xz ]; then sudo rm /pack2.tar.xz ;fi
  377. if [ -f /pack3.tar.xz ]; then sudo rm /pack3.tar.xz ;fi
  378. if [ -f /home/wareck/pack1.tar.xz ]; then rm /home/wareck/pack1.tar.xz ;fi
  379. if [ -f /home/wareck/pack2.tar.xz ]; then rm /home/wareck/pack2.tar.xz ;fi
  380. if [ -f /home/wareck/pack3.tar.xz ]; then rm /home/wareck/pack3.tar.xz ;fi
  381. if [ -f /home/wareck/xmrig.tar.xz ]; then rm /home/wareck/xmrig.tar.xz ;fi
  382. if [ -f /home/wareck/gpu-miners.tar.xz ]; then rm /home/wareck/gpu-miners.tar.xz;fi
  383. if [ -r /home/wareck/Music ]; then sudo rm -r -f /home/wareck/Music ;fi
  384. if [ -r /home/wareck/Public ]; then sudo rm -r -f /home/wareck/Public ;fi
  385. if [ -r /home/wareck/Templates ]; then sudo rm -r -f /home/wareck/Templates ;fi
  386. if [ -r /home/wareck/Vidéos ]; then sudo rm -r -f /home/wareck/Vidéos ;fi
  387. if [ -f /home/wareck/NVIDIA-Linux-x86_64-470.74.run ]; then rm /home/wareck/NVIDIA-Linux-x86_64-470.74.run ;fi
  388. 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
  389. if [ -f /home/wareck/.pass1 ]; then rm /home/wareck/.pass1 ;fi
  390. if [ -f /home/wareck/.pass2 ]; then rm /home/wareck/.pass2 ;fi
  391. if [ -f /home/wareck/.pass3 ]; then rm /home/wareck/.pass3 ;fi
  392. if [ -f /home/wareck/.pass4 ]; then rm /home/wareck/.pass4 ;fi
  393. if [ -f /usr/local/bin/zap ]; then sudo rm /usr/local/bin/zap* ;fi
  394. if [ -f /home/wareck/.config/autostart/install_os.desktop ];then sudo rm /home/wareck/.config/autostart/install_os.desktop;fi
  395. if [ -f /home/wareck/.config/autostart/zappy.desktop ];then sudo rm /home/wareck/.config/autostart/zappy.desktop;fi
  396. if [ -r /lib/modules/5.15.0-60-generic ]; then sudo rm -r /lib/modules/5.15.0-60-generic ;fi
  397. if [ -r /lib/modules/5.15.0-46-generic ]; then sudo rm -r /lib/modules/5.15.0-46-generic ;fi
  398. if [ -r /lib/modules/5.15.0-70-generic ]; then sudo rm -r /lib/modules/5.15.0-70-generic ;fi
  399. cd /home/wareck/Build_Cube/pack
  400. sudo chown -R wareck:wareck /home/wareck/miners
  401. sudo chmod -R 775 /home/wareck/miners
  402. ./clean.sh
  403. echo -e "Done. \n"
  404. echo `date` "install/update" >/home/wareck/.buildcube
  405. fi
  406. sudo apt-get autoremove -y
  407. sleep 1
  408. }
  409. function autoroot_ {
  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/bender.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. echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
  476. sudo apt-get update
  477. sudo apt-get install lxde lxde-icon-theme -y
  478. sleep 1
  479. }
  480. function remove_screensaver {
  481. #remove screensaver
  482. cat <<EOF>> autostart
  483. @lxpanel --profile LXDE
  484. @pcmanfm --desktop --profile LXDE
  485. EOF
  486. sudo chmod 744 autostart
  487. sudo cp autostart /etc/xdg/lxsession/LXDE/
  488. sudo cp autostart /home/wareck/.config/lxsession/LXDE/
  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. }
  497. function wol_ {
  498. iface=$(ip link | awk -F: '$0 !~ "lo|vir|^[^0-9]"{print $2a;getline}')
  499. ether=$(which ethtool)
  500. echo "[Unit]" >>/tmp/wol.service
  501. echo "Description=Enable Wake On Lan" >>/tmp/wol.service
  502. echo "" >>/tmp/wol.service
  503. echo "[Service]" >>/tmp/wol.service
  504. echo "Type=oneshot" >>/tmp/wol.service
  505. echo "ExecStart = $ether --change$iface wol g" >>/tmp/wol.service
  506. echo "" >>/tmp/wol.service
  507. echo "[Install]" >>/tmp/wol.service
  508. echo "WantedBy=basic.target" >>/tmp/wol.service
  509. sudo cp /tmp/wol.service /etc/systemd/system/wol.service
  510. sudo systemctl daemon-reload
  511. sudo systemctl enable wol.service
  512. sudo systemctl start wol.service
  513. }
  514. intro_
  515. autoroot_
  516. ubuntu_version_check
  517. update_
  518. kernel_check_
  519. nvidia_driver_
  520. download_packs_
  521. printer_
  522. build_miners_
  523. configure_
  524. mounting_drives_
  525. cleaning_
  526. remove_screensaver
  527. clear
  528. wol_
  529. dynmotd
  530. echo -e "$(tput setaf 10)\nEnd of script:$(tput sgr0) \n"
  531. echo -e "$(tput setaf 7)Need to install webmin manually (reboot required)$(tput sgr0)"
  532. echo -e "$(tput setaf 7)after install webmin, reboot is required $(tput sgr0)"
  533. echo -e ""