Merge lp:~xnox/upstart/exec-systemctl into lp:upstart

Proposed by Dimitri John Ledkov on 2014-08-04
Status: Rejected
Rejected by: Dimitri John Ledkov on 2014-08-05
Proposed branch: lp:~xnox/upstart/exec-systemctl
Merge into: lp:upstart
Diff against target: 95 lines (+20/-0)
5 files modified
util/reboot.c (+3/-0)
util/runlevel.c (+3/-0)
util/shutdown.c (+2/-0)
util/sysv.h (+10/-0)
util/telinit.c (+2/-0)
To merge this branch: bzr merge lp:~xnox/upstart/exec-systemctl
Reviewer Review Type Date Requested Status
James Hunt 2014-08-04 Disapprove on 2014-08-05
Martin Pitt (community) 2014-08-04 Approve on 2014-08-04
Review via email: mp+229467@code.launchpad.net

Description of the change

Make upstart's utils: reboot, poweroff, halt, telinit, runlevel, shutdown -> execute systemctl when booted under systemd.

To post a comment you must log in.
Martin Pitt (pitti) wrote :

Thanks! This looks good to me, but I'm not very familiar with the code, so I'll let the upstart developers have the final word. One small nitpick in inline review.

review: Approve
James Hunt (jamesodhunt) wrote :

I don't this is appropriate for upstream Upstart.

I suggest we distro-patch this feature since the requirement is very much Ubuntu-specific.

review: Disapprove

Unmerged revisions

1645. By Dimitri John Ledkov on 2014-08-04

Make utils execute systemctl commands, if booted under systemd.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'util/reboot.c'
2--- util/reboot.c 2014-05-09 15:23:36 +0000
3+++ util/reboot.c 2014-08-04 14:14:56 +0000
4@@ -39,6 +39,7 @@
5 #include <nih/error.h>
6
7 #include "utmp.h"
8+#include "sysv.h"
9
10
11 /**
12@@ -135,6 +136,8 @@
13 main (int argc,
14 char *argv[])
15 {
16+ sysv_exec_systemctl (argv);
17+
18 char **args;
19 int mode;
20 int runlevel;
21
22=== modified file 'util/runlevel.c'
23--- util/runlevel.c 2009-07-16 16:39:04 +0000
24+++ util/runlevel.c 2014-08-04 14:14:56 +0000
25@@ -34,6 +34,7 @@
26 #include <nih/error.h>
27
28 #include "utmp.h"
29+#include "sysv.h"
30
31
32 /**
33@@ -50,6 +51,8 @@
34 main (int argc,
35 char *argv[])
36 {
37+ sysv_exec_systemctl (argv);
38+
39 char **args;
40 int runlevel;
41 int prevlevel;
42
43=== modified file 'util/shutdown.c'
44--- util/shutdown.c 2013-08-22 11:13:41 +0000
45+++ util/shutdown.c 2014-08-04 14:14:56 +0000
46@@ -231,6 +231,8 @@
47 main (int argc,
48 char *argv[])
49 {
50+ sysv_exec_systemctl (argv);
51+
52 char ** args;
53 nih_local char *message = NULL;
54 size_t messagelen;
55
56=== modified file 'util/sysv.h'
57--- util/sysv.h 2009-07-08 16:03:05 +0000
58+++ util/sysv.h 2014-08-04 14:14:56 +0000
59@@ -22,6 +22,10 @@
60
61 #include <nih/macros.h>
62
63+#include <sys/types.h>
64+#include <sys/stat.h>
65+#include <unistd.h>
66+
67
68 NIH_BEGIN_EXTERN
69
70@@ -29,6 +33,12 @@
71 const char *utmp_file, const char *wtmp_file)
72 __attribute__ ((warn_unused_result));
73
74+#define sysv_exec_systemctl(_ARGV) \
75+ struct stat _ST; \
76+ if (lstat ("/run/systemd/system/", &_ST) == 0) \
77+ if (S_ISDIR (_ST.st_mode)) \
78+ execvp ("/bin/systemctl", _ARGV)
79+
80 NIH_END_EXTERN
81
82 #endif /* UTIL_SYSV_H */
83
84=== modified file 'util/telinit.c'
85--- util/telinit.c 2014-03-10 13:43:50 +0000
86+++ util/telinit.c 2014-08-04 14:14:56 +0000
87@@ -206,6 +206,8 @@
88 main (int argc,
89 char *argv[])
90 {
91+ sysv_exec_systemctl (argv);
92+
93 char **args;
94 int runlevel;
95 int ret = 0;

Subscribers

People subscribed via source and target branches