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. --- sboupgrade | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sboupgrade') diff --git a/sboupgrade b/sboupgrade index 37fb245..81a9a3f 100755 --- a/sboupgrade +++ b/sboupgrade @@ -13,7 +13,7 @@ use 5.16.0; use strict; use warnings FATAL => 'all'; -use SBO::Lib qw/ get_available_updates prompt usage_error slackbuilds_or_fetch uniq get_sbo_location get_inst_names get_installed_packages get_build_queue get_sbo_locations in merge_queues user_prompt process_sbos print_failures %config show_version /; +use SBO::Lib qw/ _ERR_USAGE get_available_updates prompt usage_error slackbuilds_or_fetch uniq get_sbo_location get_inst_names get_installed_packages get_build_queue get_sbo_locations in merge_queues user_prompt process_sbos print_failures %config show_version /; use Getopt::Long qw(:config bundling); use File::Basename; use File::Copy; @@ -71,6 +71,11 @@ GetOptions( if ($help) { show_usage(); exit 0 } if ($vers) { show_version(); exit 0 } +unless ($< == 0) { + warn "This script requires root privileges.\n"; + exit _ERR_USAGE; +} + my $updates; if ($all) { slackbuilds_or_fetch(); -- cgit v1.2.3