diff --git a/alpine/alpine-adduser-sudo.sh b/alpine/alpine-adduser-sudo.sh index f08507a..1521be3 100755 --- a/alpine/alpine-adduser-sudo.sh +++ b/alpine/alpine-adduser-sudo.sh @@ -1,9 +1,8 @@ #!/bin/ash -if [ "$EUID" -ne 0 ] - then - echo "Please run as root" - exit +if ! [ $(id -u) = 0 ]; then + echo "Please run as root!" +exit 1 fi apk update diff --git a/alpine/alpine-configure-git.sh b/alpine/alpine-configure-git.sh index 956f8a4..83f5302 100755 --- a/alpine/alpine-configure-git.sh +++ b/alpine/alpine-configure-git.sh @@ -1,9 +1,8 @@ #!/bin/ash -if [ "$EUID" -eq 0 ] - then - echo "Please do NOT run as root" - exit +if [ $(id -u) = 0 ]; then + echo "Please do NOT run as root!" +exit 1 fi # git config diff --git a/alpine/alpine-essentials.sh b/alpine/alpine-essentials.sh index 2bd563b..e4ee389 100755 --- a/alpine/alpine-essentials.sh +++ b/alpine/alpine-essentials.sh @@ -1,9 +1,8 @@ #!/bin/ash -if [ "$EUID" -ne 0 ] - then - echo "Please run as root" - exit +if ! [ $(id -u) = 0 ]; then + echo "Please run as root!" +exit 1 fi # edit repositories diff --git a/alpine/alpine-install-docker.sh b/alpine/alpine-install-docker.sh index 29acdb8..df31419 100755 --- a/alpine/alpine-install-docker.sh +++ b/alpine/alpine-install-docker.sh @@ -1,9 +1,8 @@ #!/bin/ash -if [ "$EUID" -ne 0 ] - then - echo "Please run as root" - exit +if ! [ $(id -u) = 0 ]; then + echo "Please run as root!" +exit 1 fi apk update diff --git a/alpine/alpine-user-customizations.sh b/alpine/alpine-user-customizations.sh index f380848..26dd8c9 100755 --- a/alpine/alpine-user-customizations.sh +++ b/alpine/alpine-user-customizations.sh @@ -1,9 +1,8 @@ #!/bin/bash -if [ "$EUID" -eq 0 ] - then - echo "Please do NOT run as root" - exit +if [ $(id -u) = 0 ]; then + echo "Please do NOT run as root!" +exit 1 fi # add aliases