Merge pull request #88492 from flokli/current-system-systemctl
tree-wide: use systemctl of running system
This commit is contained in:
commit
927b7795cb
@ -94,7 +94,7 @@ in
|
|||||||
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
${config.systemd.package}/bin/systemctl try-restart post-resume.target
|
/run/current-system/systemd/bin/systemctl try-restart post-resume.target
|
||||||
${cfg.resumeCommands}
|
${cfg.resumeCommands}
|
||||||
${cfg.powerUpCommands}
|
${cfg.powerUpCommands}
|
||||||
'';
|
'';
|
||||||
|
@ -21,7 +21,7 @@ let
|
|||||||
'' + optionalString config.services.nscd.enable ''
|
'' + optionalString config.services.nscd.enable ''
|
||||||
# Invalidate the nscd cache whenever resolv.conf is
|
# Invalidate the nscd cache whenever resolv.conf is
|
||||||
# regenerated.
|
# regenerated.
|
||||||
libc_restart='${pkgs.systemd}/bin/systemctl try-restart --no-block nscd.service 2> /dev/null'
|
libc_restart='/run/current-system/systemd/bin/systemctl try-restart --no-block nscd.service 2> /dev/null'
|
||||||
'' + optionalString (length resolvconfOptions > 0) ''
|
'' + optionalString (length resolvconfOptions > 0) ''
|
||||||
# Options as described in resolv.conf(5)
|
# Options as described in resolv.conf(5)
|
||||||
resolv_conf_options='${concatStringsSep " " resolvconfOptions}'
|
resolv_conf_options='${concatStringsSep " " resolvconfOptions}'
|
||||||
|
@ -138,7 +138,7 @@ in {
|
|||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.docker-distribution}/bin/registry garbage-collect ${configFile}
|
${pkgs.docker-distribution}/bin/registry garbage-collect ${configFile}
|
||||||
${pkgs.systemd}/bin/systemctl restart docker-registry.service
|
/run/current-system/systemd/bin/systemctl restart docker-registry.service
|
||||||
'';
|
'';
|
||||||
|
|
||||||
startAt = optional cfg.enableGarbageCollect cfg.garbageCollectDates;
|
startAt = optional cfg.enableGarbageCollect cfg.garbageCollectDates;
|
||||||
|
@ -78,7 +78,7 @@ in {
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
restartTriggers = [ configDirectory ];
|
restartTriggers = [ configDirectory ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.systemd}/bin/systemctl try-reload-or-restart freeswitch.service";
|
ExecStart = "/run/current-system/systemd/bin/systemctl try-reload-or-restart freeswitch.service";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ let
|
|||||||
# anything ever again ("couldn't resolve ..., giving up on
|
# anything ever again ("couldn't resolve ..., giving up on
|
||||||
# it"), so we silently lose time synchronisation. This also
|
# it"), so we silently lose time synchronisation. This also
|
||||||
# applies to openntpd.
|
# applies to openntpd.
|
||||||
${config.systemd.package}/bin/systemctl try-reload-or-restart ntpd.service openntpd.service chronyd.service || true
|
/run/current-system/systemd/bin/systemctl try-reload-or-restart ntpd.service openntpd.service chronyd.service || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${cfg.runHook}
|
${cfg.runHook}
|
||||||
@ -217,7 +217,7 @@ in
|
|||||||
powerManagement.resumeCommands = mkIf config.systemd.services.dhcpcd.enable
|
powerManagement.resumeCommands = mkIf config.systemd.services.dhcpcd.enable
|
||||||
''
|
''
|
||||||
# Tell dhcpcd to rebind its interfaces if it's running.
|
# Tell dhcpcd to rebind its interfaces if it's running.
|
||||||
${config.systemd.package}/bin/systemctl reload dhcpcd.service
|
/run/current-system/systemd/bin/systemctl reload dhcpcd.service
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -252,7 +252,7 @@ let
|
|||||||
Use imports or pkgs.lib.readFile if you don't want this data in your config file.
|
Use imports or pkgs.lib.readFile if you don't want this data in your config file.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
dnssec = mkEnableOption "DNSSEC";
|
dnssec = mkEnableOption "DNSSEC";
|
||||||
|
|
||||||
dnssecPolicy = {
|
dnssecPolicy = {
|
||||||
@ -970,7 +970,7 @@ in
|
|||||||
script = signZones;
|
script = signZones;
|
||||||
|
|
||||||
postStop = ''
|
postStop = ''
|
||||||
${pkgs.systemd}/bin/systemctl kill -s SIGHUP nsd.service
|
/run/current-system/systemd/bin/systemctl kill -s SIGHUP nsd.service
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,12 +253,12 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
powerManagement.resumeCommands = ''
|
powerManagement.resumeCommands = ''
|
||||||
${config.systemd.package}/bin/systemctl try-restart wpa_supplicant
|
/run/current-system/systemd/bin/systemctl try-restart wpa_supplicant
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Restart wpa_supplicant when a wlan device appears or disappears.
|
# Restart wpa_supplicant when a wlan device appears or disappears.
|
||||||
services.udev.extraRules = ''
|
services.udev.extraRules = ''
|
||||||
ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="${config.systemd.package}/bin/systemctl try-restart wpa_supplicant.service"
|
ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="/run/current-system/systemd/bin/systemctl try-restart wpa_supplicant.service"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -756,9 +756,9 @@ in
|
|||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
serviceConfig.TimeoutSec = 60;
|
serviceConfig.TimeoutSec = 60;
|
||||||
script = ''
|
script = ''
|
||||||
if ${pkgs.systemd}/bin/systemctl -q is-active nginx.service ; then
|
if /run/current-system/systemd/bin/systemctl -q is-active nginx.service ; then
|
||||||
${execCommand} -t && \
|
${execCommand} -t && \
|
||||||
${pkgs.systemd}/bin/systemctl reload nginx.service
|
/run/current-system/systemd/bin/systemctl reload nginx.service
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
serviceConfig.RemainAfterExit = true;
|
serviceConfig.RemainAfterExit = true;
|
||||||
@ -772,7 +772,7 @@ in
|
|||||||
webroot = vhostConfig.acmeRoot;
|
webroot = vhostConfig.acmeRoot;
|
||||||
extraDomains = genAttrs vhostConfig.serverAliases (alias: null);
|
extraDomains = genAttrs vhostConfig.serverAliases (alias: null);
|
||||||
postRun = ''
|
postRun = ''
|
||||||
systemctl reload nginx
|
/run/current-system/systemd/bin/systemctl reload nginx
|
||||||
'';
|
'';
|
||||||
}; }) acmeEnabledVhosts;
|
}; }) acmeEnabledVhosts;
|
||||||
in
|
in
|
||||||
|
@ -39,8 +39,8 @@ let
|
|||||||
|
|
||||||
${optionalString cfg.startDbusSession ''
|
${optionalString cfg.startDbusSession ''
|
||||||
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
||||||
${config.systemd.package}/bin/systemctl --user start dbus.socket
|
/run/current-system/systemd/bin/systemctl --user start dbus.socket
|
||||||
export `${config.systemd.package}/bin/systemctl --user show-environment | grep '^DBUS_SESSION_BUS_ADDRESS'`
|
export `/run/current-system/systemd/bin/systemctl --user show-environment | grep '^DBUS_SESSION_BUS_ADDRESS'`
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ let
|
|||||||
#
|
#
|
||||||
# Also tell systemd about the dbus session bus address.
|
# Also tell systemd about the dbus session bus address.
|
||||||
# This is required by user units using the session bus.
|
# This is required by user units using the session bus.
|
||||||
${config.systemd.package}/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS
|
/run/current-system/systemd/bin/systemctl --user import-environment DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS
|
||||||
|
|
||||||
# Load X defaults. This should probably be safe on wayland too.
|
# Load X defaults. This should probably be safe on wayland too.
|
||||||
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
|
${xorg.xrdb}/bin/xrdb -merge ${xresourcesXft}
|
||||||
@ -89,7 +89,7 @@ let
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Start systemd user services for graphical sessions
|
# Start systemd user services for graphical sessions
|
||||||
${config.systemd.package}/bin/systemctl --user start graphical-session.target
|
/run/current-system/systemd/bin/systemctl --user start graphical-session.target
|
||||||
|
|
||||||
# Allow the user to setup a custom session type.
|
# Allow the user to setup a custom session type.
|
||||||
if test -x ~/.xsession; then
|
if test -x ~/.xsession; then
|
||||||
@ -394,7 +394,7 @@ in
|
|||||||
|
|
||||||
test -n "$waitPID" && wait "$waitPID"
|
test -n "$waitPID" && wait "$waitPID"
|
||||||
|
|
||||||
${config.systemd.package}/bin/systemctl --user stop graphical-session.target
|
/run/current-system/systemd/bin/systemctl --user stop graphical-session.target
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
'';
|
'';
|
||||||
|
@ -30,8 +30,8 @@ let
|
|||||||
|
|
||||||
cfgFile = pkgs.writeText "sddm.conf" ''
|
cfgFile = pkgs.writeText "sddm.conf" ''
|
||||||
[General]
|
[General]
|
||||||
HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
|
HaltCommand=/run/current-system/systemd/bin/systemctl poweroff
|
||||||
RebootCommand=${pkgs.systemd}/bin/systemctl reboot
|
RebootCommand=/run/current-system/systemd/bin/systemctl reboot
|
||||||
${optionalString cfg.autoNumlock ''
|
${optionalString cfg.autoNumlock ''
|
||||||
Numlock=on
|
Numlock=on
|
||||||
''}
|
''}
|
||||||
|
@ -66,7 +66,7 @@ in
|
|||||||
|
|
||||||
killer = mkOption {
|
killer = mkOption {
|
||||||
default = null; # default according to `man xautolock` is none
|
default = null; # default according to `man xautolock` is none
|
||||||
example = "${pkgs.systemd}/bin/systemctl suspend";
|
example = "/run/current-system/systemd/bin/systemctl suspend";
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -327,7 +327,7 @@ let
|
|||||||
# if `libvirtd.service` is not running, do not use `virsh` which would try activate it via 'libvirtd.socket' and thus start it out-of-order.
|
# if `libvirtd.service` is not running, do not use `virsh` which would try activate it via 'libvirtd.socket' and thus start it out-of-order.
|
||||||
# `libvirtd.service` will set up bridge interfaces when it will start normally.
|
# `libvirtd.service` will set up bridge interfaces when it will start normally.
|
||||||
#
|
#
|
||||||
if ${pkgs.systemd}/bin/systemctl --quiet is-active 'libvirtd.service'; then
|
if /run/current-system/systemd/bin/systemctl --quiet is-active 'libvirtd.service'; then
|
||||||
for uri in qemu:///system lxc:///; do
|
for uri in qemu:///system lxc:///; do
|
||||||
for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
|
for dom in $(${pkgs.libvirt}/bin/virsh -c $uri list --name); do
|
||||||
${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
|
${pkgs.libvirt}/bin/virsh -c $uri dumpxml "$dom" | \
|
||||||
|
@ -48,7 +48,7 @@ let
|
|||||||
|
|
||||||
provisionedHook = pkgs.writeScript "provisioned-hook" ''
|
provisionedHook = pkgs.writeScript "provisioned-hook" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
${config.systemd.package}/bin/systemctl start provisioned.target
|
/run/current-system/systemd/bin/systemctl start provisioned.target
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
@ -121,7 +121,7 @@ mkDerivation rec {
|
|||||||
substituteInPlace dde-control-center.desktop \
|
substituteInPlace dde-control-center.desktop \
|
||||||
--replace "dbus-send" "${dbus}/bin/dbus-send"
|
--replace "dbus-send" "${dbus}/bin/dbus-send"
|
||||||
substituteInPlace com.deepin.controlcenter.addomain.policy \
|
substituteInPlace com.deepin.controlcenter.addomain.policy \
|
||||||
--replace "/bin/systemctl" "${systemd}/bin/systemctl"
|
--replace "/bin/systemctl" "/run/current-system/sw/bin/systemctl"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontWrapQtApps = true;
|
dontWrapQtApps = true;
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
start_service()
|
start_service()
|
||||||
{
|
{
|
||||||
- systemctl start displaylink-driver
|
- systemctl start displaylink-driver
|
||||||
+ @systemd@/bin/systemctl start --no-block dlm
|
+ /run/current-system/systemd/bin/systemctl start --no-block dlm
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service()
|
stop_service()
|
||||||
{
|
{
|
||||||
- systemctl stop displaylink-driver
|
- systemctl stop displaylink-driver
|
||||||
+ @systemd@/bin/systemctl stop dlm
|
+ /run/current-system/systemd/bin/systemctl stop dlm
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -34,7 +34,7 @@ in
|
|||||||
SYSTEMD_UNIT_DIR=/lib/systemd/system \
|
SYSTEMD_UNIT_DIR=/lib/systemd/system \
|
||||||
UDEV_RULES_DIR=/etc/udev/rules.d
|
UDEV_RULES_DIR=/etc/udev/rules.d
|
||||||
substituteInPlace $out/etc/udev/rules.d/40-monitor-hotplug.rules \
|
substituteInPlace $out/etc/udev/rules.d/40-monitor-hotplug.rules \
|
||||||
--replace /bin/systemctl "${systemd}/bin/systemctl"
|
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl"
|
||||||
'' else ''
|
'' else ''
|
||||||
make install TARGETS='pmutils' DESTDIR=$out \
|
make install TARGETS='pmutils' DESTDIR=$out \
|
||||||
PM_SLEEPHOOKS_DIR=/lib/pm-utils/sleep.d
|
PM_SLEEPHOOKS_DIR=/lib/pm-utils/sleep.d
|
||||||
|
@ -29,7 +29,7 @@ buildPythonApplication rec {
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
for file in $(find google_compute_engine -type f); do
|
for file in $(find google_compute_engine -type f); do
|
||||||
substituteInPlace "$file" \
|
substituteInPlace "$file" \
|
||||||
--replace /bin/systemctl "/run/current-system/sw/bin/systemctl" \
|
--replace /bin/systemctl "/run/current-system/systemd/bin/systemctl" \
|
||||||
--replace /bin/bash "${bashInteractive}/bin/bash" \
|
--replace /bin/bash "${bashInteractive}/bin/bash" \
|
||||||
--replace /sbin/hwclock "${utillinux}/bin/hwclock"
|
--replace /sbin/hwclock "${utillinux}/bin/hwclock"
|
||||||
# SELinux tool ??? /sbin/restorecon
|
# SELinux tool ??? /sbin/restorecon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user