aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-05-28 15:53:19 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-05-28 15:53:19 +0000
commit4dfd979264401bdf01323336f3d8eb30f9184309 (patch)
tree2946983fe1328018c238dab6bf4fec7d9a2c8113
parentb0413e270babfaf403171cd5386059eccb5a7104 (diff)
downloadrpmdrake-4dfd979264401bdf01323336f3d8eb30f9184309.tar
rpmdrake-4dfd979264401bdf01323336f3d8eb30f9184309.tar.gz
rpmdrake-4dfd979264401bdf01323336f3d8eb30f9184309.tar.bz2
rpmdrake-4dfd979264401bdf01323336f3d8eb30f9184309.tar.xz
rpmdrake-4dfd979264401bdf01323336f3d8eb30f9184309.zip
add ability to run the rpmdrake suite as a user (you can browse
packages but can't modify the system)
-rwxr-xr-xrpmdrake23
-rw-r--r--rpmdrake.spec2
2 files changed, 16 insertions, 9 deletions
diff --git a/rpmdrake b/rpmdrake
index 6feeb429..47d539b3 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -41,15 +41,12 @@ use common;
use rpmdrake;
use gurpm;
-require_root_capability();
-
eval { require ugtk2; ugtk2->import(qw(:all)) };
if ($@) {
print "This program cannot be run in console mode.\n";
c::_exit(0); #- skip ugtk2::END
}
-
$MODE = 'install';
$0 =~ m|/rpmdrake-remove$| and $MODE = 'remove';
$0 =~ m|/MandrakeUpdate$| and $MODE = 'update';
@@ -64,6 +61,12 @@ sub interactive_msg_ { interactive_msg(@_, if_(exists $w->{rwindow}, transient
sub interactive_list_ { interactive_list(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) };
sub wait_msg_ { wait_msg(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) };
+$> and interactive_msg_(N("Running in user mode"),
+N("You are launching this program as a normal user.
+You will not be able to perform modifications on the system,
+but you may still browse the existing database."), yesno => 1, text => { yes => N("Ok"), no => N("Cancel") }) or myexit(0);
+
+
sub ctreefy { $_[0] =~ s,/,|,g; $_[0] }
sub beautify_description {
@@ -131,14 +134,16 @@ sub extract_header {
add2hash($pkg, { files => chomp_(scalar(`rpm -ql $name`)) || N("(none)"),
changelog => $chg_prepro->(scalar(`LC_ALL=C rpm -q --changelog $name`)) });
} else {
- my ($headersdir, $p, $medium) = ('/root/tmp/headers/', $pkg->{pkg}, pkg2medium($pkg->{pkg}, $urpm));
+ my ($p, $medium) = ($pkg->{pkg}, pkg2medium($pkg->{pkg}, $urpm));
my $hdlist = "$urpm->{statedir}/$medium->{hdlist}";
if (-r $hdlist) { #- packdrake segfaults when giving a missing file :(
standalone::explanations("Extracting header of " . $p->header_filename . " from $hdlist");
my $packer;
eval { $packer = new packdrake($hdlist, quiet => 1) } or log::l("Warning, hdlist seems corrupted :-("), goto header_non_available;
+ my $headersdir = chomp_(`mktemp -d /tmp/rpmdrake.XXXXXX`);
+ -d $headersdir or die "Could not create temporary directory";
$packer->extract_archive($headersdir, $p->header_filename);
- $p->update_header($headersdir . $p->header_filename) or log::l("Warning, could not extract header!"), goto header_non_available;
+ $p->update_header("$headersdir/" . $p->header_filename) or log::l("Warning, could not extract header!"), goto header_non_available;
rm_rf($headersdir);
add2hash($pkg, { summary => $p->summary, description => beautify_description($p->description) });
my $localtime2changelog = sub { scalar(localtime($_[0])) =~ /(.*) \S+ (\d{4})$/ && "$1 $2" };
@@ -767,12 +772,12 @@ Is it ok to continue?", $formatlistpkg->(sort { $a cmp $b } keys %{$urpm->{state
}),
1, my $status = Gtk2::Label->new,
0, gtkpack(Gtk2::HBox->new(1, 20),
- gtksignal_connect(Gtk2::Button->new(but_($MODE eq 'remove' ? N("Remove")
- : N("Install"))),
- clicked => sub { $do_action->() }),
+ my $action_button = gtksignal_connect(Gtk2::Button->new(but_($MODE eq 'remove' ? N("Remove") : N("Install"))),
+ clicked => sub { $do_action->() }),
gtksignal_connect(Gtk2::Button->new(but_(N("Quit"))),
clicked => sub { Gtk2->main_quit })))
))));
+ $> and $action_button->set_sensitive(0);
my $pixbuf_icon = gtkcreate_pixbuf("title-$MODE");
$darea->modify_font(Gtk2::Pango::FontDescription->from_string('Sans Italic 24'));
my %t = (remove => N("Software Packages Removal"), update => N("Mandrake Update"), install => N("Software Packages Installation"));
@@ -1175,7 +1180,7 @@ if ($options{'merge-all-rpmnew'}) {
readconf();
-if (!member($MODE, @$already_splashed)) {
+if (!$> && !member($MODE, @$already_splashed)) {
interactive_msg('rpmdrake',
N("%s
diff --git a/rpmdrake.spec b/rpmdrake.spec
index 5752a0dd..367ec064 100644
--- a/rpmdrake.spec
+++ b/rpmdrake.spec
@@ -103,6 +103,8 @@ rm -rf $RPM_BUILD_ROOT
- fix some distlint DIRM
- let medias be reorderable in the medias editor (drag and drop the list)
- add ability to list leaves (sorted by installation date) in remove mode
+- add ability to run the rpmdrake suite as a user (you can browse
+ packages but can't modify the system)
* Fri May 16 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-20mdk
- perl-URPM API change: gives architecture in ask_remove