check if root first

This commit is contained in:
Daniel Hansson 2017-01-16 20:54:41 +01:00 committed by GitHub
parent 013afb7d48
commit 7beb71cfbf

View File

@ -1,6 +1,15 @@
#!/bin/bash
# Collabora auto installer
# Check if root
if [ "$(whoami)" != "root" ]
then
echo
echo -e "\e[31mSorry, you are not root.\n\e[0mYou must type: \e[36msudo \e[0mbash $SCRIPTS/collabora.sh"
echo
exit 1
fi
## Variable's
# Docker URL
SUBDOMAIN=$(whiptail --title "Techandme.se Collabora" --inputbox "Collabora subdomain eg: office.yourdomain.com" "$WT_HEIGHT" "$WT_WIDTH" 3>&1 1>&2 2>&3)
@ -16,15 +25,6 @@ WANIP4=$(dig +short myip.opendns.com @resolver1.opendns.com)
# Misc
SCRIPTS=/var/scripts
# Check if root
if [ "$(whoami)" != "root" ]
then
echo
echo -e "\e[31mSorry, you are not root.\n\e[0mYou must type: \e[36msudo \e[0mbash $SCRIPTS/collabora.sh"
echo
exit 1
fi
# Whiptail auto size
calc_wt_size() {
WT_HEIGHT=17