]> arthur.barton.de Git - usertools.macosx.git/commitdiff
Make sure that the script is running with root privileges
authorAlexander Barton <alex@barton.de>
Mon, 28 Sep 2009 10:17:14 +0000 (12:17 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 28 Sep 2009 10:17:14 +0000 (12:17 +0200)
useradd.macosx.sh

index 0bebb0c3c2a05c5ac5892d3aae8c5077fdc65fa6..5382ec02d84baf49073751a179f392b936e0971e 100755 (executable)
@@ -111,6 +111,8 @@ done
 [ -n "$home_dir" ] || home_dir="/Users/$user_name"
 [ -n "$shell" ] || shell="/bin/bash"
 
+[ "$UID" -eq 0 ] || Abort "This script must be run as root!"
+
 # Check that directory services are running
 launchctl list 2>/dev/null | fgrep "com.apple.DirectoryServices" >/dev/null 2>&1
 if [ $? -ne 0 ]; then
@@ -184,4 +186,4 @@ chmod 755 "$home_dir" || Abort
 echo "User '$user_name' ($user_id) has been created."
 exit 0
 
-# -eof-
\ No newline at end of file
+# -eof-