diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-06-09 08:55:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-06-09 08:55:43 +0000 |
commit | 55691b5e18ba7cd23c521eb8d54d5f2e4a7d0ea5 (patch) | |
tree | 4896c7a4379ac19e18cab58f26e44c6000b0d998 | |
parent | e070685b6b0077f93b281b5959740a6cc205cfc6 (diff) | |
download | s6-linux-init-55691b5e18ba7cd23c521eb8d54d5f2e4a7d0ea5.tar.xz |
Add -H and -P to s6-l-i-shutdown, prepare for 1.0.2.0
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/s6-linux-init-shutdown.html | 11 | ||||
-rw-r--r-- | doc/upgrade.html | 8 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/shutdown/s6-linux-init-shutdown.c | 12 |
6 files changed, 35 insertions, 6 deletions
@@ -1,5 +1,11 @@ Changelog for s6-linux-init. +In 1.0.2.0 +---------- + - New -H and -P options to s6-linux-init-shutdown, for +better compatibility with sysvinit shutdown. + + In 1.0.1.0 ---------- diff --git a/doc/index.html b/doc/index.html index cb9cd58..3dbc6b0 100644 --- a/doc/index.html +++ b/doc/index.html @@ -110,7 +110,7 @@ all the other packages against the <em>static</em> version of libskarnet. <ul> <li> The current released version of s6-linux-init is -<a href="s6-linux-init-1.0.1.0.tar.gz">1.0.1.0</a>. </li> +<a href="s6-linux-init-1.0.2.0.tar.gz">1.0.2.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-linux-init/">s6-linux-init git repository</a>: diff --git a/doc/s6-linux-init-shutdown.html b/doc/s6-linux-init-shutdown.html index 871a13a..a61f8be 100644 --- a/doc/s6-linux-init-shutdown.html +++ b/doc/s6-linux-init-shutdown.html @@ -26,7 +26,7 @@ It is normally invoked as <tt>/sbin/shutdown</tt>. <h2> Interface </h2> <pre> - s6-linux-init-shutdown [ -h | -p | -r | -k ] [ -a ] [ -t <em>sec</em> ] [ -f | -F ] <em>time</em> [ <em>message</em> ] + s6-linux-init-shutdown [ -h [ -H | -P ] | -p | -r | -k ] [ -a ] [ -t <em>sec</em> ] [ -f | -F ] <em>time</em> [ <em>message</em> ] s6-linux-init-shutdown -c [ <em>message</em> ] </pre> @@ -71,7 +71,8 @@ of <em>sec</em> seconds between the SIGTERM and the SIGKILL (to allow processes receiving SIGTERM to exit cleanly). Default is 3 seconds. </li> <li> <tt>-k</tt> : warning only. <em>message</em> will be sent to all logged in users, but the shutdown sequence will not be triggered. </li> - <li> <tt>-h</tt> : at the end of the shutdown sequence, halt the system. </li> + <li> <tt>-h</tt> : at the end of the shutdown sequence, halt the system. The +behaviour of this option may be altered with <tt>-H</tt> or <tt>-P</tt>. </li> <li> <tt>-p</tt> : at the end of the shutdown sequence, power off the system. (This option is provided as an extension, it is not required by the LSB interface.) </li> <li> <tt>-r</tt> : at the end of the shutdown sequence, reboot the system. </li> @@ -80,6 +81,12 @@ logged in users, but the shutdown sequence will not be triggered. </li> <li> <tt>-c</tt> l: cancel a planned shutdown (i.e. cancel the effect of a previous call to <tt>shutdown</tt> with a <em>time</em> argument that was not <tt>now</tt>). This cannot be used to interrupt a shutdown sequence that has already started. </li> + <li> <tt>-H</tt> : this option can only be used in conjunction with <tt>-h</tt>. +Ensures the system is halted, not powered off, at the end of the shutdown sequence. +<tt>-Hh</tt> is equivalent to <tt>-h</tt>. </li> + <li> <tt>-P</tt> : this option can only be used in conjunction with <tt>-h</tt>. +Ensures the system is powered off at the end of the shutdown sequence. +<tt>=Ph</tt> is equivalent to <tt>-p</tt>. </li> </ul> <h2> Notes </h2> diff --git a/doc/upgrade.html b/doc/upgrade.html index 3804ac6..39f24eb 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,14 @@ <h1> What has changed in s6-linux-init </h1> +<h2> in 1.0.2.0 </h2> + +<ul> + <li> <tt>-H</tt> and <tt>-P</tt> options added to +<a href="s6-linux-init-shutdown.html">s6-linux-init-shutdown</a> for +better compatibility with sysvinit. </li> +</ul> + <h2> in 1.0.1.0 </h2> <ul> diff --git a/package/info b/package/info index f5264c0..75e1335 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-linux-init -version=1.0.1.0 +version=1.0.2.0 category=admin package_macro_name=S6_LINUX_INIT diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c index 8e310ec..306bee0 100644 --- a/src/shutdown/s6-linux-init-shutdown.c +++ b/src/shutdown/s6-linux-init-shutdown.c @@ -27,7 +27,7 @@ #define UT_NAMESIZE 32 #endif -#define USAGE "s6-linux-init-shutdown [ -h | -p | -r | -k ] [ -f | -F ] [ -a ] [ -t sec ] time [ message ] or s6-linux-init-shutdown -c [ message ]" +#define USAGE "s6-linux-init-shutdown [ -h [ -H | -P ] | -p | -r | -k ] [ -f | -F ] [ -a ] [ -t sec ] time [ message ] or s6-linux-init-shutdown -c [ message ]" #define dieusage() strerr_dieusage(100, USAGE) #define AC_FILE "/etc/shutdown.allow" @@ -195,6 +195,7 @@ int main (int argc, char const *const *argv) { unsigned int gracetime = 0 ; int what = 0 ; + int subwhat = 0 ; int doactl = 0 ; int docancel = 0 ; tain_t when ; @@ -204,10 +205,12 @@ int main (int argc, char const *const *argv) subgetopt_t l = SUBGETOPT_ZERO ; for (;;) { - int opt = subgetopt_r(argc, argv, "hprkafFct:", &l) ; + int opt = subgetopt_r(argc, argv, "HPhprkafFct:", &l) ; if (opt == -1) break ; switch (opt) { + case 'H' : subwhat = 1 ; break ; + case 'P' : subwhat = 2 ; break ; case 'h' : what = 1 ; break ; case 'p' : what = 2 ; break ; case 'r' : what = 3 ; break ; @@ -223,6 +226,11 @@ int main (int argc, char const *const *argv) argc -= l.ind ; argv += l.ind ; } + if (subwhat) + { + if (what == 1) what = subwhat ; + else strerr_dieusage(100, USAGE) ; + } if (geteuid()) { errno = EPERM ; |