85a05129a9f5 — Alain Leufroy 3 years ago
edit: restart units only if they were started before
1 files changed, 9 insertions(+), 2 deletions(-)

M overlayctl
M overlayctl +9 -2
@@ 427,12 427,19 @@ def editer(name, appended=None, prepande
         ] + added
     if lowers == info['lowers']:
         return
-    if 'active' in _systemctl_status(info['automountpath'].name)['Active'].split():
+    automounted = _is_automount_active(info)
+    mounted = _is_mount_active(info)
+    if automounted:
         sh.systemctl.stop(info['automountpath'].name)
+    if mounted:
+        sh.systemctl.stop(info['mountpath'].name)
     info = _compute_info(name, lowers)
     _write_info(info)
     sh.systemctl('daemon-reload').wait()
-    sh.systemctl.start(info['automountpath'].name)
+    if automounted:
+        sh.systemctl.start(info['automountpath'].name)
+    if mounted:
+        sh.systemctl.start(info['automount'].name)
     logger.debug("Systemd \"%s\" restarted", info['automountpath'])
     logger.info("\"%s\" updated", info['name'])