#!/bin/bash

function autoroot_ {
if [ ! -d /home/wareck/.config/autostart ]
then
echo -e "$(tput setaf 10)\nInit install & autostart :$(tput sgr0)"
mkdir /home/wareck/.config/autostart
fi
if [ ! -f /home/wareck/.config/autostart/lolminer.desktop ]
then
cat <<'EOF'>> /home/wareck/.config/autostart/lolminer.desktop
[Desktop Entry]
# VERSION=3.36.2
Name=Terminal
Comment=Use the command line
Keywords=shell;prompt;command;commandline;cmd;
TryExec=gnome-terminal
Exec=gnome-terminal -- bash -c "sudo /home/wareck/miners/lolminer/./lolMiner --algo ETHASH --pool ethash.unmineable.com --port 3333 --user SHIB:0x345b006F98a231cD846f6a8a8151F9999bBD2f2A.nzxt --worker Rig1 --pass x --ethstratum ETHPROXY"
Icon=org.gnome.Terminal
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
X-GNOME-SingleWindow=false
OnlyShowIn=GNOME;Unity;
Actions=new-window;preferences;
X-Ubuntu-Gettext-Domain=gnome-terminal

[Desktop Action new-window]
Name=New Window
Exec=gnome-terminal --window

[Desktop Action preferences]
Name=Preferences
Exec=gnome-terminal --preferences
EOF
chmod +x /home/wareck/.config/autostart/lolminer.desktop
fi
if ! grep "wareck" /etc/sudoers >/dev/null
then
sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
echo "Done"
fi
}

autoroot_
