From bff4c3f377de116e17ce165816f69b67c97cc7e8 Mon Sep 17 00:00:00 2001 From: frederik Date: Fri, 16 Feb 2024 11:52:08 +0100 Subject: [PATCH] try to avoid broken installs --- newinstaller.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/newinstaller.sh b/newinstaller.sh index 58a8269..e7db8c2 100755 --- a/newinstaller.sh +++ b/newinstaller.sh @@ -14,6 +14,20 @@ information" exit 1 fi +# we require passwordless sudo +sudo -K +if ! sudo -n true; then + echo "Passwordless sudo is not working. Aborting" + exit +fi + +# the php code expects the user with uid 1000 on this system +PRIMARY=$(awk -F: '/1000/{print $1}' /etc/passwd) +if [ $USER != $PRIMARY ]; then + echo "Current user \"$USER\" does not match the user with uid 1000 on this system \"$PRIMARY\". Aborting" + exit +fi + # Simple new installer HOME=$HOME USER=$USER