diff options
author | carlosg <carlosg> | 2005-12-05 12:12:25 +0000 |
---|---|---|
committer | carlosg <carlosg> | 2005-12-05 12:12:25 +0000 |
commit | 071e8013cf949eb6d94876581cf73f463dc2e5f2 (patch) | |
tree | 26762764667c49ac032d1976a049af34b1400115 | |
parent | dd40f207332042d0b201a6b100a06c8d4794a463 (diff) |
2005-12-05 Carlos Garnacho Parro <carlosg@gnome.org>
* Loader.pl.in, Utils/Backend.pm: add --system parameter, to run the
backends in the system bus
* Users/Users.pm: fix the code for the root case (number of parameters
mismatch)
* test-backends: cosmetic fix
-rw-r--r-- | ChangeLog | 8 | ||||
-rwxr-xr-x | Loader.pl.in | 2 | ||||
-rw-r--r-- | Users/Users.pm | 7 | ||||
-rw-r--r-- | Utils/Backend.pm | 16 | ||||
-rwxr-xr-x | test-backends | 2 |
5 files changed, 32 insertions, 3 deletions
@@ -1,3 +1,11 @@ +2005-12-05 Carlos Garnacho Parro <carlosg@gnome.org> + + * Loader.pl.in, Utils/Backend.pm: add --system parameter, to run the + backends in the system bus + * Users/Users.pm: fix the code for the root case (number of parameters + mismatch) + * test-backends: cosmetic fix + 2005-11-20 Carlos Garnacho Parro <carlosg@gnome.org> * GroupsConfig.pm, Users/Groups.pm: removed id from the group struct diff --git a/Loader.pl.in b/Loader.pl.in index 7ec5ea5..ecd7c62 100755 --- a/Loader.pl.in +++ b/Loader.pl.in @@ -49,7 +49,7 @@ use ServicesConfig; &Utils::Backend::init ($name, $version, $description, $directives, @ARGV); # Initialize bus -my $bus = Net::DBus->session(); +my $bus = &Utils::Backend::get_bus (); my $service = $bus->export_service ($Utils::Backend::DBUS_PREFIX); my $reactor = Net::DBus::Reactor->new(); diff --git a/Users/Users.pm b/Users/Users.pm index b0bf196..d2c13ab 100644 --- a/Users/Users.pm +++ b/Users/Users.pm @@ -416,6 +416,9 @@ sub get $login = $line[$LOGIN]; @comment = split ',', $line[$COMMENT], 5; + + # we need to make sure that there are 5 elements + push @comment, "" while (scalar (@comment) < 5); $line[$COMMENT] = [@comment]; $$users_hash{$login} = [@line]; @@ -438,7 +441,9 @@ sub get $passwd = shift @line; $$users_hash{$login}[$PASSWD] = $passwd; - push @{$$users_hash{$login}}, @line; + + # FIXME: add the rest of the fields? + #push @{$$users_hash{$login}}, @line; } &Utils::File::close_file ($ifh); diff --git a/Utils/Backend.pm b/Utils/Backend.pm index 91ced14..b144833 100644 --- a/Utils/Backend.pm +++ b/Utils/Backend.pm @@ -72,6 +72,7 @@ else our $prefix = ""; our $do_verbose = 0; our $do_report = 0; +our $system_bus = 0; sub print_usage_synopsis { @@ -252,6 +253,14 @@ sub set_dist $gst_dist = $dist; } +sub set_system_bus +{ + my ($tool) = @_; + + &set_with_param ($tool, "system-bus", 1); + $system_bus = 1; +} + sub merge_std_directives { my ($tool) = @_; @@ -328,6 +337,7 @@ sub init elsif ($arg eq "--version") { &print_version (\%tool, 0); } elsif ($arg eq "--prefix" || $arg eq "-p") { &set_prefix (\%tool, shift @args); } elsif ($arg eq "--platform") { &set_dist (\%tool, shift @args); } + elsif ($arg eq "--system") { &set_system_bus (\%tool); } elsif ($arg eq "--verbose" || $arg eq "-v") { $tool{"do_verbose"} = $do_verbose = 1; @@ -601,4 +611,10 @@ sub run } } +sub get_bus +{ + return Net::DBus->system if ($system_bus); + return Net::DBus->session; +} + 1; diff --git a/test-backends b/test-backends index c9d14c4..56abf74 100755 --- a/test-backends +++ b/test-backends @@ -62,7 +62,7 @@ sub print_object } # Main program -my $bus = Net::DBus->session(); +my $bus = Net::DBus->session; my $service = $bus->get_service("org.freedesktop.SystemToolsBackends"); if (!$ARGV[0]) |