From d18999790c462bc780bff457e6bb03cd88e488f3 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 19 Mar 2016 12:33:27 +0000 Subject: Changes to s6-halt/s6-reboot/s6-poweroff. Default behaviour changed. Major version bump: rc for 2.1.0.0 --- COPYING | 2 +- doc/index.html | 2 +- doc/s6-halt.html | 34 ++++++++++++++++++++++++++-------- doc/s6-poweroff.html | 37 ++++++++++++++++++++++++++----------- doc/s6-reboot.html | 36 ++++++++++++++++++++++++++---------- doc/upgrade.html | 10 ++++++++++ package/deps.mak | 9 --------- package/info | 2 +- package/modes | 3 --- package/targets.mak | 2 +- src/minutils/deps-exe/halt | 1 - src/minutils/deps-exe/poweroff | 1 - src/minutils/deps-exe/reboot | 1 - src/minutils/halt.c | 7 ------- src/minutils/hpr.c | 21 ++++++++------------- src/minutils/poweroff.c | 7 ------- src/minutils/reboot.c | 7 ------- src/minutils/s6-halt.c | 16 +++++----------- src/minutils/s6-poweroff.c | 16 +++++----------- src/minutils/s6-reboot.c | 16 +++++----------- 20 files changed, 115 insertions(+), 115 deletions(-) delete mode 100644 src/minutils/deps-exe/halt delete mode 100644 src/minutils/deps-exe/poweroff delete mode 100644 src/minutils/deps-exe/reboot delete mode 100644 src/minutils/halt.c delete mode 100644 src/minutils/poweroff.c delete mode 100644 src/minutils/reboot.c diff --git a/COPYING b/COPYING index a49b1ca..f496e31 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2011-2015 Laurent Bercot +Copyright (c) 2011-2016 Laurent Bercot 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.

Download

    -
  • The current released version of s6-linux-utils is 2.0.2.3.
  • +
  • The current released version of s6-linux-utils is 2.1.0.0.
  • Alternatively, you can checkout a copy of the s6-linux-utils git repository:
     git clone git://git.skarnet.org/s6-linux-utils 
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 @@ s6-linux-utils: the s6-halt program - + @@ -19,19 +19,37 @@

The s6-halt program

-s6-halt syncs the filesystems and halts the machine -immediately, without switching the power off. -
This is different from the sysvinit halt -command, which is an alias for shutdown -h. The -s6-linux-utils s6-halt command is more or less equivalent to -sysvinit's halt -f. +s6-halt sends a signal to process 1 in order to halt the machine; +or, with the -f option, it performs an immediate hard shutdown.

Interface

-     s6-halt
+     s6-halt [ -h | -p | -r ] [ -f ]
 
+
    +
  • s6-halt sends a signal to process 1.
  • +
  • It then exits 0.
  • +
+ +

Options

+ +
    +
  • -h : 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.
  • +
  • -p : poweroff. The command will order a power off, which means +sending a SIGUSR1 to process 1.
  • +
  • -r : reboot. The command will order a reboot, which means +sending a SIGINT to process 1.
  • +
  • -f : 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. +s6-reboot -f or s6-poweroff -f 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.
  • +
+ 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 @@ s6-linux-utils: the s6-poweroff program - + @@ -19,22 +19,37 @@

The s6-poweroff program

-s6-poweroff syncs the filesystems and halts the machine -immediately, switching the power off if possible. -

- -

- This is different from the sysvinit poweroff -command, which performs shutdown. The -s6-linux-utils s6-poweroff command is more or less equivalent to -sysvinit's poweroff -f. +s6-poweroff sends a signal to process 1 in order to power off the machine; +or, with the -f option, it performs an immediate hard shutdown.

Interface

-     s6-poweroff
+     s6-poweroff [ -h | -p | -r ] [ -f ]
 
+
    +
  • s6-poweroff sends a signal to process 1.
  • +
  • It then exits 0.
  • +
+ +

Options

+ +
    +
  • -h : 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.
  • +
  • -p : poweroff. The command will order a power off, which means +sending a SIGUSR1 to process 1. This is the default.
  • +
  • -r : reboot. The command will order a reboot, which means +sending a SIGINT to process 1.
  • +
  • -f : 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. +s6-reboot -f or s6-poweroff -f 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.
  • +
+ 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 @@ s6-linux-utils: the s6-reboot program - + @@ -19,21 +19,37 @@

The s6-reboot program

-s6-reboot syncs the filesystems and reboots the machine -immediately. -

- -

This is different from the sysvinit reboot -command, which is an alias for shutdown -r. The -s6-linux-utils s6-reboot command is more or less equivalent to -sysvinit's reboot -f. +s6-reboot sends a signal to process 1 in order to reboot the machine; +or, with the -f option, it performs an immediate reboot.

Interface

-     s6-reboot
+     s6-reboot [ -h | -p | -r ] [ -f ]
 
+
    +
  • s6-reboot sends a signal to process 1.
  • +
  • It then exits 0.
  • +
+ +

Options

+ +
    +
  • -h : 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.
  • +
  • -p : poweroff. The command will order a power off, which means +sending a SIGUSR1 to process 1.
  • +
  • -r : reboot. The command will order a reboot, which means +sending a SIGINT to process 1. This is the default.
  • +
  • -f : 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. +s6-reboot -f or s6-poweroff -f 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.
  • +
+ 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 @@

What has changed in s6-linux-utils

+

in 2.1.0.0

+ +
    +
  • s6-halt, +s6-poweroff and +s6-reboot have changed behaviours. +They now send a signal to process 1 by default; to make them +perform a hard shutdown, add the -f option.
  • +
+

in 2.0.2.3

    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 #include -#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 -#include -#include - -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 -#include -#include - -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 -#include -#include - -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" -- cgit v1.2.3