commit 4a4b037c4ed0bec7c952e5c925364fa728e0f155 parent c3e00dafa3b7a8804d587ab9768a60f88f44159d Author: rbckman <robinbackman@gmail.com> Date: Fri, 31 Aug 2018 13:37:33 +0300 check if sudo Diffstat:
M | install.sh | | | 14 | ++++++++------ |
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/install.sh b/install.sh @@ -1,11 +1,10 @@ #!/bin/bash -# Install Tarina -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root, use sudo "$0" instead" 1>&2 - exit 1 -fi +ROOT_UID=0 # Root has $UID 0. +if [ "$UID" -eq "$ROOT_UID" ] +then +echo "You are root." echo "Installing all dependencies..." apt-get update apt-get upgrade -y @@ -132,4 +131,7 @@ reboot esac done - +else + echo "Run with sudo ./install.sh" +fi +exit 0