[gentoo-commits] proj/openrc:master commit in: scripts/

2017-07-11 Thread William Hubbs
commit: e7807b3136d8993805082320784460f5059e6275
Author: William Hubbs  gmail  com>
AuthorDate: Tue Jul 11 19:41:29 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jul 11 19:41:29 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e7807b31

fix sysvinit compatibility for shutdown wrapper

 scripts/shutdown.in | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/scripts/shutdown.in b/scripts/shutdown.in
index 69a4a12a..7d68bf09 100644
--- a/scripts/shutdown.in
+++ b/scripts/shutdown.in
@@ -1,21 +1,29 @@
 #!@SHELL@
 
-poweroff_arg=
-while getopts :HhPr opt; do
+shutdown_arg=
+while getopts :akrhPHfFnct: opt; do
case "$opt" in
-   h|P) poweroff_arg=--poweroff ;;
-   H) poweroff_arg=--halt ;;
-   r) poweroff_arg=--reboot ;;
-   \?) printf "${0##*/}: invalid option ${optarg}\n" >&2
+   a) ;;
+   k) ;;
+   r) shutdown_arg=--reboot ;;
+   h) shutdown_arg=--halt ;;
+   P) shutdown_arg=--poweroff ;;
+   H) shutdown_arg=--halt ;;
+   f) ;;
+   F) ;;
+   n) ;;
+   c) ;;
+   t) ;;
+   [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1
;;
esac
 done
 shift $((OPTIND-1))
 
-if [ -z "${poweroff_arg}" ]; then
-   poweroff_arg=--single
+if [ -z "${shutdown_arg}" ]; then
+   shutdown_arg=--single
 fi
 
-echo @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}
-exec @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}
+echo @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"
+exec @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-07-11 Thread William Hubbs
commit: 03a461ac0ee34b7900868cdea624c6fd868b1656
Author: William Hubbs  gmail  com>
AuthorDate: Tue Jul 11 16:53:23 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jul 11 16:53:23 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=03a461ac

fix sysvinit compatibility for reboot wrapper

 scripts/reboot.in | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/scripts/reboot.in b/scripts/reboot.in
index 4da78bb7..c805ceb2 100644
--- a/scripts/reboot.in
+++ b/scripts/reboot.in
@@ -1,3 +1,25 @@
 #!@SHELL@
 
