From 0469b0319575c2878a677ffca547c61c746c7161 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 30 Jan 2004 19:23:16 +0000 Subject: add gurpmi.addmedia for "Add an Urpmi source in one click" spec --- gurpmi.addmedia | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 gurpmi.addmedia (limited to 'gurpmi.addmedia') diff --git a/gurpmi.addmedia b/gurpmi.addmedia new file mode 100755 index 00000000..64c44adc --- /dev/null +++ b/gurpmi.addmedia @@ -0,0 +1,54 @@ +#!/usr/bin/perl +#***************************************************************************** +# +# Copyright (c) 2004 Guillaume Cottenceau (gc at mandrakesoft dot com) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#***************************************************************************** +# +# $Id$ + + +use strict; +use lib qw(/usr/lib/libDrakX); +use common; + +require_root_capability(); + +use rpmdrake; + +eval { require ugtk2; ugtk2->import(qw(:all)) }; +if ($@) { + print "This program cannot be run in console mode.\n"; + c::_exit(0); #- skip ugtk2::END +} +$::isStandalone = 1; + +my $update = 0; +if ($ARGV[0] =~ /-?-update/) { + $update = 1; + unshift @ARGV; +} +my ($name, $url, $with, $with_hdlist) = @ARGV; +if ($url !~ m,^(file://|ftp://|http://|removable://), || $with && !$with_hdlist) { + interactive_msg('gurpmi.addmedia', + N("Unable to add medium, wrong or missing arguments")); + exit(-1); +} + +my $urpm = urpm->new; +$urpm->read_config; +add_medium_and_check($urpm, { probe_with => !$with }, $name, $url, $with_hdlist, update => $update); + -- cgit v1.2.1