From 08947a0d754cfc1e64fb7cfec5619b7d06f44f05 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sun, 13 Jan 2013 06:30:12 -0600 Subject: add support to sboclean -w for /tmp/package-*-compat32 things --- sboclean | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 3835de7..3a43ade 100755 --- a/sboclean +++ b/sboclean @@ -54,24 +54,42 @@ show_version and exit 0 if $vers; usage_error "You must specify at least one of -d or -w." unless ($clean_dist || $clean_work); +sub rm_full($) { + exists $_[0] or script_error 'rm_full requires an argument.'; + my $full = shift; + if ($interactive) { + print "Remove $full? [n] "; + return unless =~ /^[Yy]/; + } + unlink $full if -f $full; + remove_tree($full) if -d $full; + return 1; +} + sub remove_stuff($) { - exists $_[0] or script_error 'remove_stuff requires an argument'; + exists $_[0] or script_error 'remove_stuff requires an argument.'; -d $_[0] or say 'Nothing to do.' and return 1; my $dir = shift; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST if $ls =~ /^(\.){1,2}$/; - my $full = "$dir/$ls"; - if ($interactive) { - print "Remove $full? [n] "; - next FIRST unless =~ /^[Yy]/; - } - unlink $full if -f $full; - remove_tree($full) if -d $full; + rm_full "$dir/$ls"; } } +sub clean_c32() { + opendir(my $dh, '/tmp/'); + FIRST: while (my $ls = readdir $dh) { + next FIRST unless $ls =~ /^package-.+-compat32$/; + rm_full "$dir/$ls"; + } +{ + remove_stuff $config{SBO_HOME} .'/distfiles' if $clean_dist; -remove_stuff '/tmp/SBo' if $clean_work; + +if ($clean_work) { + remove_stuff '/tmp/SBo'; + clean_c32; +} exit 0; -- cgit v1.2.3