-exec @SBINDIR@/openrc-shutdown --reboot "$@"
+option_arg=
+poweroff_arg=
+while getopts :nwdfhik opt; do
+   case "$opt" in
+   n) ;;
+   w) poweroff_arg=--write-only ;;
+   d) option_arg=--no-write ;;
+   f) ;;
+   h) ;;
+   i) ;;
+   k) poweroff_arg=--kexec ;;
+   [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+   exit 1
+   ;;
+   esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+   poweroff_arg=--reboot
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-07-11 Thread William Hubbs
commit: 7e0f76e0adc545c74a8332a6ef0811d2aa62cb81
Author: William Hubbs  gmail  com>
AuthorDate: Tue Jul 11 16:09:52 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jul 11 16:10:46 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7e0f76e0

fix sysvinit compatibility for poweroff wrapper

 scripts/poweroff.in | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/scripts/poweroff.in b/scripts/poweroff.in
index 91736605..5632f679 100644
--- a/scripts/poweroff.in
+++ b/scripts/poweroff.in
@@ -1,3 +1,23 @@
 #!@SHELL@
 
-exec @SBINDIR@/openrc-shutdown --poweroff "$@"
+option_arg=
+poweroff_arg=
+while getopts :nwdfiph opt; do
+   case "$opt" in
+   n) ;;
+   w) poweroff_arg=--write-only ;;
+   d) option_arg=--no-write ;;
+   f) ;;
+   i) ;;
+   [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+   exit 1
+   ;;
+   esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+   poweroff_arg=--poweroff
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-07-10 Thread William Hubbs
commit: 9812ce5b8dc22fe36cc7bf75cf6e62db204ece3d
Author: William Hubbs  gmail  com>
AuthorDate: Mon Jul 10 23:23:01 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jul 10 23:36:24 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9812ce5b

fix halt wrapper so it is sysvinit compatible

This makes the halt wrapper sysvinit compatible. It ignores several
command line switches which are not currently implemented; however,
those can be implemented if we need to do so.

This fixes https://github.com/openrc/openrc/issues/146.

 scripts/halt.in | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/halt.in b/scripts/halt.in
index 68b13be1..257cc2a7 100644
--- a/scripts/halt.in
+++ b/scripts/halt.in
@@ -1,3 +1,24 @@
 #!@SHELL@
 
-exec @SBINDIR@/openrc-shutdown --halt "$@"
+option_arg=
+poweroff_arg=
+while getopts :nwdfiph opt; do
+   case "$opt" in
+   n) ;;
+   w) poweroff_arg=--write-only ;;
+   d) option_arg=--no-write ;;
+   f) ;;
+   i) ;;
+   p) poweroff_arg=--poweroff ;;
+   [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+   exit 1
+   ;;
+   esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+   poweroff_arg=--poweroff
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-12 Thread William Hubbs
commit: 2f81c100afdf45ebf787dfc5d3261aa6055640e4
Author: William Hubbs  gmail  com>
AuthorDate: Mon Jun 12 17:12:50 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jun 12 17:12:50 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=2f81c100

Fix link to shutdown for MKSYSVINIT=yes

 scripts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index b0af29a9..d2215b34 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -22,7 +22,7 @@ ifeq (${MKSYSVINIT},yes)
ln -sf  ${DIR}/halt ${DESTDIR}/${SBINDIR}/halt
ln -sf  ${DIR}/poweroff ${DESTDIR}/${SBINDIR}/poweroff
ln -sf  ${DIR}/reboot ${DESTDIR}/${SBINDIR}/reboot
-   ln -sf  openrc-shutdown ${DESTDIR}/${SBINDIR}/shutdown
+   ln -sf  ${DIR}/shutdown ${DESTDIR}/${SBINDIR}/shutdown
ln -sf  openrc-init ${DESTDIR}/${SBINDIR}/init
 endif
 endif



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-12 Thread William Hubbs
commit: 1e837d596e483ceb5cec177a6c7faff24a42384b
Author: William Hubbs  gmail  com>
AuthorDate: Mon Jun 12 22:58:18 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jun 12 22:58:18 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1e837d59

fix argument parsing for the sysvinit shutdown wrapper

This fixes #140.

 scripts/shutdown.in | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/scripts/shutdown.in b/scripts/shutdown.in
index 4a3d9fd1..69a4a12a 100644
--- a/scripts/shutdown.in
+++ b/scripts/shutdown.in
@@ -1,17 +1,21 @@
 #!@SHELL@
 
-args=
-for x; do
-   case "$x" in
-   -h) args=" ${args} --halt" ;;
-   *) args=" ${args} ${x} " ;;
+poweroff_arg=
+while getopts :HhPr opt; do
+   case "$opt" in
+   h|P) poweroff_arg=--poweroff ;;
+   H) poweroff_arg=--halt ;;
+   r) poweroff_arg=--reboot ;;
+   \?) printf "${0##*/}: invalid option ${optarg}\n" >&2
+   exit 1
+   ;;
esac
 done
+shift $((OPTIND-1))
 
-case "$args" in
-   *-h|--halt*) ;;
-   *-s|--single*) ;;
-   *) args=" --single ${args}" ;;
-esac
+if [ -z "${poweroff_arg}" ]; then
+   poweroff_arg=--single
+fi
 
-exec @SBINDIR@/openrc-shutdown "$args"
+echo @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}
+exec @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-12 Thread William Hubbs
commit: dcc686e42b406d63d52ef75de9a326f67d0a06c9
Author: William Hubbs  gmail  com>
AuthorDate: Mon Jun 12 17:24:18 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jun 12 17:24:18 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=dcc686e4

scripts/shutdown: fix arguments to be sysvinit shutdown compatible

This fixes #140.

 scripts/shutdown.in | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/shutdown.in b/scripts/shutdown.in
index 4f6ba637..4a3d9fd1 100644
--- a/scripts/shutdown.in
+++ b/scripts/shutdown.in
@@ -1,8 +1,17 @@
 #!@SHELL@
 
