aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-01-30 19:23:16 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-01-30 19:23:16 +0000
commit0469b0319575c2878a677ffca547c61c746c7161 (patch)
tree179b6a88b0559f4bee62f160805fb615afc3d4ce
parent5cdb2d353ed1c711d62530d1b09b6596b199c957 (diff)
downloadrpmdrake-0469b0319575c2878a677ffca547c61c746c7161.tar
rpmdrake-0469b0319575c2878a677ffca547c61c746c7161.tar.gz
rpmdrake-0469b0319575c2878a677ffca547c61c746c7161.tar.bz2
rpmdrake-0469b0319575c2878a677ffca547c61c746c7161.tar.xz
rpmdrake-0469b0319575c2878a677ffca547c61c746c7161.zip
add gurpmi.addmedia for "Add an Urpmi source in one click" spec
-rw-r--r--Makefile3
-rwxr-xr-xgurpmi.addmedia54
-rw-r--r--po/Makefile2
-rw-r--r--rpmdrake.spec3
4 files changed, 60 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 16c2f062..9188f8ac 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ install: $(ALL)
(cd $$n; $(MAKE) install) \
done
install -d $(SBINDIR)
- install rpmdrake edit-urpm-sources.pl $(SBINDIR)
+ install rpmdrake edit-urpm-sources.pl gurpmi.addmedia $(SBINDIR)
ln -sf edit-urpm-sources.pl $(SBINDIR)/edit-urpm-media
perl -pi -e 's|use strict.*||;s|use vars.*||;s|use diagnostics.*||;s|#-.*||' $(SBINDIR)/*
ln -sf rpmdrake $(SBINDIR)/rpmdrake-remove
@@ -47,6 +47,7 @@ install: $(ALL)
ln -sf $(RELATIVE_SBIN)/rpmdrake-remove $(BINDIR)/rpmdrake-remove
ln -sf $(RELATIVE_SBIN)/MandrakeUpdate $(BINDIR)/MandrakeUpdate
ln -sf $(RELATIVE_SBIN)/edit-urpm-sources.pl $(BINDIR)/edit-urpm-sources.pl
+ ln -sf $(RELATIVE_SBIN)/gurpmi.addmedia $(BINDIR)/gurpmi.addmedia
ln -sf $(RELATIVE_SBIN)/rpmdrake $(BINDIR)/drakrpm
ln -sf $(RELATIVE_SBIN)/rpmdrake-remove $(BINDIR)/drakrpm-remove
ln -sf $(RELATIVE_SBIN)/MandrakeUpdate $(BINDIR)/drakrpm-update
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);
+
diff --git a/po/Makefile b/po/Makefile
index bc3ae275..54f283e3 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -2,7 +2,7 @@
PGOAL = rpmdrake
# perl files to search translatable strings in
-PL_FILES = ../rpmdrake ../edit-urpm-sources.pl ../rpmdrake.pm
+PL_FILES = ../rpmdrake ../edit-urpm-sources.pl ../rpmdrake.pm ../gurpmi.addmedia
CFILES = ../grpmi/curl_download/curl_download.xs
POFILES = $(wildcard *.po)
diff --git a/rpmdrake.spec b/rpmdrake.spec
index 194e27c4..00b9bace 100644
--- a/rpmdrake.spec
+++ b/rpmdrake.spec
@@ -89,6 +89,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sbindir}/rpmdrake*
%{_sbindir}/MandrakeUpdate
%{_sbindir}/edit-urpm-*
+%{_sbindir}/gurpmi.addmedia
%{_bindir}/*
%{_datadir}/%{name}
%{perl_vendorlib}/*.pm
@@ -104,6 +105,8 @@ rm -rf $RPM_BUILD_ROOT
* Wed Jan 21 2004 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1.2-2mdk
- remove unneeded stuff from grpmi/po/*.po
- fix garbled characters for fatal and error msgs reported by urpm
+- report more errors when adding a medium
+- add gurpmi.addmedia
* Thu Jan 15 2004 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1.2-1mdk
- add ability to use rpmdrake/rpmdrake-remove with a "parallel"