summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--doc/index.html2
-rw-r--r--doc/s6-halt.html34
-rw-r--r--doc/s6-poweroff.html37
-rw-r--r--doc/s6-reboot.html36
-rw-r--r--doc/upgrade.html10
-rw-r--r--package/deps.mak9
-rw-r--r--package/info2
-rw-r--r--package/modes3
-rw-r--r--package/targets.mak2
-rw-r--r--src/minutils/deps-exe/halt1
-rw-r--r--src/minutils/deps-exe/poweroff1
-rw-r--r--src/minutils/deps-exe/reboot1
-rw-r--r--src/minutils/halt.c7
-rw-r--r--src/minutils/hpr.c21
-rw-r--r--src/minutils/poweroff.c7
-rw-r--r--src/minutils/reboot.c7
-rw-r--r--src/minutils/s6-halt.c16
-rw-r--r--src/minutils/s6-poweroff.c16
-rw-r--r--src/minutils/s6-reboot.c16
20 files changed, 115 insertions, 115 deletions
diff --git a/COPYING b/COPYING
index a49b1ca..f496e31 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2015 Laurent Bercot <ska-skaware@skarnet.org>
+Copyright (c) 2011-2016 Laurent Bercot <ska-skaware@skarnet.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/doc/index.html b/doc/index.html
index fca89fa..f8e24f1 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -48,7 +48,7 @@ library. </li>
<h3> Download </h3>
<ul>
- <li> The current released version of s6-linux-utils is <a href="s6-linux-utils-2.0.2.3.tar.gz">2.0.2.3</a>. </li>
+ <li> The current released version of s6-linux-utils is <a href="s6-linux-utils-2.1.0.0.tar.gz">2.1.0.0</a>. </li>
<li> Alternatively, you can checkout a copy of the s6-linux-utils git repository:
<pre> git clone git://git.skarnet.org/s6-linux-utils </pre> </li>
</ul>
diff --git a/doc/s6-halt.html b/doc/s6-halt.html
index 5a2e45c..4837b86 100644
--- a/doc/s6-halt.html
+++ b/doc/s6-halt.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Language" content="en" />
<title>s6-linux-utils: the s6-halt program</title>
<meta name="Description" content="s6-linux-utils: the s6-halt program" />
- <meta name="Keywords" content="s6 linux administration root utilities halt" />
+ <meta name="Keywords" content="s6 linux administration root utilities shutdown halt poweroff reboot" />
<!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
</head>
<body>
@@ -19,19 +19,37 @@
<h1> The <tt>s6-halt</tt> program </h1>
<p>
-<tt>s6-halt</tt> syncs the filesystems and halts the machine
-immediately, without switching the power off.
-<br /> This is different from the sysvinit <tt>halt</tt>
-command, which is an alias for <tt>shutdown -h</tt>. The
-s6-linux-utils <tt>s6-halt</tt> command is more or less equivalent to
-sysvinit's <tt>halt -f</tt>.
+<tt>s6-halt</tt> sends a signal to process 1 in order to halt the machine;
+or, with the <tt>-f</tt> option, it performs an immediate hard shutdown.
</p>
<h2> Interface </h2>
<pre>
- s6-halt
+ s6-halt [ -h | -p | -r ] [ -f ]
</pre>
+<ul>
+ <li> s6-halt sends a signal to process 1. </li>
+ <li> It then exits 0. </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-h</tt>&nbsp;: halt. The command will order a halt (i.e. the system will
+be shut down, but the power will remain up), which means
+sending a SIGUSR2 to process 1. This is the default. </li>
+ <li> <tt>-p</tt>&nbsp;: poweroff. The command will order a power off, which means
+sending a SIGUSR1 to process 1. </li>
+ <li> <tt>-r</tt>&nbsp;: reboot. The command will order a reboot, which means
+sending a SIGINT to process 1. </li>
+ <li> <tt>-f</tt>&nbsp;: force. The command will not send any signal to process 1;
+it will just sync the filesystems then tell the kernel to halt, poweroff or reboot.
+<tt>s6-reboot -f</tt> or <tt>s6-poweroff -f</tt> should be the last program
+executed in the lifetime of a machine, at the end of the shutdown script called
+by process 1 when it receives a signal telling it to shut down. </li>
+</ul>
+
</body>
</html>
diff --git a/doc/s6-poweroff.html b/doc/s6-poweroff.html
index 13af3e5..5b0a4fc 100644
--- a/doc/s6-poweroff.html
+++ b/doc/s6-poweroff.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Language" content="en" />
<title>s6-linux-utils: the s6-poweroff program</title>
<meta name="Description" content="s6-linux-utils: the s6-poweroff program" />
- <meta name="Keywords" content="s6 linux administration root poweroff system halt power off" />
+ <meta name="Keywords" content="s6 linux administration root utilities shutdown halt poweroff reboot" />
<!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
</head>
<body>
@@ -19,22 +19,37 @@
<h1> The <tt>s6-poweroff</tt> program </h1>
<p>
-<tt>s6-poweroff</tt> syncs the filesystems and halts the machine
-immediately, switching the power off if possible.
-</p>
-
-<p>
- This is different from the sysvinit <tt>poweroff</tt>
-command, which performs <tt>shutdown</tt>. The
-s6-linux-utils <tt>s6-poweroff</tt> command is more or less equivalent to
-sysvinit's <tt>poweroff -f</tt>.
+<tt>s6-poweroff</tt> sends a signal to process 1 in order to power off the machine;
+or, with the <tt>-f</tt> option, it performs an immediate hard shutdown.
</p>
<h2> Interface </h2>
<pre>
- s6-poweroff
+ s6-poweroff [ -h | -p | -r ] [ -f ]
</pre>
+<ul>
+ <li> s6-poweroff sends a signal to process 1. </li>
+ <li> It then exits 0. </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-h</tt>&nbsp;: halt. The command will order a halt (i.e. the system will
+be shut down, but the power will remain up), which means
+sending a SIGUSR2 to process 1. </li>
+ <li> <tt>-p</tt>&nbsp;: poweroff. The command will order a power off, which means
+sending a SIGUSR1 to process 1. This is the default. </li>
+ <li> <tt>-r</tt>&nbsp;: reboot. The command will order a reboot, which means
+sending a SIGINT to process 1. </li>
+ <li> <tt>-f</tt>&nbsp;: force. The command will not send any signal to process 1;
+it will just sync the filesystems then tell the kernel to halt, poweroff or reboot.
+<tt>s6-reboot -f</tt> or <tt>s6-poweroff -f</tt> should be the last program
+executed in the lifetime of a machine, at the end of the shutdown script called
+by process 1 when it receives a signal telling it to shut down. </li>
+</ul>
+
</body>
</html>
diff --git a/doc/s6-reboot.html b/doc/s6-reboot.html
index f8e9ccd..7f01260 100644
--- a/doc/s6-reboot.html
+++ b/doc/s6-reboot.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Language" content="en" />
<title>s6-linux-utils: the s6-reboot program</title>
<meta name="Description" content="s6-linux-utils: the s6-reboot program" />
- <meta name="Keywords" content="s6 linux administration root utilities reboot power shutdown" />
+ <meta name="Keywords" content="s6 linux administration root utilities shutdown halt poweroff reboot" />
<!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
</head>
<body>
@@ -19,21 +19,37 @@
<h1> The <tt>s6-reboot</tt> program </h1>
<p>
-<tt>s6-reboot</tt> syncs the filesystems and reboots the machine
-immediately.
-</p>
-
-<p> This is different from the sysvinit <tt>reboot</tt>
-command, which is an alias for <tt>shutdown -r</tt>. The
-s6-linux-utils <tt>s6-reboot</tt> command is more or less equivalent to
-sysvinit's <tt>reboot -f</tt>.
+<tt>s6-reboot</tt> sends a signal to process 1 in order to reboot the machine;
+or, with the <tt>-f</tt> option, it performs an immediate reboot.
</p>
<h2> Interface </h2>
<pre>
- s6-reboot
+ s6-reboot [ -h | -p | -r ] [ -f ]
</pre>
+<ul>
+ <li> s6-reboot sends a signal to process 1. </li>
+ <li> It then exits 0. </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-h</tt>&nbsp;: halt. The command will order a halt (i.e. the system will
+be shut down, but the power will remain up), which means
+sending a SIGUSR2 to process 1. </li>
+ <li> <tt>-p</tt>&nbsp;: poweroff. The command will order a power off, which means
+sending a SIGUSR1 to process 1. </li>
+ <li> <tt>-r</tt>&nbsp;: reboot. The command will order a reboot, which means
+sending a SIGINT to process 1. This is the default. </li>
+ <li> <tt>-f</tt>&nbsp;: force. The command will not send any signal to process 1;
+it will just sync the filesystems then tell the kernel to halt, poweroff or reboot.
+<tt>s6-reboot -f</tt> or <tt>s6-poweroff -f</tt> should be the last program
+executed in the lifetime of a machine, at the end of the shutdown script called
+by process 1 when it receives a signal telling it to shut down. </li>
+</ul>
+
</body>
</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index f8be8a8..e6930ed 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,16 @@
<h1> What has changed in s6-linux-utils </h1>
+<h2> in 2.1.0.0 </h2>
+
+<ul>
+ <li> <a href="s6-halt.html">s6-halt</a>,
+<a href="s6-poweroff.html">s6-poweroff</a> and
+<a href="s6-reboot.html">s6-reboot</a> have changed behaviours.
+They now send a signal to process 1 by default; to make them
+perform a hard shutdown, add the <tt>-f</tt> option. </li>
+</ul>
+
<h2> in 2.0.2.3 </h2>
<ul>
diff --git a/package/deps.mak b/package/deps.mak
index 0eb59f1..a34f14b 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -2,10 +2,7 @@
# This file has been generated by tools/gen-deps.sh
#
-src/minutils/halt.o src/minutils/halt.lo: src/minutils/halt.c
src/minutils/hpr.o src/minutils/hpr.lo: src/minutils/hpr.c
-src/minutils/poweroff.o src/minutils/poweroff.lo: src/minutils/poweroff.c
-src/minutils/reboot.o src/minutils/reboot.lo: src/minutils/reboot.c
src/minutils/s6-chroot.o src/minutils/s6-chroot.lo: src/minutils/s6-chroot.c
src/minutils/s6-devd.o src/minutils/s6-devd.lo: src/minutils/s6-devd.c src/include/s6-linux-utils/config.h
src/minutils/s6-freeramdisk.o src/minutils/s6-freeramdisk.lo: src/minutils/s6-freeramdisk.c
@@ -30,12 +27,6 @@ src/minutils/s6ps_statparse.o src/minutils/s6ps_statparse.lo: src/minutils/s6ps_
src/minutils/s6ps_ttycache.o src/minutils/s6ps_ttycache.lo: src/minutils/s6ps_ttycache.c src/minutils/s6-ps.h
src/minutils/s6ps_wchan.o src/minutils/s6ps_wchan.lo: src/minutils/s6ps_wchan.c src/minutils/s6-ps.h
-halt: EXTRA_LIBS :=
-halt: src/minutils/halt.o -lskarnet
-poweroff: EXTRA_LIBS :=
-poweroff: src/minutils/poweroff.o -lskarnet
-reboot: EXTRA_LIBS :=
-reboot: src/minutils/reboot.o -lskarnet
s6-chroot: EXTRA_LIBS :=
s6-chroot: src/minutils/s6-chroot.o -lskarnet
s6-devd: EXTRA_LIBS :=
diff --git a/package/info b/package/info
index d81be7d..bc62fcf 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-linux-utils
-version=2.0.2.3
+version=2.1.0.0
category=admin
package_macro_name=S6_LINUX_UTILS
diff --git a/package/modes b/package/modes
index b07ddd8..3905269 100644
--- a/package/modes
+++ b/package/modes
@@ -14,6 +14,3 @@ s6-reboot 0700
s6-swapoff 0700
s6-swapon 0700
s6-umount 0700
-halt 0700
-poweroff 0700
-reboot 0700
diff --git a/package/targets.mak b/package/targets.mak
index 964f9aa..c760217 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -17,5 +17,5 @@ s6-swapon \
s6-umount \
SBIN_TARGETS :=
-LIBEXEC_TARGETS := halt poweroff reboot
+LIBEXEC_TARGETS :=
diff --git a/src/minutils/deps-exe/halt b/src/minutils/deps-exe/halt
deleted file mode 100644
index e7187fe..0000000
--- a/src/minutils/deps-exe/halt
+++ /dev/null
@@ -1 +0,0 @@
--lskarnet
diff --git a/src/minutils/deps-exe/poweroff b/src/minutils/deps-exe/poweroff
deleted file mode 100644
index e7187fe..0000000
--- a/src/minutils/deps-exe/poweroff
+++ /dev/null
@@ -1 +0,0 @@
--lskarnet
diff --git a/src/minutils/deps-exe/reboot b/src/minutils/deps-exe/reboot
deleted file mode 100644
index e7187fe..0000000
--- a/src/minutils/deps-exe/reboot
+++ /dev/null
@@ -1 +0,0 @@
--lskarnet
diff --git a/src/minutils/halt.c b/src/minutils/halt.c
deleted file mode 100644
index 8ef9ef4..0000000
--- a/src/minutils/halt.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* ISC license. */
-
-#undef PROGNAME
-#define PROGNAME "halt"
-#undef WHATDEFAULT
-#define WHATDEFAULT 1
-#include "hpr.c"
diff --git a/src/minutils/hpr.c b/src/minutils/hpr.c
index d78470e..0e1c27a 100644
--- a/src/minutils/hpr.c
+++ b/src/minutils/hpr.c
@@ -6,7 +6,7 @@
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
-#define USAGE PROGNAME " [ -h | -p | -r ] [ -f ] [ -w | -d ]"
+#define USAGE PROGNAME " [ -h | -p | -r ] [ -f ]"
int main (int argc, char const *const *argv)
{
@@ -18,7 +18,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "hprfwd", &l) ;
+ register int opt = subgetopt_r(argc, argv, "hprf", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -26,24 +26,19 @@ int main (int argc, char const *const *argv)
case 'p' : what = 2 ; break ;
case 'r' : what = 3 ; break ;
case 'f' : force = 1 ; break ;
- case 'w' : what = 0 ; break ;
- case 'd' : break ;
default : strerr_dieusage(100, USAGE) ;
}
}
argc -= l.ind ; argv += l.ind ;
}
- if (what)
+ if (force)
{
- if (force)
- {
- sync() ;
- reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ;
- strerr_diefu1sys(111, "reboot()") ;
- }
- else if (kill(1, what == 3 ? SIGINT : what == 2 ? SIGUSR1 : SIGUSR2) < 0)
- strerr_diefu1sys(111, "signal process 1") ;
+ sync() ;
+ reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ;
+ strerr_diefu1sys(111, "reboot()") ;
}
+ else if (kill(1, what == 3 ? SIGINT : what == 2 ? SIGUSR1 : SIGUSR2) < 0)
+ strerr_diefu1sys(111, "signal process 1") ;
return 0 ;
}
diff --git a/src/minutils/poweroff.c b/src/minutils/poweroff.c
deleted file mode 100644
index 2856aac..0000000
--- a/src/minutils/poweroff.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* ISC license. */
-
-#undef PROGNAME
-#define PROGNAME "poweroff"
-#undef WHATDEFAULT
-#define WHATDEFAULT 2
-#include "hpr.c"
diff --git a/src/minutils/reboot.c b/src/minutils/reboot.c
deleted file mode 100644
index 12480d4..0000000
--- a/src/minutils/reboot.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* ISC license. */
-
-#undef PROGNAME
-#define PROGNAME "reboot"
-#undef WHATDEFAULT
-#define WHATDEFAULT 3
-#include "hpr.c"
diff --git a/src/minutils/s6-halt.c b/src/minutils/s6-halt.c
index 9613017..d758030 100644
--- a/src/minutils/s6-halt.c
+++ b/src/minutils/s6-halt.c
@@ -1,13 +1,7 @@
/* ISC license. */
-#include <unistd.h>
-#include <sys/reboot.h>
-#include <skalibs/strerr2.h>
-
-int main ()
-{
- PROG = "s6-halt" ;
- sync() ;
- reboot(RB_HALT_SYSTEM) ;
- strerr_diefu1sys(111, "reboot()") ;
-}
+#undef PROGNAME
+#define PROGNAME "s6-halt"
+#undef WHATDEFAULT
+#define WHATDEFAULT 1
+#include "hpr.c"
diff --git a/src/minutils/s6-poweroff.c b/src/minutils/s6-poweroff.c
index b3576b3..f9f7747 100644
--- a/src/minutils/s6-poweroff.c
+++ b/src/minutils/s6-poweroff.c
@@ -1,13 +1,7 @@
/* ISC license. */
-#include <unistd.h>
-#include <sys/reboot.h>
-#include <skalibs/strerr2.h>
-
-int main ()
-{
- PROG = "s6-poweroff" ;
- sync() ;
- reboot(RB_POWER_OFF) ;
- strerr_diefu1sys(111, "reboot()") ;
-}
+#undef PROGNAME
+#define PROGNAME "s6-poweroff"
+#undef WHATDEFAULT
+#define WHATDEFAULT 2
+#include "hpr.c"
diff --git a/src/minutils/s6-reboot.c b/src/minutils/s6-reboot.c
index f006b35..0bf8785 100644
--- a/src/minutils/s6-reboot.c
+++ b/src/minutils/s6-reboot.c
@@ -1,13 +1,7 @@
/* ISC license. */
-#include <unistd.h>
-#include <sys/reboot.h>
-#include <skalibs/strerr2.h>
-
-int main ()
-{
- PROG = "s6-reboot" ;
- sync() ;
- reboot(RB_AUTOBOOT) ;
- strerr_diefu1sys(111, "reboot()") ;
-}
+#undef PROGNAME
+#define PROGNAME "s6-reboot"
+#undef WHATDEFAULT
+#define WHATDEFAULT 3
+#include "hpr.c"