git.iko.soy/typeable/nixpkgs
on master help sign in
Revert "Merge pull request #28206 from edef1c/net-dbus-list-units"

This reverts commit e508f0eec142c978f6b77bf96b3887471c7fc807, reversing changes made to bead42df5d400aba2e8686988dc39ca0f1f9e131.

commitca30c5e061ec794d42c78718e68993dd460af2bb authorMatthew Bauer <mjbauer95@gmail.com> dateWed 2 May 2018, 15:02 (9 years ago) parent93dc75d
2 files changed+11−11
nixos/modules/system/activation/switch-to-configuration.pl+10−9 nixos/modules/system/activation/top-level.nix+1−2
nixos/modules/system/activation/switch-to-configuration.pl+10−9
@@ -4,7 +4,6 @@ use strict;
44use warnings;
55use File::Basename;
66use File::Slurp;
7−use Net::DBus;
87use Sys::Syslog qw(:standard :macros);
98use Cwd 'abs_path';
109
@@ -68,15 +67,17 @@ EOF
6867$SIG{PIPE} = "IGNORE";
6968
7069sub getActiveUnits {
71− my $mgr = Net::DBus->system->get_service("org.freedesktop.systemd1")->get_object("/org/freedesktop/systemd1");
72− my $units = $mgr->ListUnitsByPatterns([], []);
70+ # FIXME: use D-Bus or whatever to query this, since parsing the
71+ # output of list-units is likely to break.
72+ # Use current version of systemctl binary before daemon is reexeced.
73+ my $lines = `LANG= /run/current-system/sw/bin/systemctl list-units --full --no-legend`;
7374 my $res = {};
74− for my $item (@$units) {
75− my ($id, $description, $load_state, $active_state, $sub_state,
76− $following, $unit_path, $job_id, $job_type, $job_path) = @$item;
77− next unless $following eq '';
78− next if $job_id == 0 and $active_state eq 'inactive';
79− $res->{$id} = { load => $load_state, state => $active_state, substate => $sub_state };
75+ foreach my $line (split '\n', $lines) {
76+ chomp $line;
77+ last if $line eq "";
78+ $line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s/ or next;
79+ next if $1 eq "UNIT";
80+ $res->{$1} = { load => $2, state => $3, substate => $4 };
8081 }
8182 return $res;
8283}
nixos/modules/system/activation/top-level.nix+1−2
@@ -127,8 +127,7 @@ let
127127 configurationName = config.boot.loader.grub.configurationName;
128128
129129 # Needed by switch-to-configuration.
130−
131− perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
130+ perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
132131 } else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
133132
134133 # Replace runtime dependencies