[gentoo-commits] proj/openrc:openrc-0.13.x commit in: sh/

2015-01-15 Thread William Hubbs
commit: 50329eee7a126dd1e961d8fb823e5f35f515a143
Author: William Hubbs w.d.hubbs AT gmail DOT com
AuthorDate: Mon Jan 12 20:37:10 2015 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Tue Jan 13 07:07:02 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=50329eee

Add description for cgroup_cleanup

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

---
 sh/rc-cgroup.sh.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index b635340..0426026 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -2,6 +2,7 @@
 # Copyright (c) 2012 Alexander Vershilov qni...@gentoo.org
 # Released under the 2-clause BSD license.
 extra_stopped_commands=${extra_stopped_commands} cgroup_cleanup
+description_cgroup_cleanup=Kill all processes in the cgroup
 
 cgroup_find_path()
 {



[gentoo-commits] proj/openrc:openrc-0.13.x commit in: sh/

2014-10-16 Thread William Hubbs
commit: a2187e897e3c0fc9a29adb0b81a57f2b718e74c5
Author: Roy Marples roy AT marples DOT name
AuthorDate: Thu Sep 11 18:26:58 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Thu Oct 16 16:09:36 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a2187e89

Use exception-based approach for cgroup/ulimit setup

Note from William Hubbs:
I spoke with Roy about this, and he pointed out that user-defined
functions may need the limits applied, so it is better to go with a
method that uses exceptions to determine which functions apply the
limits.

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

---
 sh/runscript.sh.in | 34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index d4c7c60..b89c460 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -209,19 +209,29 @@ unset _conf_d
 # Load any system overrides
 sourcex -e @SYSCONFDIR@/rc.conf
 
-# Apply any ulimit defined
-[ -n ${rc_ulimit:-$RC_ULIMIT} ]  ulimit ${rc_ulimit:-$RC_ULIMIT}
-
-# Apply cgroups settings if defined
-if [ $1 = start ] ; then
-   if [ $(command -v cgroup_add_service) = cgroup_add_service ]; then
-   cgroup_add_service /sys/fs/cgroup/openrc
-   cgroup_add_service /sys/fs/cgroup/systemd/system
+for _cmd; do
+   if [ $_cmd != status -a $_cmd != describe ]; then
+   # Apply any ulimit defined
+   [ -n ${rc_ulimit:-$RC_ULIMIT} ]  \
+   ulimit ${rc_ulimit:-$RC_ULIMIT}
+   # Apply cgroups settings if defined
+   if [ $(command -v cgroup_add_service) = \
+   cgroup_add_service ]
+   then
+   if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
+   eerror No permission to apply cgroup settings
+   break
+   fi
+   cgroup_add_service /sys/fs/cgroup/openrc
+   cgroup_add_service /sys/fs/cgroup/systemd/system
+   fi
+   [ $(command -v cgroup_set_limits) = \
+   cgroup_set_limits ]  \
+   cgroup_set_limits
+   break
fi
-   [ $(command -v cgroup_set_limits) = cgroup_set_limits ]  \
-   cgroup_set_limits
-fi
-
+done
+ 
 # Load our script
 sourcex $RC_SERVICE
 



[gentoo-commits] proj/openrc:openrc-0.13.x commit in: sh/

2014-10-16 Thread William Hubbs
commit: b8e52583ca590d0f956acea0ec558e84495e3818
Author: Andrew Gregory andrew.gregory.8 AT gmail DOT com
AuthorDate: Mon Aug 25 19:37:45 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Mon Oct 13 20:39:22 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b8e52583

tmpfiles.sh: add support for + modifier

systemd added support for b+, c+, p+, and L+ in 2e78fa79 and 1554afae to
remove the target path if it already exists.

---
 sh/tmpfiles.sh.in | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 42a3639..41f86cf 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -304,6 +304,7 @@ for FILE in $tmpfiles_d ; do
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
+   FORCE=0
 
# Unless we have both command and path, skip this line.
if [ -z $cmd -o -z $path ]; then
@@ -311,13 +312,20 @@ for FILE in $tmpfiles_d ; do
fi
 
case $cmd in
-   *!) [ $BOOT -eq 1 ] || continue; cmd=${cmd%!} ;;
+   \#*) continue ;;
esac
 
