aboutsummaryrefslogtreecommitdiff
path: root/sboconfig
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2025-01-21 16:11:42 -0500
committerSlack Coder <slackcoder@server.ky>2025-01-28 11:31:35 -0500
commit921e9a76f1ca47d30d765f2f2bf61954e8ac9c9c (patch)
treeb2b0fa36ce53922c20538e8e5b4aeff8811eb2e0 /sboconfig
parentda89dd975499f6b228d75fa5f25871911fae658a (diff)
downloadsbotools2-921e9a76f1ca47d30d765f2f2bf61954e8ac9c9c.tar.xz
Avoid requiring root access
Make temporary folder generation lazy to postpone requiring root access until needed.
Diffstat (limited to 'sboconfig')
-rwxr-xr-xsboconfig7
1 files changed, 6 insertions, 1 deletions
diff --git a/sboconfig b/sboconfig
index b245d24..c7ea9b0 100755
--- a/sboconfig
+++ b/sboconfig
@@ -13,7 +13,7 @@
use 5.16.0;
use strict;
use warnings FATAL => 'all';
-use SBO::Lib qw/ slurp usage_error script_error $tempdir open_fh %config $conf_dir $conf_file show_version /;
+use SBO::Lib qw/ _ERR_USAGE slurp usage_error script_error open_fh %config $conf_dir $conf_file show_version /;
use File::Basename;
use Getopt::Long qw(:config no_ignore_case_always);
use File::Copy;
@@ -136,6 +136,11 @@ if (exists $changes{SLACKWARE_VERSION}) {
usage_error("$warn -V") unless $changes{SLACKWARE_VERSION} =~ m/^(\d+\.\d+|FALSE)$/;
}
+unless ($< == 0) {
+ warn "This script requires root privileges.\n";
+ exit _ERR_USAGE;
+}
+
sub config_write {
script_error('config_write requires at least two arguments.') unless @_ >= 2;