Le lundi 01 août 2011 à 18:45 +0200, Frederic Crozat a écrit :
> Current bash completion doesn't use the correct service list for restart
> command, preventing to restart a already running service.

Grrr, wrong file attached :)

-- 
Frederic Crozat <[email protected]>
SUSE
>From e8f9239aac30000253884406c35309d673070c2b Mon Sep 17 00:00:00 2001
From: Frederic Crozat <[email protected]>
Date: Mon, 1 Aug 2011 18:43:01 +0200
Subject: [PATCH] bash: Allow to restart already started service.

Allow to restart all services, not only inactive one.

https://bugzilla.novell.com/show_bug.cgi?id=704782
---
 src/systemctl-bash-completion.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/systemctl-bash-completion.sh b/src/systemctl-bash-completion.sh
index acdc086..6369a6c 100644
--- a/src/systemctl-bash-completion.sh
+++ b/src/systemctl-bash-completion.sh
@@ -79,10 +79,11 @@ _systemctl () {
         local -A VERBS=(
                 [ALL_UNITS]='enable disable is-active is-enabled status show'
              [FAILED_UNITS]='reset-failed'
-          [STARTABLE_UNITS]='start restart reload-or-restart'
+          [STARTABLE_UNITS]='start'
           [STOPPABLE_UNITS]='stop kill try-restart condrestart'
          [ISOLATABLE_UNITS]='isolate'
          [RELOADABLE_UNITS]='reload reload-or-try-restart force-reload'
+          [RESTARTABLE_UNITS]='restart reload-or-restart'
                      [JOBS]='cancel'
                 [SNAPSHOTS]='delete'
                      [ENVS]='set-environment unset-environment'
@@ -110,6 +111,10 @@ _systemctl () {
                 comps=$( __filter_units_by_property CanStart yes \
                       $( __get_inactive_units | grep -Ev '\.(device|snapshot)$' ))
 
+        elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
+                comps=$( __filter_units_by_property CanStart yes \
+                      $( __get_all_units | grep -Ev '\.(device|snapshot|socket|timer)$' ))
+
         elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
                 comps=$( __filter_units_by_property CanStop yes \
                       $( __get_active_units ) )
-- 
1.7.3.4

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to