+   while [ ${#cmd} -gt 1 ]; do
+   case $cmd in
+   *!) cmd=${cmd%!}; [ $BOOT -eq 1 ] || 
continue 2 ;;
+   *+) cmd=${cmd%+}; FORCE=1; ;;
+   *) warninvalid ; continue 2 ;;
+   esac
+   done
+
# whine about invalid entries
case $cmd in
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
-   \#*) continue ;;
*) warninvalid ; continue ;;
esac
 
@@ -338,6 +346,13 @@ for FILE in $tmpfiles_d ; do
 
[ -n $EXCLUDE ]  checkprefix $path $EXCLUDE  continue
[ -n $PREFIX ]  ! checkprefix $path $PREFIX  continue
+
+   if [ $FORCE -gt 0 ]; then
+   case $cmd in
+   p|L|c|b) [ -f $path ]  dryrun_or_real rm -f 
$path
+   esac
+   fi
+
[ $VERBOSE -eq 1 ]  echo _$cmd $@
_$cmd $@
rc=$?



[gentoo-commits] proj/openrc:openrc-0.13.x commit in: sh/

2014-10-16 Thread William Hubbs
commit: 43d727dc3f17bc9a1d020ed2a5684d4a26bb620a
Author: Andrew Gregory andrew.gregory.8 AT gmail DOT com
AuthorDate: Mon Aug 25 19:46:28 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Mon Oct 13 20:39:36 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=43d727dc

tmpfiles.sh: add support for C action

Recursively copies files or directories.  Added by systemd in 849958d1.

---
 sh/tmpfiles.sh.in | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 41f86cf..6e7be42 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -80,6 +80,17 @@ _c() {
fi
 }
 
+_C() {
+   # recursively copy a file or directory
+   local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+   if [ ! -e $path ]; then
+   dryrun_or_real cp -r $arg $path
+   _restorecon $path
+   [ $uid != '-' ]  dryrun_or_real chown $uid $path
+   [ $gid != '-' ]  dryrun_or_real chgrp $gid $path
+   [ $mode != '-' ]  dryrun_or_real chmod $mode $path
+   fi
+}
 
 _f() {
# Create a file if it doesn't exist yet
@@ -325,7 +336,7 @@ for FILE in $tmpfiles_d ; do
 
# whine about invalid entries
case $cmd in
-   f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
+   f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
*) warninvalid ; continue ;;
esac
 
@@ -334,7 +345,7 @@ for FILE in $tmpfiles_d ; do
case $cmd in
p|f|F) mode=0644 ;;
d|D) mode=0755 ;;
-   z|Z|x|r|R|L) ;;
+   C|z|Z|x|r|R|L) ;;
esac
fi
 



[gentoo-commits] proj/openrc:openrc-0.13.x commit in: sh/

2014-10-16 Thread William Hubbs
commit: 082fd53d9e634318e87e2cb1f2ccc7bf12bf09df
Author: William Hubbs w.d.hubbs AT gmail DOT com
AuthorDate: Thu Sep 11 17:02:51 2014 +
Commit: William Hubbs williamh AT gentoo DOT org
CommitDate: Mon Oct 13 20:40:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=082fd53d

runscript: move verbose mode setting near debug setting

---
 sh/runscript.sh.in | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 9b2ae0e..d4c7c60 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -185,6 +185,10 @@ status()
 }
 
 yesno $RC_DEBUG  set -x
+if yesno ${rc_verbose:-$RC_VERBOSE}; then
+   EINFO_VERBOSE=yes
+   export EINFO_VERBOSE
+fi
 
 _conf_d=${RC_SERVICE%/*}/../conf.d
 # If we're net.eth0 or openvpn.work then load net or openvpn config
@@ -208,12 +212,6 @@ sourcex -e @SYSCONFDIR@/rc.conf
 # Apply any ulimit defined
 [ -n ${rc_ulimit:-$RC_ULIMIT} ]  ulimit ${rc_ulimit:-$RC_ULIMIT}
 
-# Set verbose mode
-if yesno ${rc_verbose:-$RC_VERBOSE}; then
-   EINFO_VERBOSE=yes
-   export EINFO_VERBOSE
-fi
-
 # Apply cgroups settings if defined
 if [ $1 = start ] ; then
if [ $(command -v cgroup_add_service) = cgroup_add_service ]; then