add root check since it's required
authorJeff Atwood <jatwood@codinghorror.com>
Tue, 10 May 2016 22:20:39 +0000 (15:20 -0700)
committerJeff Atwood <jatwood@codinghorror.com>
Tue, 10 May 2016 22:20:39 +0000 (15:20 -0700)
discourse-setup

index 268fa0365e8789a0ed6bbd88e441ae130895f2cc..d05d3fb137c16aa545c336f61a208a8747cc4f88 100755 (executable)
@@ -1,5 +1,15 @@
 #!/bin/bash
 
+##
+## Make sure only root can run our script
+##
+check_root() {
+  if [[ $EUID -ne 0 ]]; then
+    echo "This script must be run as root. Please sudo or log in as root first." 1>&2
+    exit 1
+  fi
+}
+
 ##
 ## Do we have enough memory and disk space for Discourse?
 ##
@@ -389,6 +399,7 @@ changelog=/tmp/changelog
 ##
 ## Check requirements before creating a copy of a config file we won't edit
 ##
+check_root
 check_disk_and_memory
 check_ports