-args="$@"
-case "$@" in
-   *--single*|*-s*) args="$@" ;;
-   *) args="--single $@";;
+args=
+for x; do
+   case "$x" in
+   -h) args=" ${args} --halt" ;;
+   *) args=" ${args} ${x} " ;;
+   esac
+done
+
+case "$args" in
+   *-h|--halt*) ;;
+   *-s|--single*) ;;
+   *) args=" --single ${args}" ;;
 esac
+
 exec @SBINDIR@/openrc-shutdown "$args"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-12 Thread William Hubbs
commit: 5b7667af32effddf867a5d021c66d43f0645d374
Author: udeved  manjaro  org>
AuthorDate: Fri Jun  9 19:58:59 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jun 12 15:38:47 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5b7667af

scripts/Makefile: respect SBINDIR with MKSYSVINIT

This is for #142.

 scripts/Makefile | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index faa46b0e..5cca07bc 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -19,11 +19,11 @@ ifeq (${OS},Linux)
${INSTALL} -d ${DESTDIR}${SBINDIR}
ln -sf ../${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
 ifeq (${MKSYSVINIT},yes)
-   ln -sf  ../${DIR}/halt ${DESTDIR}/sbin/halt
-   ln -sf  ../${DIR}/poweroff ${DESTDIR}/sbin/poweroff
-   ln -sf  ../${DIR}/reboot ${DESTDIR}/sbin/reboot
-   ln -sf  ../${DIR}/shutdown ${DESTDIR}/sbin/shutdown
-   ln -sf  openrc-init ${DESTDIR}/sbin/init
+   ln -sf  ../${DIR}/halt ${DESTDIR}/${SBINDIR}/halt
+   ln -sf  ../${DIR}/poweroff ${DESTDIR}/${SBINDIR}/poweroff
+   ln -sf  ../${DIR}/reboot ${DESTDIR}/${SBINDIR}/reboot
+   ln -sf  ../${DIR}/shutdown ${DESTDIR}/${SBINDIR}/shutdown
+   ln -sf  openrc-init ${DESTDIR}/${SBINDIR}/init
 endif
 endif
 



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-12 Thread William Hubbs
commit: 199a210d2fbc524c9c400a06f832dabffd7ed1b3
Author: udeved  manjaro  org>
AuthorDate: Fri Jun  9 21:03:20 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jun 12 15:39:44 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=199a210d

scripts/Makefile: make symlinks absolute instead of relative

This closes #142.

 scripts/Makefile | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index 5cca07bc..b0af29a9 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -17,12 +17,12 @@ endif
 _installafter:
 ifeq (${OS},Linux)
${INSTALL} -d ${DESTDIR}${SBINDIR}
-   ln -sf ../${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
+   ln -sf ${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
 ifeq (${MKSYSVINIT},yes)
-   ln -sf  ../${DIR}/halt ${DESTDIR}/${SBINDIR}/halt
-   ln -sf  ../${DIR}/poweroff ${DESTDIR}/${SBINDIR}/poweroff
-   ln -sf  ../${DIR}/reboot ${DESTDIR}/${SBINDIR}/reboot
-   ln -sf  ../${DIR}/shutdown ${DESTDIR}/${SBINDIR}/shutdown
+   ln -sf  ${DIR}/halt ${DESTDIR}/${SBINDIR}/halt
+   ln -sf  ${DIR}/poweroff ${DESTDIR}/${SBINDIR}/poweroff
+   ln -sf  ${DIR}/reboot ${DESTDIR}/${SBINDIR}/reboot
+   ln -sf  openrc-shutdown ${DESTDIR}/${SBINDIR}/shutdown
ln -sf  openrc-init ${DESTDIR}/${SBINDIR}/init
 endif
 endif



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-06-07 Thread William Hubbs
commit: 84d140a1f6abf95a4170d13527152d3ab14e6613
Author: William Hubbs  gmail  com>
AuthorDate: Wed Jun  7 15:59:42 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Jun  7 15:59:42 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=84d140a1

scripts/shutdown: pass --single to openrc-shutdown

Sysvinit shutdown has a default of single user mode, but openrc-shutdown
makes you choose a default action. Because of this, the shutdown wrapper
needs to pass --single to openrc-shutdown.

 scripts/shutdown.in | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/shutdown.in b/scripts/shutdown.in
index 6bb65260..4f6ba637 100644
--- a/scripts/shutdown.in
+++ b/scripts/shutdown.in
@@ -1,3 +1,8 @@
 #!@SHELL@
 
-exec @SBINDIR@/openrc-shutdown "$@"
+args="$@"
+case "$@" in
+   *--single*|*-s*) args="$@" ;;
+   *) args="--single $@";;
+esac
+exec @SBINDIR@/openrc-shutdown "$args"



[gentoo-commits] proj/openrc:master commit in: scripts/, /

2017-05-31 Thread William Hubbs
commit: 1564e155b726308200ecd5df315c002bd8b16952
Author: William Hubbs  gmail  com>
AuthorDate: Wed May 31 18:15:32 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed May 31 23:07:02 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1564e155

openrc-init: add optional sysvinit compatibility

 README.md   |  1 +
 scripts/.gitignore  |  4 
 scripts/Makefile| 13 -
 scripts/halt.in |  3 +++
 scripts/poweroff.in |  3 +++
 scripts/reboot.in   |  3 +++
 scripts/shutdown.in |  3 +++
 7 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 80b28a9b..54f8f8f8 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ MKPREFIX=yes
 MKPKGCONFIG=no
 MKSELINUX=yes
 MKSTATICLIBS=no
+MKSYSVINIT=yes
 MKTERMCAP=ncurses
 MKTERMCAP=termcap
 PKG_PREFIX=/usr/pkg

diff --git a/scripts/.gitignore b/scripts/.gitignore
index 8b9d7ba6..e26c51ae 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1 +1,5 @@
+halt
+poweroff
 rc-sstat
+reboot
+shutdown

diff --git a/scripts/Makefile b/scripts/Makefile
index 13b8024f..faa46b0e 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -8,12 +8,23 @@ INSTALLAFTER = _installafter
 ifeq (${OS},Linux)
 SRCS+= rc-sstat.in
 BIN+=  rc-sstat
+ifeq (${MKSYSVINIT},yes)
+SRCS+= halt.in poweroff.in reboot.in shutdown.in
+BIN+=  halt poweroff reboot shutdown
+   endif
 endif
 
 _installafter:
 ifeq (${OS},Linux)
${INSTALL} -d ${DESTDIR}${SBINDIR}
-   ln -sf ${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
+   ln -sf ../${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
+ifeq (${MKSYSVINIT},yes)
+   ln -sf  ../${DIR}/halt ${DESTDIR}/sbin/halt
+   ln -sf  ../${DIR}/poweroff ${DESTDIR}/sbin/poweroff
+   ln -sf  ../${DIR}/reboot ${DESTDIR}/sbin/reboot
+   ln -sf  ../${DIR}/shutdown ${DESTDIR}/sbin/shutdown
+   ln -sf  openrc-init ${DESTDIR}/sbin/init
+endif
 endif
 
 include ${MK}/scripts.mk

diff --git a/scripts/halt.in b/scripts/halt.in
new file mode 100644
index ..68b13be1
--- /dev/null
+++ b/scripts/halt.in
@@ -0,0 +1,3 @@
+#!@SHELL@
+
+exec @SBINDIR@/openrc-shutdown --halt "$@"

diff --git a/scripts/poweroff.in b/scripts/poweroff.in
new file mode 100644
index ..91736605
--- /dev/null
+++ b/scripts/poweroff.in
@@ -0,0 +1,3 @@
+#!@SHELL@
+
+exec @SBINDIR@/openrc-shutdown --poweroff "$@"

diff --git a/scripts/reboot.in b/scripts/reboot.in
new file mode 100644
index ..4da78bb7
--- /dev/null
+++ b/scripts/reboot.in
@@ -0,0 +1,3 @@
+#!@SHELL@
+
+exec @SBINDIR@/openrc-shutdown --reboot "$@"

diff --git a/scripts/shutdown.in b/scripts/shutdown.in
new file mode 100644
index ..6bb65260
--- /dev/null
+++ b/scripts/shutdown.in
@@ -0,0 +1,3 @@
+#!@SHELL@
+
+exec @SBINDIR@/openrc-shutdown "$@"



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-02-22 Thread William Hubbs
commit: f6ea16159ec8583a6f2182578334aa00578cb080
Author: William Hubbs  gmail  com>
AuthorDate: Wed Feb 22 20:25:02 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Feb 22 20:25:02 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=f6ea1615

scripts: make sure the rc-sstat symlink is always replaced

 scripts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index 9a66c65d..13b8024f 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -13,7 +13,7 @@ endif
 _installafter:
 ifeq (${OS},Linux)
${INSTALL} -d ${DESTDIR}${SBINDIR}
-   ln -s ${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
+   ln -sf ${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
 endif
 
 include ${MK}/scripts.mk



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-01-26 Thread William Hubbs
commit: b693af90556ac9b055ba5c6e589066c1e08b2146
Author: William Hubbs  gmail  com>
AuthorDate: Thu Jan 26 21:39:19 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Thu Jan 26 21:39:19 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b693af90

Revert "scripts: do not substitute for @SHELL@ in rc-sstat"

This reverts commit e2e652e469efa5f3ebcd69828ff16d8f5ad3f1b8.

 scripts/Makefile  | 1 +
 scripts/{rc-sstat => rc-sstat.in} | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index f4e3c68..9a66c65 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -6,6 +6,7 @@ BIN=on_ac_power
 INSTALLAFTER = _installafter
 
 ifeq (${OS},Linux)
+SRCS+= rc-sstat.in
 BIN+=  rc-sstat
 endif
 

diff --git a/scripts/rc-sstat b/scripts/rc-sstat.in
old mode 100755
new mode 100644
similarity index 99%
rename from scripts/rc-sstat
rename to scripts/rc-sstat.in
index bcd0ae2..a204dbd
--- a/scripts/rc-sstat
+++ b/scripts/rc-sstat.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
 # Copyright (c) 2015 The OpenRC Authors.
 # See the Authors file at the top-level directory of this distribution and
 # https://github.com/OpenRC/openrc/blob/master/AUTHORS



[gentoo-commits] proj/openrc:master commit in: scripts/

2017-01-08 Thread William Hubbs
commit: e2e652e469efa5f3ebcd69828ff16d8f5ad3f1b8
Author: William Hubbs  gmail  com>
AuthorDate: Mon Jan  9 02:42:26 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Mon Jan  9 02:42:26 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e2e652e4

scripts: do not substitute for @SHELL@ in rc-sstat

 scripts/Makefile  | 1 -
 scripts/{rc-sstat.in => rc-sstat} | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/Makefile b/scripts/Makefile
index 9a66c65..f4e3c68 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -6,7 +6,6 @@ BIN=on_ac_power
 INSTALLAFTER = _installafter
 
 ifeq (${OS},Linux)
-SRCS+= rc-sstat.in
 BIN+=  rc-sstat
 endif
 

diff --git a/scripts/rc-sstat.in b/scripts/rc-sstat
old mode 100644
new mode 100755
similarity index 99%
rename from scripts/rc-sstat.in
rename to scripts/rc-sstat
index a204dbd..bcd0ae2
--- a/scripts/rc-sstat.in
+++ b/scripts/rc-sstat
@@ -1,4 +1,4 @@
-#!@SHELL@
+#!/bin/sh
 # Copyright (c) 2015 The OpenRC Authors.
 # See the Authors file at the top-level directory of this distribution and
 # https://github.com/OpenRC/openrc/blob/master/AUTHORS



[gentoo-commits] proj/openrc:master commit in: scripts/, sh/, init.d/, src/test/, src/rc/, test/

2016-01-22 Thread William Hubbs
commit: e277ae57efaba3be3eb619fd00084b116c370231
Author: William Hubbs  gmail  com>
AuthorDate: Fri Jan 22 17:54:16 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jan 22 18:07:13 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e277ae57

fix tests

X-Gentoo-Bug: 572602
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=572602

 init.d/netmount.in   | 2 +-
 scripts/rc-sstat.in  | 6 +++---
 sh/openrc-run.sh.in  | 2 +-
 src/rc/rc-selinux.h  | 6 +++---
 src/rc/rc.c  | 2 +-
 src/test/runtests.sh | 3 +++
 test/setup_env.sh| 4 
 7 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/init.d/netmount.in b/init.d/netmount.in
index 99e0dda..0acf15e 100644
--- a/init.d/netmount.in
+++ b/init.d/netmount.in
@@ -21,7 +21,7 @@ depend()
esac
done
config /etc/fstab
-   want $mywant
+   want $mywant
use afc-client amd openvpn
use dns
keyword -jail -prefix -systemd-nspawn -vserver -lxc

diff --git a/scripts/rc-sstat.in b/scripts/rc-sstat.in
index 44dc9e0..a204dbd 100644
--- a/scripts/rc-sstat.in
+++ b/scripts/rc-sstat.in
@@ -52,8 +52,8 @@ if [ ! -d $scandir ]; then
exit 1
 fi
 
-# Make sure s6-svscan is running 
-if ! pgrep s6-svscan >/dev/null ; then 
+# Make sure s6-svscan is running
+if ! pgrep s6-svscan >/dev/null ; then
printf "s6-svscan is not running\n"
exit 1
 fi
@@ -141,7 +141,7 @@ do
fi
 done
 
-# Cleanup 
+# Cleanup
 rm -f $statfile 2>/dev/null
 
 printf "\n\n"

diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index b393e94..fb6f95b 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -244,7 +244,7 @@ for _cmd; do
break
fi
 done
- 
+
 # Load our script
 sourcex "$RC_SERVICE"
 

diff --git a/src/rc/rc-selinux.h b/src/rc/rc-selinux.h
index 6bc1acc..c3258d9 100644
--- a/src/rc/rc-selinux.h
+++ b/src/rc/rc-selinux.h
@@ -25,10 +25,10 @@ void selinux_setup(char **argv);
 
 /* always return false for selinux_util_open() */
 #define selinux_util_open() (0)
-#define selinux_util_label(x) do { } while(0)
-#define selinux_util_close() do { } while(0)
+#define selinux_util_label(x) do { } while (0)
+#define selinux_util_close() do { } while (0)
 
-#define selinux_setup(x) do { } while(0)
+#define selinux_setup(x) do { } while (0)
 
 #endif
 

diff --git a/src/rc/rc.c b/src/rc/rc.c
index 7836341..4efa0cf 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -282,7 +282,7 @@ open_shell(void)
 
 #ifdef __linux__
const char *sys = rc_sys();
-   
+
/* VSERVER systems cannot really drop to shells */
if (sys && strcmp(sys, RC_SYS_VSERVER) == 0)
{

diff --git a/src/test/runtests.sh b/src/test/runtests.sh
index 5a87c84..1736dd5 100755
--- a/src/test/runtests.sh
+++ b/src/test/runtests.sh
@@ -85,12 +85,14 @@ eend $? "Trailing newlines need to be deleted:"$'\n'"${out}"
 
 ebegin "Checking for obsolete functions"
 out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
+   ! -name queue.h \
-exec grep -n -E 
'\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' {} +)
 [ -z "${out}" ]
 eend $? "Avoid these obsolete functions:"$'\n'"${out}"
 
 ebegin "Checking for x* func usage"
 out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
+   ! -name queue.h \
-exec grep -n -E '\<(malloc|strdup)[[:space:]]*\(' {} + \
| grep -v \
-e src/includes/helpers.h \
@@ -100,6 +102,7 @@ eend $? "These need to be using the x* 
variant:"$'\n'"${out}"
 
 ebegin "Checking spacing style"
 out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
+   ! -name queue.h \
-exec grep -n -E \
-e '\<(for|if|switch|while)\(' \
-e '\<(for|if|switch|while) \( ' \

diff --git a/test/setup_env.sh b/test/setup_env.sh
index f7996ee..ffbd027 100755
--- a/test/setup_env.sh
+++ b/test/setup_env.sh
@@ -21,7 +21,3 @@ 
LD_LIBRARY_PATH=${top_builddir}/src/libeinfo:${top_builddir}/src/librc:${LD_LIBR
 PATH=${top_builddir}/src/rc:${PATH}
 export LD_LIBRARY_PATH PATH
 
-cd ${top_srcdir}/src/rc
-${MAKE:-make} links >/dev/null
-cd -
-



[gentoo-commits] proj/openrc:master commit in: scripts/, man/

2015-06-10 Thread William Hubbs
commit: d2ce07e227ec95370e8aee5f1199edc6ad61aff9
Author: William Hubbs w.d.hubbs AT gmail DOT com
AuthorDate: Tue Jun  9 21:19:51 2015 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Wed Jun 10 23:45:29 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=d2ce07e2

Add rc-sstat script

The rc-sstat script is written to display status of s6 services and
run rc-status to display all services status.

This currently only works on Linux.

 man/Makefile|  10 +++-
 man/rc-sstat.8  |  46 +
 scripts/.gitignore  |   1 +
 scripts/Makefile|  16 +-
 scripts/rc-sstat.in | 140 
 5 files changed, 210 insertions(+), 3 deletions(-)

diff --git a/man/Makefile b/man/Makefile
index 436f647..73db2a8 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -1,9 +1,17 @@
+MK=../mk
+include ${MK}/sys.mk
+include ${MK}/os.mk
+
 MAN3=  einfo.3 \
rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
rc_runlevel.3 rc_service.3 rc_stringlist.3
 MAN8=  rc-service.8 rc-status.8 rc-update.8 openrc.8 openrc-run.8 \
service.8 start-stop-daemon.8
 
+ifeq (${OS},Linux)
+MAN8 += rc-sstat.8
+endif
+
 # Handy macro to create symlinks
 # This does rely on correctly formatting our manpages!
 MAKE_LINKS=suffix=$${man\#*.}; \
@@ -16,8 +24,6 @@ MAKE_LINKS=   suffix=$${man\#*.}; \
fi; \
done;
 
-MK=../mk
-include ${MK}/sys.mk
 include ${MK}/gitignore.mk
 
 all:

diff --git a/man/rc-sstat.8 b/man/rc-sstat.8
new file mode 100644
index 000..2f2c4a6
--- /dev/null
+++ b/man/rc-sstat.8
@@ -0,0 +1,46 @@
+.\ Copyright (c) 2015 William Hubbs
+.\
+.\ 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 AUTHOR 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 AUTHOR 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.
+.\
+.Dd April 24, 2008
+.Dt RC-sstat 8 SMM
+.Os OpenRC
+.Sh NAME
+.Nm rc-sstat
+.Nd show status info about services supervised by s6 then rc-status
+info
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+.Nm
+gathers and displays information about the status of services supervised
+by s6 then runs rc-status to show info about nnormal OpenRC services.
+.Pp
+.Sh EXIT STATUS
+.Nm
+exits 1 if there is an internal error or exits with the same exit codes
+as rc-status.
+.Sh SEE ALSO
+.Xr rc-status 8 ,
+.Xr rc-update 8
+.Sh AUTHORS
+.An William Hubbs w.d.hu...@gmail.com

diff --git a/scripts/.gitignore b/scripts/.gitignore
new file mode 100644
index 000..8b9d7ba
--- /dev/null
+++ b/scripts/.gitignore
@@ -0,0 +1 @@
+rc-sstat

diff --git a/scripts/Makefile b/scripts/Makefile
index 3d41631..9a66c65 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -1,5 +1,19 @@
+MK=../mk
+include ${MK}/os.mk
+
 DIR=   ${LIBEXECDIR}/bin
 BIN=   on_ac_power
+INSTALLAFTER = _installafter
+
+ifeq (${OS},Linux)
+SRCS+= rc-sstat.in
+BIN+=  rc-sstat
+endif
+
+_installafter:
+ifeq (${OS},Linux)
+   ${INSTALL} -d ${DESTDIR}${SBINDIR}
+   ln -s ${DIR}/rc-sstat ${DESTDIR}/${SBINDIR}/rc-sstat
+endif
 
-MK=../mk
 include ${MK}/scripts.mk

diff --git a/scripts/rc-sstat.in b/scripts/rc-sstat.in
new file mode 100644
index 000..8896695
--- /dev/null
+++ b/scripts/rc-sstat.in
@@ -0,0 +1,140 @@
+#!@SHELL@
+
+# Define variables
+scandir=/run/openrc/s6-scan
+statfile=/dev/shm/s6-svstat.${USER}
+
+color_red='\E[01;31m'
+color_green='\E[32m'
+color_yellow='\E[01;33m'
+
+# Time Modules
+uptimeModules() {
+   # Given a single integer argument representing seconds of uptime...
+   # convert uptime to a friendly human readable string: '2d 16h 58m 46s'
+   # define a variable to keep track of the longest length uptime string
+   uSec=${1:-0}
+
+   uDay=$(( $uSec / 86400 ))
+   uSec=$((