aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2012-05-30 16:45:08 +1200
committerTom Ryder <tom@sanctum.geek.nz>2012-05-30 16:45:08 +1200
commit9d4874a617805fd376dedac3bce3272951c02397 (patch)
tree946152829eecbd7ac01ada2d189c45095f4fdfa8
parentSpecify output stream for printing libraries (diff)
downloadclubber-9d4874a617805fd376dedac3bce3272951c02397.tar.gz
clubber-9d4874a617805fd376dedac3bce3272951c02397.zip
Require root only for actual actions
-rwxr-xr-xclubber22
1 files changed, 13 insertions, 9 deletions
diff --git a/clubber b/clubber
index 4e871d1..fda8039 100755
--- a/clubber
+++ b/clubber
@@ -24,13 +24,6 @@ use File::Basename;
use Getopt::Long;
#
-# Bail if we're not root.
-#
-if ($< != 0 || $> != 0) {
- error("You must have root permissions to use this script.");
-}
-
-#
# Check ldd is available.
#
chomp(my $ldd = `which ldd`);
@@ -164,7 +157,7 @@ if ($chroot) {
#
# If we're just supposed to print what we do, all the better, do
- # that and then quit.
+ # that and then quit; and for that, we don't require root privileges.
#
if ($dry) {
if (keys %$directories) {
@@ -181,9 +174,20 @@ if ($chroot) {
}
#
- # Otherwise, we'd best get started.
+ # Otherwise, we'd best get started, and we need root privileges.
#
} else {
+
+ #
+ # Bail if we're not root.
+ #
+ if ($< != 0 || $> != 0) {
+ error("You must have root permissions to use the --chroot parameter.");
+ }
+
+ #
+ # Create directories and import libraries.
+ #
foreach my $directory (keys(%$directories)) {
system("mkdir -pv ${chroot}${directory}");
}