]> git.pld-linux.org Git - packages/ganeti.git/blob - daemon-util-use-service.patch
adapter; executable bits; preserve mtimes
[packages/ganeti.git] / daemon-util-use-service.patch
1 --- ganeti-2.6.2/daemons/daemon-util.in~        2012-12-21 15:38:52.000000000 +0100
2 +++ ganeti-2.6.2/daemons/daemon-util.in 2013-06-01 19:29:38.454569439 +0200
3 @@ -45,12 +45,6 @@
4    . $defaults_file
5  fi
6  
7 -# Meant to facilitate use utilities in /etc/rc.d/init.d/functions in case
8 -# start-stop-daemon is not available.
9 -_ignore_error() {
10 -  eval "$@" || :
11 -}
12 -
13  _daemon_pidfile() {
14    echo "@LOCALSTATEDIR@/run/ganeti/$1.pid"
15  }
16 @@ -182,17 +176,8 @@
17    fi
18  
19    local name="$1"; shift
20 -  local pidfile=$(_daemon_pidfile $name)
21 -  local daemonexec=$(_daemon_executable $name)
22  
23 -  if type -p start-stop-daemon >/dev/null; then
24 -    start-stop-daemon --stop --signal 0 --quiet \
25 -      --pidfile $pidfile
26 -  else
27 -    _ignore_error status \
28 -      -p $pidfile \
29 -      $daemonexec
30 -  fi
31 +  /sbin/service $name status >/dev/null 2>&1
32  }
33  
34  # Starts a daemon
35 @@ -203,12 +188,6 @@
36    fi
37  
38    local name="$1"; shift
39 -  # Convert daemon name to uppercase after removing "ganeti-" prefix
40 -  local plain_name=${name#ganeti-}
41 -  local ucname=$(tr a-z A-Z <<<$plain_name)
42 -  local pidfile=$(_daemon_pidfile $name)
43 -  local usergroup=$(_daemon_usergroup $plain_name)
44 -  local daemonexec=$(_daemon_executable $name)
45  
46    if [[ "$name" == ganeti-confd &&
47          "@CUSTOM_ENABLE_CONFD@" == False ]]; then
48 @@ -216,25 +195,9 @@
49      return 1
50    fi
51  
52 -  # Read $<daemon>_ARGS and $EXTRA_<daemon>_ARGS
53 -  eval local args="\"\$${ucname}_ARGS \$EXTRA_${ucname}_ARGS\""
54 -
55    @PKGLIBDIR@/ensure-dirs
56  
57 -  if type -p start-stop-daemon >/dev/null; then
58 -    start-stop-daemon --start --quiet --oknodo \
59 -      --pidfile $pidfile \
60 -      --startas $daemonexec \
61 -      --chuid $usergroup \
62 -      -- $args "$@"
63 -  else
64 -    # TODO: Find a way to start daemon with a group, until then the group must
65 -    # be removed
66 -    _ignore_error daemon \
67 -      --pidfile $pidfile \
68 -      --user ${usergroup%:*} \
69 -      $daemonexec $args "$@"
70 -  fi
71 +  /sbin/service $name start
72  }
73  
74  # Stops a daemon
75 @@ -245,14 +208,8 @@
76    fi
77  
78    local name="$1"; shift
79 -  local pidfile=$(_daemon_pidfile $name)
80  
81 -  if type -p start-stop-daemon >/dev/null; then
82 -    start-stop-daemon --stop --quiet --oknodo --retry 30 \
83 -      --pidfile $pidfile
84 -  else
85 -    _ignore_error killproc -p $pidfile $name
86 -  fi
87 +  /sbin/service $name stop
88  }
89  
90  # Starts a daemon if it's not yet running
91 @@ -302,15 +259,9 @@
92  
93  # Reloads the SSH keys
94  reload_ssh_keys() {
95 -  @RPL_SSH_INITD_SCRIPT@ restart
96 +  /sbin/service sshd restart
97  }
98  
99 -# Read @SYSCONFDIR@/rc.d/init.d/functions if start-stop-daemon not available
100 -if ! type -p start-stop-daemon >/dev/null && \
101 -   [[ -f @SYSCONFDIR@/rc.d/init.d/functions ]]; then
102 -  _ignore_error . @SYSCONFDIR@/rc.d/init.d/functions
103 -fi
104 -
105  if [[ "$#" -lt 1 ]]; then
106    echo "Usage: $0 <action>" >&2
107    exit 1
This page took 0.060416 seconds and 3 git commands to generate.