summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/sys.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 01abaf2b..d398120f 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -1,5 +1,7 @@
package urpm::sys;
+# $Id$
+
use strict;
#- find used mount point from a pathname, use a optional mode to allow
@@ -150,4 +152,18 @@ sub apply_delta_rpm {
-e $rpm ? $rpm : '';
}
+our $tempdir_template = '/tmp/urpm.XXXXXX';
+sub mktempdir {
+ my $tmpdir;
+ eval { require File::Temp };
+ if ($@) {
+ #- fall back to external command (File::Temp not in perl-base)
+ $tmpdir = qx(mktemp -d $tempdir_template);
+ chomp $tmpdir;
+ } else {
+ $tmpdir = File::Temp::tempdir($tempdir_template);
+ }
+ return $tmpdir;
+}
+
1;