Updated Makefile with a safety check for user

Added a safety check to see if the user exists when running make install. It was dying on me because the user already existed. Now if the user exists, it reports back the user exists and skips it.
This commit is contained in:
sptoothman 2022-09-28 10:22:02 -05:00 committed by GitHub
parent 915b271f2d
commit 86bde27736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,12 @@ install: adduser update
fi
adduser:
useradd --system --user-group --create-home -K UMASK=0022 --home $(MSCS_HOME) $(MSCS_USER)
# safety check to see if user exists before trying to create it
if id $(MSCS_USER); then \
echo "Minecraft user $(MSCS_USER) exists so not creating it"; \
else \
useradd --system --user-group --create-home -K UMASK=0022 --home $(MSCS_HOME) $(MSCS_USER); \
fi
update:
install -m 0755 msctl $(MSCTL)