aboutsummaryrefslogtreecommitdiff
path: root/sboclean
diff options
context:
space:
mode:
authorJ Pipkin <j@dawnrazor.net>2013-02-19 13:33:30 -0600
committerJ Pipkin <j@dawnrazor.net>2013-02-19 13:33:30 -0600
commitee472c4f764701bbc78f128622f01cb916f0641a (patch)
treef7d75bc99b1fa594e3a612fd0c055c4688d027ce /sboclean
parent8fe7c4d73b8a2dab3ee3560701b33dc172f2b056 (diff)
downloadsbotools-ee472c4f764701bbc78f128622f01cb916f0641a.tar.xz
support env vars $TMP and $OUTPUT, and clean some excess spaces at the ends of some lines
Diffstat (limited to 'sboclean')
-rwxr-xr-xsboclean11
1 files changed, 9 insertions, 2 deletions
diff --git a/sboclean b/sboclean
index c9ee8c0..52708ed 100755
--- a/sboclean
+++ b/sboclean
@@ -78,7 +78,7 @@ sub remove_stuff($) {
}
sub clean_c32() {
- my $dir = '/tmp';
+ my $dir = $tmpd;
opendir(my $dh, $dir);
FIRST: while (my $ls = readdir $dh) {
next FIRST unless $ls =~ /^package-.+-compat32$/;
@@ -89,7 +89,14 @@ sub clean_c32() {
remove_stuff $config{SBO_HOME} .'/distfiles' if $clean_dist;
if ($clean_work) {
- remove_stuff '/tmp/SBo';
+ my $tsbo = $env_tmp ? $env_tmp : "$tmpd/SBo";
+ if ($tsbo =~ qr#^/tmp(|/)$# && !$interactive) {
+ warn "This will remove the entire contents of /tmp\n";
+ print "Proceed? [y] ";
+ remove_stuff $tsbo if <STDIN> =~ /^[yY\n]/;
+ } else {
+ remove_stuff $tsbo;
+ }
clean_c32;
}