From 921e9a76f1ca47d30d765f2f2bf61954e8ac9c9c Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Tue, 21 Jan 2025 16:11:42 -0500 Subject: Avoid requiring root access Make temporary folder generation lazy to postpone requiring root access until needed. --- sboinstall | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sboinstall') diff --git a/sboinstall b/sboinstall index 156b41b..73fb2f4 100755 --- a/sboinstall +++ b/sboinstall @@ -13,7 +13,7 @@ use 5.16.0; use strict; use warnings FATAL => 'all'; -use SBO::Lib qw/ %config _ERR_OPENFH get_arch get_build_queue get_installed_cpans get_installed_packages get_sbo_location get_sbo_locations in merge_queues open_fh print_failures process_sbos prompt show_version slackbuilds_or_fetch slurp usage_error user_prompt /; +use SBO::Lib qw/ %config _ERR_USAGE _ERR_OPENFH get_arch get_build_queue get_installed_cpans get_installed_packages get_sbo_location get_sbo_locations in merge_queues open_fh print_failures process_sbos prompt show_version slackbuilds_or_fetch slurp usage_error user_prompt /; use Getopt::Long qw(:config bundling); use File::Basename; use JSON::PP; @@ -95,6 +95,11 @@ if ($compat32) { usage_error("compat32 only works on x86_64.") unless get_arch eq 'x86_64'; } +unless ($< == 0) { + warn "This script requires root privileges.\n"; + exit _ERR_USAGE; +} + # if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree slackbuilds_or_fetch(); -- cgit v1.2.3