Merge ~rjschwei/cloud-init:sysvinitSUSE into cloud-init:master
- Git
- lp:~rjschwei/cloud-init
- sysvinitSUSE
- Merge into master
Proposed by
Robert Schweikert
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 243ec59fb62a8710430f9ba1e2490ee964c1abc0 | ||||
Proposed branch: | ~rjschwei/cloud-init:sysvinitSUSE | ||||
Merge into: | cloud-init:master | ||||
Diff against target: |
497 lines (+455/-0) 5 files modified
setup.py (+2/-0) sysvinit/suse/cloud-config (+113/-0) sysvinit/suse/cloud-final (+113/-0) sysvinit/suse/cloud-init (+114/-0) sysvinit/suse/cloud-init-local (+113/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Scott Moser | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Integrate sys-v-init support for SUSE LP#1718649
To post a comment you must log in.
Revision history for this message

Robert Schweikert (rjschwei) wrote : | # |
OK, fixed with cd6cc9b
There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/setup.py b/setup.py | |||
2 | index 9199317..bf697d7 100755 | |||
3 | --- a/setup.py | |||
4 | +++ b/setup.py | |||
5 | @@ -121,6 +121,7 @@ INITSYS_FILES = { | |||
6 | 121 | 'sysvinit_freebsd': [f for f in glob('sysvinit/freebsd/*') if is_f(f)], | 121 | 'sysvinit_freebsd': [f for f in glob('sysvinit/freebsd/*') if is_f(f)], |
7 | 122 | 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)], | 122 | 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)], |
8 | 123 | 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)], | 123 | 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)], |
9 | 124 | 'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)], | ||
10 | 124 | 'systemd': [render_tmpl(f) | 125 | 'systemd': [render_tmpl(f) |
11 | 125 | for f in (glob('systemd/*.tmpl') + | 126 | for f in (glob('systemd/*.tmpl') + |
12 | 126 | glob('systemd/*.service') + | 127 | glob('systemd/*.service') + |
13 | @@ -133,6 +134,7 @@ INITSYS_ROOTS = { | |||
14 | 133 | 'sysvinit_freebsd': 'usr/local/etc/rc.d', | 134 | 'sysvinit_freebsd': 'usr/local/etc/rc.d', |
15 | 134 | 'sysvinit_deb': 'etc/init.d', | 135 | 'sysvinit_deb': 'etc/init.d', |
16 | 135 | 'sysvinit_openrc': 'etc/init.d', | 136 | 'sysvinit_openrc': 'etc/init.d', |
17 | 137 | 'sysvinit_suse': 'etc/init.d', | ||
18 | 136 | 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'), | 138 | 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'), |
19 | 137 | 'systemd.generators': pkg_config_read('systemd', | 139 | 'systemd.generators': pkg_config_read('systemd', |
20 | 138 | 'systemdsystemgeneratordir'), | 140 | 'systemdsystemgeneratordir'), |
21 | diff --git a/sysvinit/suse/cloud-config b/sysvinit/suse/cloud-config | |||
22 | 139 | new file mode 100644 | 141 | new file mode 100644 |
23 | index 0000000..8c3abbb | |||
24 | --- /dev/null | |||
25 | +++ b/sysvinit/suse/cloud-config | |||
26 | @@ -0,0 +1,113 @@ | |||
27 | 1 | #!/bin/sh | ||
28 | 2 | |||
29 | 3 | # | ||
30 | 4 | # Copyright (C) 2017 SUSE LLC | ||
31 | 5 | # | ||
32 | 6 | # This file is part of cloud-init. See LICENSE file for license information. | ||
33 | 7 | |||
34 | 8 | # See: http://wiki.debian.org/LSBInitScripts | ||
35 | 9 | # See: http://tiny.cc/czvbgw | ||
36 | 10 | # See: http://www.novell.com/coolsolutions/feature/15380.html | ||
37 | 11 | # Also based on dhcpd in RHEL (for comparison) | ||
38 | 12 | |||
39 | 13 | ### BEGIN INIT INFO | ||
40 | 14 | # Provides: cloud-config | ||
41 | 15 | # Required-Start: cloud-init cloud-init-local | ||
42 | 16 | # Should-Start: $time | ||
43 | 17 | # Required-Stop: $null | ||
44 | 18 | # Should-Stop: $null | ||
45 | 19 | # Default-Start: 2 3 5 | ||
46 | 20 | # Default-Stop: 0 1 6 | ||
47 | 21 | # Short-Description: The config cloud-init job | ||
48 | 22 | # Description: Start cloud-init and runs the config phase | ||
49 | 23 | # and any associated config modules as desired. | ||
50 | 24 | ### END INIT INFO | ||
51 | 25 | |||
52 | 26 | # Return values acc. to LSB for all commands but status: | ||
53 | 27 | # 0 - success | ||
54 | 28 | # 1 - generic or unspecified error | ||
55 | 29 | # 2 - invalid or excess argument(s) | ||
56 | 30 | # 3 - unimplemented feature (e.g. "reload") | ||
57 | 31 | # 4 - user had insufficient privileges | ||
58 | 32 | # 5 - program is not installed | ||
59 | 33 | # 6 - program is not configured | ||
60 | 34 | # 7 - program is not running | ||
61 | 35 | # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) | ||
62 | 36 | # | ||
63 | 37 | # Note that starting an already running service, stopping | ||
64 | 38 | # or restarting a not-running service as well as the restart | ||
65 | 39 | # with force-reload (in case signaling is not supported) are | ||
66 | 40 | # considered a success. | ||
67 | 41 | |||
68 | 42 | RETVAL=0 | ||
69 | 43 | |||
70 | 44 | prog="cloud-init" | ||
71 | 45 | cloud_init="/usr/bin/cloud-init" | ||
72 | 46 | conf="/etc/cloud/cloud.cfg" | ||
73 | 47 | |||
74 | 48 | # If there exist sysconfig/default variable override files use it... | ||
75 | 49 | [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init | ||
76 | 50 | [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init | ||
77 | 51 | |||
78 | 52 | . /etc/rc.status | ||
79 | 53 | rc_reset | ||
80 | 54 | |||
81 | 55 | start() { | ||
82 | 56 | [ -x $cloud_init ] || return 5 | ||
83 | 57 | [ -f $conf ] || return 6 | ||
84 | 58 | |||
85 | 59 | echo -n $"Starting $prog: " | ||
86 | 60 | $cloud_init $CLOUDINITARGS modules --mode config | ||
87 | 61 | RETVAL=$? | ||
88 | 62 | return $RETVAL | ||
89 | 63 | } | ||
90 | 64 | |||
91 | 65 | stop() { | ||
92 | 66 | echo -n $"Shutting down $prog: " | ||
93 | 67 | # No-op | ||
94 | 68 | RETVAL=7 | ||
95 | 69 | return $RETVAL | ||
96 | 70 | } | ||
97 | 71 | |||
98 | 72 | case "$1" in | ||
99 | 73 | start) | ||
100 | 74 | start | ||
101 | 75 | RETVAL=$? | ||
102 | 76 | ;; | ||
103 | 77 | stop) | ||
104 | 78 | stop | ||
105 | 79 | RETVAL=$? | ||
106 | 80 | ;; | ||
107 | 81 | restart|try-restart|condrestart) | ||
108 | 82 | ## Stop the service and regardless of whether it was | ||
109 | 83 | ## running or not, start it again. | ||
110 | 84 | # | ||
111 | 85 | ## Note: try-restart is now part of LSB (as of 1.9). | ||
112 | 86 | ## RH has a similar command named condrestart. | ||
113 | 87 | start | ||
114 | 88 | RETVAL=$? | ||
115 | 89 | ;; | ||
116 | 90 | reload|force-reload) | ||
117 | 91 | # It does not support reload | ||
118 | 92 | RETVAL=3 | ||
119 | 93 | ;; | ||
120 | 94 | status) | ||
121 | 95 | echo -n $"Checking for service $prog:" | ||
122 | 96 | # Return value is slightly different for the status command: | ||
123 | 97 | # 0 - service up and running | ||
124 | 98 | # 1 - service dead, but /var/run/ pid file exists | ||
125 | 99 | # 2 - service dead, but /var/lock/ lock file exists | ||
126 | 100 | # 3 - service not running (unused) | ||
127 | 101 | # 4 - service status unknown :-( | ||
128 | 102 | # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) | ||
129 | 103 | RETVAL=3 | ||
130 | 104 | ;; | ||
131 | 105 | *) | ||
132 | 106 | echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}" | ||
133 | 107 | RETVAL=3 | ||
134 | 108 | ;; | ||
135 | 109 | esac | ||
136 | 110 | |||
137 | 111 | _rc_status=$RETVAL | ||
138 | 112 | rc_status -v | ||
139 | 113 | rc_exit | ||
140 | diff --git a/sysvinit/suse/cloud-final b/sysvinit/suse/cloud-final | |||
141 | 0 | new file mode 100644 | 114 | new file mode 100644 |
142 | index 0000000..714a066 | |||
143 | --- /dev/null | |||
144 | +++ b/sysvinit/suse/cloud-final | |||
145 | @@ -0,0 +1,113 @@ | |||
146 | 1 | #!/bin/sh | ||
147 | 2 | |||
148 | 3 | # | ||
149 | 4 | # Copyright (C) 2017 SUSE LLC | ||
150 | 5 | # | ||
151 | 6 | # This file is part of cloud-init. See LICENSE file for license information. | ||
152 | 7 | |||
153 | 8 | # See: http://wiki.debian.org/LSBInitScripts | ||
154 | 9 | # See: http://tiny.cc/czvbgw | ||
155 | 10 | # See: http://www.novell.com/coolsolutions/feature/15380.html | ||
156 | 11 | # Also based on dhcpd in RHEL (for comparison) | ||
157 | 12 | |||
158 | 13 | ### BEGIN INIT INFO | ||
159 | 14 | # Provides: cloud-final | ||
160 | 15 | # Required-Start: cloud-config | ||
161 | 16 | # Should-Start: $time | ||
162 | 17 | # Required-Stop: $null | ||
163 | 18 | # Should-Stop: $null | ||
164 | 19 | # Default-Start: 2 3 5 | ||
165 | 20 | # Default-Stop: 0 1 6 | ||
166 | 21 | # Short-Description: The final cloud-init job | ||
167 | 22 | # Description: Start cloud-init and runs the final phase | ||
168 | 23 | # and any associated final modules as desired. | ||
169 | 24 | ### END INIT INFO | ||
170 | 25 | |||
171 | 26 | # Return values acc. to LSB for all commands but status: | ||
172 | 27 | # 0 - success | ||
173 | 28 | # 1 - generic or unspecified error | ||
174 | 29 | # 2 - invalid or excess argument(s) | ||
175 | 30 | # 3 - unimplemented feature (e.g. "reload") | ||
176 | 31 | # 4 - user had insufficient privileges | ||
177 | 32 | # 5 - program is not installed | ||
178 | 33 | # 6 - program is not configured | ||
179 | 34 | # 7 - program is not running | ||
180 | 35 | # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) | ||
181 | 36 | # | ||
182 | 37 | # Note that starting an already running service, stopping | ||
183 | 38 | # or restarting a not-running service as well as the restart | ||
184 | 39 | # with force-reload (in case signaling is not supported) are | ||
185 | 40 | # considered a success. | ||
186 | 41 | |||
187 | 42 | RETVAL=0 | ||
188 | 43 | |||
189 | 44 | prog="cloud-init" | ||
190 | 45 | cloud_init="/usr/bin/cloud-init" | ||
191 | 46 | conf="/etc/cloud/cloud.cfg" | ||
192 | 47 | |||
193 | 48 | # If there exist sysconfig/default variable override files use it... | ||
194 | 49 | [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init | ||
195 | 50 | [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init | ||
196 | 51 | |||
197 | 52 | . /etc/rc.status | ||
198 | 53 | rc_reset | ||
199 | 54 | |||
200 | 55 | start() { | ||
201 | 56 | [ -x $cloud_init ] || return 5 | ||
202 | 57 | [ -f $conf ] || return 6 | ||
203 | 58 | |||
204 | 59 | echo -n $"Starting $prog: " | ||
205 | 60 | $cloud_init $CLOUDINITARGS modules --mode final | ||
206 | 61 | RETVAL=$? | ||
207 | 62 | return $RETVAL | ||
208 | 63 | } | ||
209 | 64 | |||
210 | 65 | stop() { | ||
211 | 66 | echo -n $"Shutting down $prog: " | ||
212 | 67 | # No-op | ||
213 | 68 | RETVAL=7 | ||
214 | 69 | return $RETVAL | ||
215 | 70 | } | ||
216 | 71 | |||
217 | 72 | case "$1" in | ||
218 | 73 | start) | ||
219 | 74 | start | ||
220 | 75 | RETVAL=$? | ||
221 | 76 | ;; | ||
222 | 77 | stop) | ||
223 | 78 | stop | ||
224 | 79 | RETVAL=$? | ||
225 | 80 | ;; | ||
226 | 81 | restart|try-restart|condrestart) | ||
227 | 82 | ## Stop the service and regardless of whether it was | ||
228 | 83 | ## running or not, start it again. | ||
229 | 84 | # | ||
230 | 85 | ## Note: try-restart is now part of LSB (as of 1.9). | ||
231 | 86 | ## RH has a similar command named condrestart. | ||
232 | 87 | start | ||
233 | 88 | RETVAL=$? | ||
234 | 89 | ;; | ||
235 | 90 | reload|force-reload) | ||
236 | 91 | # It does not support reload | ||
237 | 92 | RETVAL=3 | ||
238 | 93 | ;; | ||
239 | 94 | status) | ||
240 | 95 | echo -n $"Checking for service $prog:" | ||
241 | 96 | # Return value is slightly different for the status command: | ||
242 | 97 | # 0 - service up and running | ||
243 | 98 | # 1 - service dead, but /var/run/ pid file exists | ||
244 | 99 | # 2 - service dead, but /var/lock/ lock file exists | ||
245 | 100 | # 3 - service not running (unused) | ||
246 | 101 | # 4 - service status unknown :-( | ||
247 | 102 | # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) | ||
248 | 103 | RETVAL=3 | ||
249 | 104 | ;; | ||
250 | 105 | *) | ||
251 | 106 | echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}" | ||
252 | 107 | RETVAL=3 | ||
253 | 108 | ;; | ||
254 | 109 | esac | ||
255 | 110 | |||
256 | 111 | _rc_status=$RETVAL | ||
257 | 112 | rc_status -v | ||
258 | 113 | rc_exit | ||
259 | diff --git a/sysvinit/suse/cloud-init b/sysvinit/suse/cloud-init | |||
260 | 0 | new file mode 100644 | 114 | new file mode 100644 |
261 | index 0000000..7126753 | |||
262 | --- /dev/null | |||
263 | +++ b/sysvinit/suse/cloud-init | |||
264 | @@ -0,0 +1,114 @@ | |||
265 | 1 | #!/bin/sh | ||
266 | 2 | |||
267 | 3 | # | ||
268 | 4 | # Copyright (C) 2017 SUSE LLC | ||
269 | 5 | # | ||
270 | 6 | # This file is part of cloud-init. See LICENSE file for license information. | ||
271 | 7 | |||
272 | 8 | # See: http://wiki.debian.org/LSBInitScripts | ||
273 | 9 | # See: http://tiny.cc/czvbgw | ||
274 | 10 | # See: http://www.novell.com/coolsolutions/feature/15380.html | ||
275 | 11 | # Also based on dhcpd in RHEL (for comparison) | ||
276 | 12 | |||
277 | 13 | ### BEGIN INIT INFO | ||
278 | 14 | # Provides: cloud-init | ||
279 | 15 | # Required-Start: $local_fs $network $named $remote_fs cloud-init-local | ||
280 | 16 | # Should-Start: $time | ||
281 | 17 | # Required-Stop: $null | ||
282 | 18 | # Should-Stop: $null | ||
283 | 19 | # Default-Start: 2 3 5 | ||
284 | 20 | # Default-Stop: 0 1 6 | ||
285 | 21 | # Short-Description: The initial cloud-init job (net and fs contingent) | ||
286 | 22 | # Description: Start cloud-init and runs the initialization phase | ||
287 | 23 | # and any associated initial modules as desired. | ||
288 | 24 | ### END INIT INFO | ||
289 | 25 | |||
290 | 26 | # Return values acc. to LSB for all commands but status: | ||
291 | 27 | # 0 - success | ||
292 | 28 | # 1 - generic or unspecified error | ||
293 | 29 | # 2 - invalid or excess argument(s) | ||
294 | 30 | # 3 - unimplemented feature (e.g. "reload") | ||
295 | 31 | # 4 - user had insufficient privileges | ||
296 | 32 | # 5 - program is not installed | ||
297 | 33 | # 6 - program is not configured | ||
298 | 34 | # 7 - program is not running | ||
299 | 35 | # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) | ||
300 | 36 | # | ||
301 | 37 | # Note that starting an already running service, stopping | ||
302 | 38 | # or restarting a not-running service as well as the restart | ||
303 | 39 | # with force-reload (in case signaling is not supported) are | ||
304 | 40 | # considered a success. | ||
305 | 41 | |||
306 | 42 | RETVAL=0 | ||
307 | 43 | |||
308 | 44 | prog="cloud-init" | ||
309 | 45 | cloud_init="/usr/bin/cloud-init" | ||
310 | 46 | conf="/etc/cloud/cloud.cfg" | ||
311 | 47 | |||
312 | 48 | # If there exist sysconfig/default variable override files use it... | ||
313 | 49 | [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init | ||
314 | 50 | [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init | ||
315 | 51 | |||
316 | 52 | . /etc/rc.status | ||
317 | 53 | rc_reset | ||
318 | 54 | |||
319 | 55 | start() { | ||
320 | 56 | [ -x $cloud_init ] || return 5 | ||
321 | 57 | [ -f $conf ] || return 6 | ||
322 | 58 | |||
323 | 59 | echo -n $"Starting $prog: " | ||
324 | 60 | $cloud_init $CLOUDINITARGS init | ||
325 | 61 | RETVAL=$? | ||
326 | 62 | return $RETVAL | ||
327 | 63 | } | ||
328 | 64 | |||
329 | 65 | stop() { | ||
330 | 66 | echo -n $"Shutting down $prog: " | ||
331 | 67 | # No-op | ||
332 | 68 | RETVAL=7 | ||
333 | 69 | return $RETVAL | ||
334 | 70 | } | ||
335 | 71 | |||
336 | 72 | case "$1" in | ||
337 | 73 | start) | ||
338 | 74 | start | ||
339 | 75 | RETVAL=$? | ||
340 | 76 | ;; | ||
341 | 77 | stop) | ||
342 | 78 | stop | ||
343 | 79 | RETVAL=$? | ||
344 | 80 | ;; | ||
345 | 81 | restart|try-restart|condrestart) | ||
346 | 82 | ## Stop the service and regardless of whether it was | ||
347 | 83 | ## running or not, start it again. | ||
348 | 84 | # | ||
349 | 85 | ## Note: try-restart is now part of LSB (as of 1.9). | ||
350 | 86 | ## RH has a similar command named condrestart. | ||
351 | 87 | start | ||
352 | 88 | RETVAL=$? | ||
353 | 89 | ;; | ||
354 | 90 | reload|force-reload) | ||
355 | 91 | # It does not support reload | ||
356 | 92 | RETVAL=3 | ||
357 | 93 | ;; | ||
358 | 94 | status) | ||
359 | 95 | echo -n $"Checking for service $prog:" | ||
360 | 96 | RETVAL=3 | ||
361 | 97 | [ -e /root/.ssh/authorized_keys ] && RETVAL=0 | ||
362 | 98 | # Return value is slightly different for the status command: | ||
363 | 99 | # 0 - service up and running | ||
364 | 100 | # 1 - service dead, but /var/run/ pid file exists | ||
365 | 101 | # 2 - service dead, but /var/lock/ lock file exists | ||
366 | 102 | # 3 - service not running (unused) | ||
367 | 103 | # 4 - service status unknown :-( | ||
368 | 104 | # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) | ||
369 | 105 | ;; | ||
370 | 106 | *) | ||
371 | 107 | echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}" | ||
372 | 108 | RETVAL=3 | ||
373 | 109 | ;; | ||
374 | 110 | esac | ||
375 | 111 | |||
376 | 112 | _rc_status=$RETVAL | ||
377 | 113 | rc_status -v | ||
378 | 114 | rc_exit | ||
379 | diff --git a/sysvinit/suse/cloud-init-local b/sysvinit/suse/cloud-init-local | |||
380 | 0 | new file mode 100644 | 115 | new file mode 100644 |
381 | index 0000000..fd3980e | |||
382 | --- /dev/null | |||
383 | +++ b/sysvinit/suse/cloud-init-local | |||
384 | @@ -0,0 +1,113 @@ | |||
385 | 1 | #!/bin/sh | ||
386 | 2 | |||
387 | 3 | # | ||
388 | 4 | # Copyright (C) 2017 SUSE LLC | ||
389 | 5 | # | ||
390 | 6 | # This file is part of cloud-init. See LICENSE file for license information. | ||
391 | 7 | |||
392 | 8 | # See: http://wiki.debian.org/LSBInitScripts | ||
393 | 9 | # See: http://tiny.cc/czvbgw | ||
394 | 10 | # See: http://www.novell.com/coolsolutions/feature/15380.html | ||
395 | 11 | # Also based on dhcpd in RHEL (for comparison) | ||
396 | 12 | |||
397 | 13 | ### BEGIN INIT INFO | ||
398 | 14 | # Provides: cloud-init-local | ||
399 | 15 | # Required-Start: $local_fs $remote_fs | ||
400 | 16 | # Should-Start: $time | ||
401 | 17 | # Required-Stop: $null | ||
402 | 18 | # Should-Stop: $null | ||
403 | 19 | # Default-Start: 2 3 5 | ||
404 | 20 | # Default-Stop: 0 1 6 | ||
405 | 21 | # Short-Description: The initial cloud-init job (local fs contingent) | ||
406 | 22 | # Description: Start cloud-init and runs the initialization phases | ||
407 | 23 | # and any associated initial modules as desired. | ||
408 | 24 | ### END INIT INFO | ||
409 | 25 | |||
410 | 26 | # Return values acc. to LSB for all commands but status: | ||
411 | 27 | # 0 - success | ||
412 | 28 | # 1 - generic or unspecified error | ||
413 | 29 | # 2 - invalid or excess argument(s) | ||
414 | 30 | # 3 - unimplemented feature (e.g. "reload") | ||
415 | 31 | # 4 - user had insufficient privileges | ||
416 | 32 | # 5 - program is not installed | ||
417 | 33 | # 6 - program is not configured | ||
418 | 34 | # 7 - program is not running | ||
419 | 35 | # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) | ||
420 | 36 | # | ||
421 | 37 | # Note that starting an already running service, stopping | ||
422 | 38 | # or restarting a not-running service as well as the restart | ||
423 | 39 | # with force-reload (in case signaling is not supported) are | ||
424 | 40 | # considered a success. | ||
425 | 41 | |||
426 | 42 | RETVAL=0 | ||
427 | 43 | |||
428 | 44 | prog="cloud-init" | ||
429 | 45 | cloud_init="/usr/bin/cloud-init" | ||
430 | 46 | conf="/etc/cloud/cloud.cfg" | ||
431 | 47 | |||
432 | 48 | # If there exist sysconfig/default variable override files use it... | ||
433 | 49 | [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init | ||
434 | 50 | [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init | ||
435 | 51 | |||
436 | 52 | . /etc/rc.status | ||
437 | 53 | rc_reset | ||
438 | 54 | |||
439 | 55 | start() { | ||
440 | 56 | [ -x $cloud_init ] || return 5 | ||
441 | 57 | [ -f $conf ] || return 6 | ||
442 | 58 | |||
443 | 59 | echo -n $"Starting $prog: " | ||
444 | 60 | $cloud_init $CLOUDINITARGS init --local | ||
445 | 61 | RETVAL=$? | ||
446 | 62 | return $RETVAL | ||
447 | 63 | } | ||
448 | 64 | |||
449 | 65 | stop() { | ||
450 | 66 | echo -n $"Shutting down $prog: " | ||
451 | 67 | # No-op | ||
452 | 68 | RETVAL=7 | ||
453 | 69 | return $RETVAL | ||
454 | 70 | } | ||
455 | 71 | |||
456 | 72 | case "$1" in | ||
457 | 73 | start) | ||
458 | 74 | start | ||
459 | 75 | RETVAL=$? | ||
460 | 76 | ;; | ||
461 | 77 | stop) | ||
462 | 78 | stop | ||
463 | 79 | RETVAL=$? | ||
464 | 80 | ;; | ||
465 | 81 | restart|try-restart|condrestart) | ||
466 | 82 | ## Stop the service and regardless of whether it was | ||
467 | 83 | ## running or not, start it again. | ||
468 | 84 | # | ||
469 | 85 | ## Note: try-restart is now part of LSB (as of 1.9). | ||
470 | 86 | ## RH has a similar command named condrestart. | ||
471 | 87 | start | ||
472 | 88 | RETVAL=$? | ||
473 | 89 | ;; | ||
474 | 90 | reload|force-reload) | ||
475 | 91 | # It does not support reload | ||
476 | 92 | RETVAL=3 | ||
477 | 93 | ;; | ||
478 | 94 | status) | ||
479 | 95 | echo -n $"Checking for service $prog:" | ||
480 | 96 | # Return value is slightly different for the status command: | ||
481 | 97 | # 0 - service up and running | ||
482 | 98 | # 1 - service dead, but /var/run/ pid file exists | ||
483 | 99 | # 2 - service dead, but /var/lock/ lock file exists | ||
484 | 100 | # 3 - service not running (unused) | ||
485 | 101 | # 4 - service status unknown :-( | ||
486 | 102 | # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) | ||
487 | 103 | RETVAL=3 | ||
488 | 104 | ;; | ||
489 | 105 | *) | ||
490 | 106 | echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}" | ||
491 | 107 | RETVAL=3 | ||
492 | 108 | ;; | ||
493 | 109 | esac | ||
494 | 110 | |||
495 | 111 | _rc_status=$RETVAL | ||
496 | 112 | rc_status -v | ||
497 | 113 | rc_exit |
this looks fine, but i'd like to drop the extended GPL header content either entirely (the systemd and upstart units do not have any license info) or at least replace it with the simple:
# This file is part of cloud-init. See LICENSE file for license information.
if you want i'm willing to keep Author and Copyright in place:
# Copyright (C) 2012 Yahoo! Inc.
# Copyright (C) 2013 SUSE LLC
#
# Author: Joshua Harlow <email address hidden>
# Author: Robert Schweikert <email address hidden>
#
# This file is part of cloud-init. See LICENSE file for license information.
But I'd prefer the first option.