Browse Source

version 0.2

- Option -w changes state to NOOP only if runit is current init
- Change license from ISC to 2-clause BSD (for uniformity with other
  Artix projects)
- Add shutdown to manpage
nohooks-patch 0.2
M. Herdiansyah 4 years ago
parent
commit
b937f07813
  1. 24
      COPYING
  2. 11
      halt.8
  3. 17
      halt.c

24
COPYING

@ -0,0 +1,24 @@
Copyright (C) 2018 Muhammad Herdiansyah
Copyright (C) 2018 Artix Linux Developers
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

11
halt.8

@ -7,10 +7,13 @@
\fBhalt\fR [\-nfdw]
.
.br
\fBreboot\fR [\-nfdw]
.
.br
\fBpoweroff\fR [\-nfdw]
.
.br
\fBreboot\fR [\-nfdw]
\fBshutdown\fR [\-nfdw]
.
.SH "DESCRIPTION"
\fBhalt\fR/\fBreboot\fR/\fBpoweroff\fR/\fBshutdown\fR is a (mostly) sysvinit\-compatible binary\. It tells init(8)/openrc\-shutdown(8) to bring down, reboot, or power off the system\. Without \fB\-f\fR, it is a shortcut to \fBinit 0\fR/\fBinit 6\fR (runit) or \fBopenrc\-shutdown\fR (openrc)\.
@ -35,13 +38,13 @@ Do not stop the system but write to the wtmp record\.
This program tries to be as sysvinit\-compatible as possible, but due to limitations by the init system, some functions may not be available yet\.
.
.P
The \fBshutdown\fR program behaves like the \fBpoweroff\fR program\.
Currently, the \fBshutdown\fR program behaves like the \fBpoweroff\fR program\.
.
.P
Options \fB\-h\fR and \fB\-i\fR are fully ignored\.
.
.P
When you are using runit(8), the options \fB\-n\fR, \fB\-d\fR, and \fB\-w\fR are ignored\.
When you are using runit(8), the options \fB\-d\fR and \fB\-w\fR are ignored\.
.
.SH "SEE ALSO"
init(8)
openrc\-init(8), runit(8)

17
halt.c

@ -5,19 +5,7 @@
* Copyright (C) 2018 Muhammad Herdiansyah
* (C) 2018 Artix Linux Developers
*
* Permission to use, copy, modify, and/or distribute this software
* for any purpose with or without fee is hereby granted, provided
* that the above copyright notice and this permission notice appear
* in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* To see the license terms of this program, see COPYING
*/
#include <stdio.h>
@ -84,7 +72,8 @@ int main(int argc, char *argv[])
strcat(openrc_options, "--no-write");
break;
case 'w':
action = NOOP;
if (init == RUNIT)
action = NOOP;
do_sync = 0;
strcat(openrc_options, "--write-only");
break;