summaryrefslogtreecommitdiffstats
path: root/urpmi.addmedia
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-15 04:43:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-15 04:43:19 +0000
commit0d619a8d67fa2820e1b1ace2762448f5c733d5c0 (patch)
tree260324c43759d3248047c99dc1322239c33c18b2 /urpmi.addmedia
parent527c9cd9e7f01b7fe390ca4a15622ddb1542b925 (diff)
downloadurpmi-0d619a8d67fa2820e1b1ace2762448f5c733d5c0.tar
urpmi-0d619a8d67fa2820e1b1ace2762448f5c733d5c0.tar.gz
urpmi-0d619a8d67fa2820e1b1ace2762448f5c733d5c0.tar.bz2
urpmi-0d619a8d67fa2820e1b1ace2762448f5c733d5c0.tar.xz
urpmi-0d619a8d67fa2820e1b1ace2762448f5c733d5c0.zip
Create the configuration file when adding a media if it's not found
Diffstat (limited to 'urpmi.addmedia')
-rwxr-xr-xurpmi.addmedia4
1 files changed, 4 insertions, 0 deletions
diff --git a/urpmi.addmedia b/urpmi.addmedia
index e02d528b..c382da5c 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -114,6 +114,10 @@ sub main {
if ($< != 0) {
$urpm->{fatal}(1, N("Only superuser is allowed to add media"));
}
+ if (!-e $urpm->{config}) {
+ $urpm->{error}(N("Will create config file [%s]", $urpm->{config}));
+ open my $f, '>', $urpm->{config} or $urpm->{fatal}(6, N("Can't create config file [%s]", $urpm->{config}));
+ }
$urpm->read_config;
exists $options{limit_rate} or $options{limit_rate} = $urpm->{options}{'limit-rate'};