summary refs log tree commit diff
path: root/nixos/modules/system/activation
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-05-02 15:02:29 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-05-02 15:02:29 -0500
commitca30c5e061ec794d42c78718e68993dd460af2bb (patch)
treeac08058e6aeeaaf5ebf05b26b61df24cc14a8dd6 /nixos/modules/system/activation
parent93dc75d98a22a1dca2c458d0e73cbe23a54e46e5 (diff)
downloadnixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar.gz
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar.bz2
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar.lz
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar.xz
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.tar.zst
nixlib-ca30c5e061ec794d42c78718e68993dd460af2bb.zip
Revert "Merge pull request #28206 from edef1c/net-dbus-list-units"
This reverts commit e508f0eec142c978f6b77bf96b3887471c7fc807, reversing
changes made to bead42df5d400aba2e8686988dc39ca0f1f9e131.
Diffstat (limited to 'nixos/modules/system/activation')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl19
-rw-r--r--nixos/modules/system/activation/top-level.nix3
2 files changed, 11 insertions, 11 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 2ce04ed5342c..87a4ab2a586d 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 use File::Basename;
 use File::Slurp;
-use Net::DBus;
 use Sys::Syslog qw(:standard :macros);
 use Cwd 'abs_path';
 
@@ -68,15 +67,17 @@ EOF
 $SIG{PIPE} = "IGNORE";
 
 sub getActiveUnits {
-    my $mgr = Net::DBus->system->get_service("org.freedesktop.systemd1")->get_object("/org/freedesktop/systemd1");
-    my $units = $mgr->ListUnitsByPatterns([], []);
+    # FIXME: use D-Bus or whatever to query this, since parsing the
+    # output of list-units is likely to break.
+    # Use current version of systemctl binary before daemon is reexeced.
+    my $lines = `LANG= /run/current-system/sw/bin/systemctl list-units --full --no-legend`;
     my $res = {};
-    for my $item (@$units) {
-        my ($id, $description, $load_state, $active_state, $sub_state,
-            $following, $unit_path, $job_id, $job_type, $job_path) = @$item;
-        next unless $following eq '';
-        next if $job_id == 0 and $active_state eq 'inactive';
-        $res->{$id} = { load => $load_state, state => $active_state, substate => $sub_state };
+    foreach my $line (split '\n', $lines) {
+        chomp $line;
+        last if $line eq "";
+        $line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s/ or next;
+        next if $1 eq "UNIT";
+        $res->{$1} = { load => $2, state => $3, substate => $4 };
     }
     return $res;
 }
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index f4af9a580fde..091a2e412eed 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -127,8 +127,7 @@ let
       configurationName = config.boot.loader.grub.configurationName;
 
       # Needed by switch-to-configuration.
-
-      perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
+      perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
   } else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
 
   # Replace runtime dependencies