aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Pipkin <j@dawnrazor.net>2012-09-02 00:05:39 -0500
committerJacob Pipkin <j@dawnrazor.net>2012-09-02 00:05:39 -0500
commitae4a6e80488279460453a387d28fc08219a0341a (patch)
treef43ad1a4c0fadb62bde242d47af1037a00d75108
parenteb394521aabc27b9918c84a2fc6eb7571f577510 (diff)
downloadsbotools2-ae4a6e80488279460453a387d28fc08219a0341a.tar.xz
sanity checks for sboconfig
-rwxr-xr-xsboconfig18
1 files changed, 16 insertions, 2 deletions
diff --git a/sboconfig b/sboconfig
index 27d3353..85d4886 100755
--- a/sboconfig
+++ b/sboconfig
@@ -74,9 +74,23 @@ my %changes;
while (my ($key, $value) = each %valid_confs) {
$changes{$value} = $options{$key} if exists $options{$key};
}
+
+my $die = "You have provided an invalid parameter for";
+
+if (exists $changes{NOCLEAN}) {
+ die "$die -c\n" unless $changes{NOCLEAN} =~ /^(TRUE|FALSE)$/;
+}
+if (exists $changes{DISTCLEAN}) {
+ die "$die -d\n" unless $changes{DISTCLEAN} =~ /^(TRUE|FALSE)$/;
+}
if (exists $changes{JOBS}) {
- die "You have provided an invalid parameter for -j\n" unless
- ($changes{JOBS} =~ /^\d+$/ || $changes{JOBS} eq 'FALSE');
+ die "$die -j\n" unless $changes{JOBS} =~ /^(\d+|FALSE)$/;
+}
+if (exists $changes{PKG_DIR}) {
+ die "$die -p\n" unless $changes{PKG_DIR} =~ qr#^(/|FALSE$)#;
+}
+if (exists $changes{SBO_HOME}) {
+ die "$die -s\n" unless $changes{SBO_HOME} =~ qr#^/#;
}
# safely modify our conf file; write its contents to a temp file, modify the