diff options
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 17 | ||||
-rw-r--r-- | man1/sboclean.1 | 4 | ||||
-rwxr-xr-x | sboclean | 2 |
3 files changed, 9 insertions, 14 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 00db2bd..358ea15 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -92,7 +92,8 @@ use Fcntl qw(F_SETFD F_GETFD); # times where it doesn't matter. our $env_tmp; $env_tmp = $ENV{TMP} if defined $ENV{TMP}; -our $tmpd = $env_tmp ? $env_tmp : '/tmp'; +our $tmpd = $env_tmp ? $env_tmp : '/tmp/SBo'; +make_path($tmpd) unless -d $tmpd; our $tempdir = tempdir(CLEANUP => 1, DIR => $tmpd); @@ -703,8 +704,7 @@ sub get_src_dir { seek $fh, 0, 0; my @src_dirs; # scripts use either $TMP or /tmp/SBo - my $tsbo = $env_tmp ? $env_tmp : "$tmpd/SBo"; - if (opendir(my $tsbo_dh, $tsbo)) { + if (opendir(my $tsbo_dh, $tmpd)) { FIRST: while (my $ls = readdir $tsbo_dh) { next FIRST if $ls =~ /^\.[\.]{0,1}$/; next FIRST if $ls =~ /^package-/; @@ -768,8 +768,7 @@ sub perform_sbo { # we need to get a listing of /tmp/SBo, or $TMP, if we can, before we run # the SlackBuild so that we can compare to a listing taken afterward. my $src_ls_fh = tempfile(DIR => $tempdir); - my $tsbo = $env_tmp ? $env_tmp : "$tmpd/SBo"; - if (opendir(my $tsbo_dh, '/tmp/SBo')) { + if (opendir(my $tsbo_dh, $tmpd)) { FIRST: while (my $dir = readdir $tsbo_dh) { next FIRST if $dir =~ /^\.[\.]{0,1}$/; say {$src_ls_fh} $dir; @@ -891,15 +890,11 @@ sub make_clean { } my $src = $args{SRC}; say "Cleaning for $args{SBO}-$args{VERSION}..."; - my $tmpsbo = $env_tmp ? $env_tmp : "$tmpd/SBo"; for my $dir (@$src) { - remove_tree("$tmpsbo/$dir") if -d "$tmpsbo/$dir"; + remove_tree("$tempdir/$dir") if -d "$tempdir/$dir"; } - remove_tree("$tmpsbo/package-$args{SBO}") if - -d "$tmpsbo/package-$args{SBO}"; - # clean up after convertpkg-compat32 remove_tree("$tmpd/package-$args{SBO}") if - -d "$tmpd/package-$args{SBO}" and $args{SBO} =~ /-compat32$/; + -d "$tmpd/package-$args{SBO}"; return 1; } diff --git a/man1/sboclean.1 b/man1/sboclean.1 index 01c0928..3cdebb2 100644 --- a/man1/sboclean.1 +++ b/man1/sboclean.1 @@ -7,7 +7,7 @@ sboclean - clean files left around by sbotools. sboclean [-h|-v] [-dwi] .SH DESCRIPTION .P -sboclean is used to clean files left around by sbotools, such as downloaded source files ("distfiles"), or work directories under /tmp/SBo (or $TMP) and, for compat32 installs, under /tmp (or $TMP). Note that if not run with the -i flag, sboclean will remove anything in the distfiles or /tmp/SBo (or $TMP) folders and any /tmp/package-*-compat32 (or $TMP/package-*-compat32) directories with extreme prejudice. One of either -d or -w must be specified for this script to do anything. +sboclean is used to clean files left around by sbotools, such as downloaded source files ("distfiles"), or work directories under /tmp/SBo (or $TMP). Note that if not run with the -i flag, sboclean will remove anything in the distfiles or /tmp/SBo (or $TMP) directories with extreme prejudice. One of either -d or -w must be specified for this script to do anything. .SH OPTIONS .P -h|--help @@ -27,7 +27,7 @@ Clean distfiles, by default located at /usr/sbo/distfiles. .P -w|--clean-work .RS -Clean working directories, located, by default under /tmp/SBo and, for compat32 installs, by default, /tmp. +Clean working directories, located, by default under /tmp/SBo. .RE .P -i|--interactive @@ -90,7 +90,7 @@ remove_stuff($config{SBO_HOME} .'/distfiles') if $clean_dist; if ($clean_work) { my $env_tmp = $SBO::Lib::env_tmp; - my $tsbo = $env_tmp ? $env_tmp : "$SBO::Lib::tmpd/SBo"; + my $tsbo = $SBO::Lib::tmpd; if ($env_tmp && !$interactive) { warn "This will remove the entire contents of $env_tmp\n"; print "Proceed? [y] "; |