Update setup.sh

This commit is contained in:
borekon 2022-03-14 13:05:54 +01:00
parent 047568b93d
commit 74d874a3b0

View File

@ -2,6 +2,7 @@
RED="31" RED="31"
GREEN="32" GREEN="32"
BOLDGREEN="\e[1;${GREEN}m" BOLDGREEN="\e[1;${GREEN}m"
BOLDRED="\e[1;${RED}m"
ITALICGREEN="\e[3;${GREEN}m" ITALICGREEN="\e[3;${GREEN}m"
ITALICRED="\e[3;${RED}m" ITALICRED="\e[3;${RED}m"
ENDCOLOR="\e[0m" ENDCOLOR="\e[0m"
@ -12,13 +13,13 @@ if [ "$(whoami)" != "root" ]; then
fi fi
#Installs sury's php repository #Installs sury's php repository
${SUDO} apt update ${SUDO} apt update
${SUDO} apt -y install apt-transport-https lsb-release ca-certificates vim sudo perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python curl certbot shared-mime-info fail2ban unzip git gpg ${SUDO} apt -y install apt-transport-https lsb-release ca-certificates vim sudo perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python certbot shared-mime-info fail2ban unzip git gpg
${SUDO} curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg ${SUDO} curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' ${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt update ${SUDO} apt update
read -p "Create user?(y/n)? " answer read -p "Create user?(y/n)? " answer
case ${answer:0:1} in case ${answer:0:1} in
y|Y ) y|Y)
read -p "Enter username " USERNAME read -p "Enter username " USERNAME
${SUDO} adduser --gecos "" $USERNAME ${SUDO} adduser --gecos "" $USERNAME
read -p "Should I add the new user to sudo group?(y/n)? " answer read -p "Should I add the new user to sudo group?(y/n)? " answer
@ -38,7 +39,7 @@ case ${answer:0:1} in
esac esac
echo -e "${ITALICGREEN}Configuring timezone to Madrid....${ENDCOLOR}" echo -e "${ITALICGREEN}Configuring timezone to Madrid....${ENDCOLOR}"
echo 'Europe/Madrid' | ${SUDO} tee /etc/timezone > /dev/null && ${SUDO} dpkg-reconfigure -f noninteractive tzdata > /dev/null echo 'Europe/Madrid' | ${SUDO} tee /etc/timezone > /dev/null && ${SUDO} dpkg-reconfigure -f noninteractive tzdata > /dev/null
read -p "Install webmin?(y/n)" answer read -p "Install webmin?(y/n) " answer
case ${answer:0:1} in case ${answer:0:1} in
y|Y ) y|Y )
${SUDO} sh -c 'echo "deb https://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list' ${SUDO} sh -c 'echo "deb https://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list'
@ -49,10 +50,10 @@ case ${answer:0:1} in
pause pause
;; ;;
* ) * )
echo -e Webmin "${RED}NOT${ENDCOLOR}" installed echo -e Webmin "${BOLDRED} NOT${ENDCOLOR}" installed
;; ;;
esac esac
read -p "Install pihole?(y/n)" answer read -p "Install pihole?(y/n) " answer
case ${answer:0:1} in case ${answer:0:1} in
y|Y ) y|Y )
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
@ -62,7 +63,7 @@ case ${answer:0:1} in
pause pause
;; ;;
* ) * )
echo -e PiHole "${RED}NOT${ENDCOLOR}" installed echo -e PiHole "${BOLDRED} NOT${ENDCOLOR} " installed
;; ;;
esac esac
if [[ $WEBMIN != 0 ]] if [[ $WEBMIN != 0 ]]
@ -103,12 +104,9 @@ if [[ -d "/etc/lighttpd" ]]
${SUDO} systemctl start lighttpd ${SUDO} systemctl start lighttpd
;; ;;
* ) * )
echo -e SSL certificate was "${RED}NOT${ENDCOLOR}" installed echo -e SSL certificate was "${BOLDRED}NOT${ENDCOLOR}" installed
;; ;;
esac esac
echo Si
else else
echo No echo No
fi fi