summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-29 17:36:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-29 17:36:22 +0000
commit793ffb634a65a9f1ddd6037b4997637dc36d8562 (patch)
treebf59038f82f6a9e8c48f7fd4acc5aac1262b0c4a /urpm.pm
parent3d1e5919b28e63bd9a90aef4aafba1b9bded4a65 (diff)
downloadurpmi-793ffb634a65a9f1ddd6037b4997637dc36d8562.tar
urpmi-793ffb634a65a9f1ddd6037b4997637dc36d8562.tar.gz
urpmi-793ffb634a65a9f1ddd6037b4997637dc36d8562.tar.bz2
urpmi-793ffb634a65a9f1ddd6037b4997637dc36d8562.tar.xz
urpmi-793ffb634a65a9f1ddd6037b4997637dc36d8562.zip
fix typo
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm28
1 files changed, 22 insertions, 6 deletions
diff --git a/urpm.pm b/urpm.pm
index 685f3543..403d2fbc 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -34,12 +34,6 @@ sub new {
depslist => [],
provides => {},
- config => "/etc/urpmi/urpmi.cfg",
- skiplist => "/etc/urpmi/skip.list",
- instlist => "/etc/urpmi/inst.list",
- private_netrc => "/etc/urpmi/netrc",
- statedir => "/var/lib/urpmi",
- cachedir => "/var/cache/urpmi",
media => undef,
options => {},
@@ -53,10 +47,32 @@ sub new {
ref $self->{ui} && ref $self->{ui}{msg} and $self->{ui}{msg}->($_[1]);
},
}, $class;
+
+ set_files($self, '');
$self->set_nofatal(1);
$self;
}
+sub set_files {
+ my ($urpm, $urpmi_root) = @_;
+ my %h = (
+ config => "$urpmi_root/etc/urpmi/urpmi.cfg",
+ skiplist => "$urpmi_root/etc/urpmi/skip.list",
+ instlist => "$urpmi_root/etc/urpmi/inst.list",
+ private_netrc => "$urpmi_root/etc/urpmi/netrc",
+ statedir => "$urpmi_root/var/lib/urpmi",
+ cachedir => "$urpmi_root/var/cache/urpmi",
+ root => $urpmi_root,
+ $urpmi_root ? (urpmi_root => $urpmi_root) : (),
+ );
+ $urpm->{$_} = $h{$_} foreach keys %h;
+
+ require File::Path;
+ File::Path::mkpath([ $h{statedir},
+ (map { "$h{cachedir}/$_" } qw(headers partial rpms)),
+ dirname($h{config}) ]);
+}
+
sub protocol_from_url {
my ($url) = @_;
$url =~ m!^(\w+)(_[^:]*)?:! && $1;