nice mod for sudo in snarf linux config
[feisty_meow.git] / scripts / archival / snarf_linux_config.pl
index 0fe2eacadda91aec9853651a0850ecc4fe01873d..1c7ad0427a05fde7e1db9dec6b794d513c133c3f 100644 (file)
@@ -19,6 +19,13 @@ require "shared_snarfer.pl";
 
 use Env qw(HOME);
 
+# make sure we are running as root.  otherwise we have no access to look at many things in /etc.
+if ($< != 0) {
+  printf "This script must be run as root or sudo.  Try this:\n";
+  printf "  sudo -E PERLLIB=\$PERLLIB perl $0 @ARGV\n";
+  exit 1;
+}
+
 &initialize_snarfer;
 
 # get the number we use and increment it for the next use.