* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-01-29 15:53 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-01-29 15:53 UTC (permalink / raw
To: gentoo-commits
commit: cea71369e99a08c0fc3d9166bbfe9247ef8900ce
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 29 15:47:43 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jan 29 15:47:43 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cea71369
cgroups: only create the cgroup when the service is being started
---
sh/runscript.sh.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 18bf4c3..83db42b 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -189,8 +189,8 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
-if [ "$RC_UNAME" = "Linux" ]; then
- if [ -d /sys/fs/cgroup/openrc ] && checkpath -W /sys/fs/cgroup/openrc ; then
+if [ "$RC_UNAME" = "Linux" -a "$1" = "start" ]; then
+ if [ -d /sys/fs/cgroup/openrc ]; then
mkdir -p /sys/fs/cgroup/openrc/${RC_SVCNAME}
echo $$ > /sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-06-15 22:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-06-15 22:45 UTC (permalink / raw
To: gentoo-commits
commit: a097933edab9d7221df1831e098415d604437c98
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Jun 15 22:44:39 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jun 15 22:44:39 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a097933e
sh/start-stop-daemon.sh: fix processing of the logger arguments
sh/start-stop-daemon.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 69666ff7..e68b47ef 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -38,6 +38,10 @@ ssd_start()
service_inactive && _inactive=true
mark_service_inactive
fi
+ [ -n "$output_logger" ] &&
+ output_logger_arg="--stdout-logger \"$output_logger\""
+ [ -n "$error_logger" ] &&
+ error_logger_arg="--stderr-logger \"$error_logger\""
#the eval call is necessary for cases like:
# command_args="this \"is a\" test"
# to work properly.
@@ -47,8 +51,8 @@ ssd_start()
${directory:+--chdir} $directory \
${output_log+--stdout} $output_log \
${error_log+--stderr} $error_log \
- ${output_logger+--stdout-logger} \"$output_logger\" \
- ${error_logger+--stderr-logger} \"$error_logger\" \
+ ${output_logger_arg} \
+ ${error_logger_arg} \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-05-22 22:12 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-05-22 22:12 UTC (permalink / raw
To: gentoo-commits
commit: fa5aea80c50fb724d2c98a6542307adbafd0e62d
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue May 22 16:12:12 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue May 22 17:20:38 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fa5aea80
openrc-run.sh: move crashed test outside started test
This is handled inside librc, so we don't need the nesting in this
script.
sh/openrc-run.sh.in | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index e3dff6ce..7e9064c2 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -133,11 +133,10 @@ _status()
elif service_inactive; then
ewarn "status: inactive"
return 16
+ elif service_crashed; then
+ eerror "status: crashed"
+ return 32
elif service_started; then
- if service_crashed; then
- eerror "status: crashed"
- return 32
- fi
einfo "status: started"
return 0
else
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-03-12 2:43 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-03-12 2:43 UTC (permalink / raw
To: gentoo-commits
commit: 61905bfcf560219939c902dbb8fe9bc5088a42cf
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Mar 12 02:40:57 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Mar 12 02:41:01 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=61905bfc
Clean up cgroups v2 code
Remove the IFS manipulation and simplify the loop that processes the
settings.
sh/rc-cgroup.sh.in | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 5bc7db54..d4b68ada 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -184,18 +184,17 @@ cgroup2_set_limits()
cgroup_path="$(cgroup2_find_path)"
[ -d "${cgroup_path}" ] || return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
- local OIFS="$IFS"
- IFS="
-"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
- printf "%d" 0 > "${rc_cgroup_path}/cgroup.procs"
- echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do
- [ -z "${key}" ] || [ -z "${value}" ] && continue
- [ ! -e "${rc_cgroup_path}/${key}" ] && continue
- veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}"
- printf "%s" "${value}" > "${rc_cgroup_path}/${key}"
+ [ -f "${rc_cgroup_path}"/cgroup.procs ] &&
+ printf 0 > "${rc_cgroup_path}"/cgroup.procs
+ [ -z "${rc_cgroup_settings}" ] && return 0
+ echo "${rc_cgroup_settings}" | while read -r key value; do
+ [ -z "${key}" ] && continue
+ [ -z "${value}" ] && continue
+ [ ! -f "${rc_cgroup_path}/${key}" ] && continue
+ veinfo "${RC_SVCNAME}: cgroups: setting ${key} to ${value}"
+ printf "%s\n" "${value}" > "${rc_cgroup_path}/${key}"
done
- IFS="$OIFS"
return 0
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-02-28 18:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-02-28 18:45 UTC (permalink / raw
To: gentoo-commits
commit: 5bb6f9aa318a6d0507971b74d88c3fd2803bae4b
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Wed Feb 28 18:41:54 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 18:42:58 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5bb6f9aa
init.sh: apply SELinux label for /run early in boot
Some initramfs mount /run which then ends up with the wrong labels.
Force relabel all of /run right after its mounted to fix.
sh/init.sh.Linux.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index b07463b3..7ee25b57 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -83,6 +83,7 @@ elif ! mountinfo -q /run; then
fi
fi
+[ -x /sbin/restorecon ] && /sbin/restorecon -rF /run
checkpath -d $RC_SVCDIR
checkpath -d -m 0775 -o root:uucp /run/lock
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-02-28 18:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-02-28 18:45 UTC (permalink / raw
To: gentoo-commits
commit: 1ab8541a6ccb9d72c6faeaf2d616fc49f6cdfaf6
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Wed Feb 28 17:24:55 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 17:24:55 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1ab8541a
init-early.sh.Linux.in: apply the selinux label to /dev/console early
/dev/console is relabelled later in the devfs init script, but by then we
have already missed some of the messages, so fix that label early.
sh/init-early.sh.Linux.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index 1898c440..f07bc11b 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -33,6 +33,9 @@ else
kmode="-a"
fi
+# Set the SELinux label on console before everything so we dont lose output
+[ -x /sbin/restorecon ] && /sbin/restorecon -F /dev/console
+
# Try and set a font and as early as we can
if service_present "$RC_DEFAULTLEVEL" consolefont ||
service_present "$RC_BOOTLEVEL" consolefont; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2018-02-23 21:53 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2018-02-23 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 16ff3cd8df6169f73e3d7cf00758a4703f62cbf0
Author: Christian Brauner <christian.brauner <AT> ubuntu <DOT> com>
AuthorDate: Mon Feb 12 12:32:01 2018 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 23 21:51:12 2018 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=16ff3cd8
check whether /sys/fs/cgroup is a mountpoint
The current check only tries to detect whether /sys/fs/cgroup exists and
whether it is writable or not. But when the init system doesn't mount
cgroups then /sys/fs/cgroup will just be an empty directory. When paired
with unprivileged containers that mount sysfs this will cause misleading
errors to be printed since /sys/fs/cgroup will be owned by user
nobody:nogroup in this case. Independent of this specific problem this
check will also be misleading when the /sys/fs/cgroup exists and is in
fact writable by the init system but isn't actually a mountpoint.
Note from William. "grep -qs" doesn't need to redirect output to
/dev/null since it is completely silent.
This fixes #209.
sh/openrc-run.sh.in | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 95d0ecab..e3dff6ce 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -260,9 +260,12 @@ for _cmd; do
# 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
+ if grep -qs /sys/fs/cgroup /proc/1/mountinfo
+ then
+ if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
+ eerror "No permission to apply cgroup settings"
+ break
+ fi
fi
cgroup_add_service
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-12-01 21:48 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-12-01 21:48 UTC (permalink / raw
To: gentoo-commits
commit: cee3919908c2d715fd75a796873e3308209a4c2e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Dec 1 21:43:09 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Dec 1 21:43:09 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=cee39199
Clean up the calls to group_add_service
This function should only be called once and it does not take any
arguments.
X-Gentoo-Bug: 639166
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=639166
sh/openrc-run.sh.in | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 05cb972b..95d0ecab 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -264,8 +264,7 @@ for _cmd; do
eerror "No permission to apply cgroup settings"
break
fi
- cgroup_add_service /sys/fs/cgroup/openrc
- cgroup_add_service /sys/fs/cgroup/systemd/system
+ cgroup_add_service
fi
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] &&
cgroup_set_limits
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-10-26 18:58 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-10-26 18:58 UTC (permalink / raw
To: gentoo-commits
commit: 35b88fb42bb8e0a56cdc1947342f1b89c98658bc
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 26 02:19:15 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 26 02:19:15 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=35b88fb4
cgroups_cleanup: clean up shutdown signaling
- do not sleep for the full 90 seconds if processes are dead
- re-arrange the order of signals we attempt to send to the processes
sh/rc-cgroup.sh.in | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index d48957ac..5bc7db54 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -203,15 +203,21 @@ cgroup_cleanup()
{
cgroup_running || return 0
ebegin "starting cgroups cleanup"
- local pids
+ local pids loops=0
pids="$(cgroup_get_pids)"
if [ -n "${pids}" ]; then
- kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
kill -s CONT ${pids} 2> /dev/null
+ kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
yesno "${rc_send_sighup:-no}" &&
kill -s HUP ${pids} 2> /dev/null
- sleep "${rc_timeout_stopsec:-90}"
- yesno "${rc_send_sigkill:-yes}" &&
+ kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
+ while [ -n "$(cgroup_get_pids)" ] &&
+ [ "${loops}" -lt "${rc_timeout_stopsec:-90}" ]; do
+ loops=$((loops+1))
+ sleep 1
+ done
+ pids="$(cgroup_get_pids)"
+ [ -n "${pids}" ] && yesno "${rc_send_sigkill:-yes}" &&
kill -s KILL ${pids} 2> /dev/null
fi
cgroup2_remove
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-10-26 18:58 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-10-26 18:58 UTC (permalink / raw
To: gentoo-commits
commit: 6f3e2e2d7de61ab28cf03937ccf2e5f80b62190a
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Oct 26 02:20:15 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 26 02:20:15 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6f3e2e2d
supervise-daemon.sh: fix status function with no namespaces
sh/supervise-daemon.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index bccfd06a..d2cfe932 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -70,6 +70,8 @@ _check_supervised()
if [ "${n1}" = "${n2}" ]; then
return 1
fi
+ else
+ return 1
fi
fi
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-10-25 20:10 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-10-25 20:10 UTC (permalink / raw
To: gentoo-commits
commit: a428c325a902bba55a849a07a59c0c1567404db2
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Oct 25 20:07:19 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Oct 25 20:09:42 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a428c325
add "unsupervised" status and return code 64 to supervise-daemon status function
This is to be used if the service is being supervised and the
supervisor is somehow killed.
Currently, this is very linux specific, but I will expand to other
platforms, patches are welcome.
sh/supervise-daemon.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 1c1b840d..bccfd06a 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -56,7 +56,50 @@ supervise_stop()
eend $? "Failed to stop ${name:-$RC_SVCNAME}"
}
+_check_supervised()
+{
+ [ "$RC_UNAME" != Linux ] && return 0
+ local child_pid="$(service_get_value "child_pid")"
+ local pid="$(cat ${pidfile})"
+ if [ -n "${child_pid}" ]; then
+ if ! [ -e "/proc/${pid}" ] && [ -e "/proc/${child_pid}" ]; then
+ if [ -e "/proc/self/ns/pid" ] && [ -e "/proc/${child_pid}/ns/pid" ]; then
+ local n1 n2
+ n1=$(readlink "/proc/self/ns/pid")
+ n2=$(readlink "/proc/${child_pid}/ns/pid")
+ if [ "${n1}" = "${n2}" ]; then
+ return 1
+ fi
+ fi
+ fi
+ fi
+ return 0
+}
+
supervise_status()
{
- _status
+ if service_stopping; then
+ ewarn "status: stopping"
+ return 4
+ elif service_starting; then
+ ewarn "status: starting"
+ return 8
+ elif service_inactive; then
+ ewarn "status: inactive"
+ return 16
+ elif service_started; then
+ if service_crashed; then
+ if ! _check_supervised; then
+ eerror "status: unsupervised"
+ return 64
+ fi
+ eerror "status: crashed"
+ return 32
+ fi
+ einfo "status: started"
+ return 0
+ else
+ einfo "status: stopped"
+ return 3
+ fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-29 17:52 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-29 17:52 UTC (permalink / raw
To: gentoo-commits
commit: 7f3b41311119e3a96a15b0fb473b44f422e903e9
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 29 17:50:05 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 29 17:51:12 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7f3b4131
use printf consistently in cgroups handling
This makes the cgroups handling consistent between cgroups v1 and v2.
Also, it fixes #167.
sh/rc-cgroup.sh.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 9e93d841..d48957ac 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -165,7 +165,7 @@ cgroup2_remove()
[ ! -e "${rc_cgroup_path}"/cgroup.events ] &&
return 0
grep -qx "$$" "${rc_cgroup_path}/cgroup.procs" &&
- echo 0 > "${cgroup_path}/cgroup.procs"
+ printf "%d" 0 > "${cgroup_path}/cgroup.procs"
local key populated vvalue
while read -r key value; do
case "${key}" in
@@ -188,12 +188,12 @@ cgroup2_set_limits()
IFS="
"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
- echo 0 > "${rc_cgroup_path}/cgroup.procs"
+ printf "%d" 0 > "${rc_cgroup_path}/cgroup.procs"
echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do
[ -z "${key}" ] || [ -z "${value}" ] && continue
[ ! -e "${rc_cgroup_path}/${key}" ] && continue
veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}"
- echo "${value}" > "${rc_cgroup_path}/${key}"
+ printf "%s" "${value}" > "${rc_cgroup_path}/${key}"
done
IFS="$OIFS"
return 0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-22 22:25 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-22 22:25 UTC (permalink / raw
To: gentoo-commits
commit: 1ccba056584ee1a8e09fb1d5eebd988b47912c06
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 22 22:22:50 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 22 22:22:50 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1ccba056
sh/rc-functions.sh: add need_if_exists convenience function
sh/rc-functions.sh.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 7b771f82..d6336a18 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -119,6 +119,13 @@ get_bootparam_value()
echo $result
}
+need_if_exists()
+{
+ for x; do
+ rc-service --exists "${x}" && need "${x}"
+ done
+}
+
# Called from openrc-run.sh or gendepends.sh
_get_containers() {
local c
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-18 18:07 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
To: gentoo-commits
commit: cd5722aca50f0eaddde7ce04ee00da53c313ba7d
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Sep 16 21:46:42 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 21:49:22 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=cd5722ac
cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel
This is related to #164.
sh/rc-cgroup.sh.in | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 930eeefc..9e93d841 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -146,10 +146,12 @@ cgroup_set_limits()
cgroup2_find_path()
{
- case "${rc_cgroup_mode:-hybrid}" in
- hybrid) printf "/sys/fs/cgroup/unified" ;;
- unified) printf "/sys/fs/cgroup" ;;
+ if grep -qw cgroup2 /proc/filesystems; then
+ case "${rc_cgroup_mode:-hybrid}" in
+ hybrid) printf "/sys/fs/cgroup/unified" ;;
+ unified) printf "/sys/fs/cgroup" ;;
esac
+ fi
return 0
}
@@ -180,7 +182,7 @@ cgroup2_set_limits()
{
local cgroup_path
cgroup_path="$(cgroup2_find_path)"
- [ -z "${cgroup_path}" ] && return 0
+ [ -d "${cgroup_path}" ] || return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
local OIFS="$IFS"
IFS="
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-15 20:32 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-15 20:32 UTC (permalink / raw
To: gentoo-commits
commit: 25b45a5a239318fb57c405c3fe64e53b0738ad68
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 15 19:22:34 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 15 19:22:34 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=25b45a5a
cgroup_cleanup: try to remove the cgroup version 2 cgroup
If we were able to kill all the processes in the cgroup, it should be
removed.
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 2a54ee4a..930eeefc 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -212,6 +212,7 @@ cgroup_cleanup()
yesno "${rc_send_sigkill:-yes}" &&
kill -s KILL ${pids} 2> /dev/null
fi
+ cgroup2_remove
[ -z "$(cgroup_get_pids)" ]
eend $? "Unable to stop all processes"
return 0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-15 18:44 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-15 18:44 UTC (permalink / raw
To: gentoo-commits
commit: 4651b8c7e9e2ef9c1ea1fb8d174d1ca4693627af
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 15 18:42:50 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 15 18:42:50 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4651b8c7
rc-cgroup.sh: cgroup_cleanup fix error handling
cgroup_cleanup should warn if it is unable to clean up all processes in
the control group, but it will always return success.
sh/rc-cgroup.sh.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 3c7558cd..2a54ee4a 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -212,5 +212,7 @@ cgroup_cleanup()
yesno "${rc_send_sigkill:-yes}" &&
kill -s KILL ${pids} 2> /dev/null
fi
- eend 0
+ [ -z "$(cgroup_get_pids)" ]
+ eend $? "Unable to stop all processes"
+ return 0
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-15 18:31 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-15 18:31 UTC (permalink / raw
To: gentoo-commits
commit: 50608b54ed98acb54fec5fe3323909ea684d3af9
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 15 18:27:49 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 15 18:28:15 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=50608b54
rc-cgroup.sh: fix signal names
The "SIG" prefix on signal names passed to kill -s isn't portable.
sh/rc-cgroup.sh.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 4b713594..3c7558cd 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -204,13 +204,13 @@ cgroup_cleanup()
local pids
pids="$(cgroup_get_pids)"
if [ -n "${pids}" ]; then
- kill -s "${stopsig:-SIGTERM}" ${pids} 2> /dev/null
- kill -s SIGCONT ${pids} 2> /dev/null
+ kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
+ kill -s CONT ${pids} 2> /dev/null
yesno "${rc_send_sighup:-no}" &&
- kill -s SIGHUP ${pids} 2> /dev/null
+ kill -s HUP ${pids} 2> /dev/null
sleep "${rc_timeout_stopsec:-90}"
yesno "${rc_send_sigkill:-yes}" &&
- kill -s SIGKILL ${pids} 2> /dev/null
+ kill -s KILL ${pids} 2> /dev/null
fi
eend 0
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-14 15:57 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-14 15:57 UTC (permalink / raw
To: gentoo-commits
commit: 8885580986ab8adc951fe32b9323c8b16130fb4f
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 14 15:44:52 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 15:44:52 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=88855809
rc-cgroup.sh: move cgroup_cleanup to the end of the file
sh/rc-cgroup.sh.in | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 40501f22..1bf819e7 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -134,25 +134,6 @@ cgroup_set_limits()
return 0
}
-cgroup_cleanup()
-{
- cgroup_running || return 0
- ebegin "starting cgroups cleanup"
- for sig in TERM QUIT INT; do
- cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
- for i in 0 1; do
- kill -s $sig $pids
- for j in 0 1 2; do
- cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
- sleep 1
- done
- done 2>/dev/null
- done
- cgroup_get_pids || { eend 0 "finished" ; return 0; }
- kill -9 $pids
- eend $(cgroup_running && echo 1 || echo 0) "fail to stop all processes"
-}
-
cgroup2_find_path()
{
case "${rc_cgroup_mode:-hybrid}" in
@@ -203,3 +184,22 @@ cgroup2_set_limits()
IFS="$OIFS"
return 0
}
+
+cgroup_cleanup()
+{
+ cgroup_running || return 0
+ ebegin "starting cgroups cleanup"
+ for sig in TERM QUIT INT; do
+ cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
+ for i in 0 1; do
+ kill -s $sig $pids
+ for j in 0 1 2; do
+ cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
+ sleep 1
+ done
+ done 2>/dev/null
+ done
+ cgroup_get_pids || { eend 0 "finished" ; return 0; }
+ kill -9 $pids
+ eend $(cgroup_running && echo 1 || echo 0) "fail to stop all processes"
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-09-14 15:57 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-09-14 15:57 UTC (permalink / raw
To: gentoo-commits
commit: 2b0345165e5af57ca61a4000c3671bbe6d677cf9
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 14 15:55:06 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 15:55:06 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=2b034516
Make cgroup_cleanup send only one sigterm and sigkill
Instead of looping and sending multiple signals to child processes in
cgroup_cleanup, we send sigterm followed by sleeping one second then
sigkill.
This brings us more in line with systemd's "control group" killmode
setting.
Also, this commit includes several shellcheck cleanups.
sh/openrc-run.sh.in | 6 ++---
sh/rc-cgroup.sh.in | 72 +++++++++++++++++++++++++++++------------------------
2 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index e778bd09..05cb972b 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -365,9 +365,9 @@ while [ -n "$1" ]; do
then
"$1"_post || exit $?
fi
- [ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
- "$1" = "stop" ] && \
- yesno "${rc_cgroup_cleanup}" && \
+ [ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" ] &&
+ [ "$1" = "stop" ] &&
+ yesno "${rc_cgroup_cleanup}" && \
cgroup_cleanup
if [ "$(command -v cgroup2_remove)" = "cgroup2_remove" ]; then
[ "$1" = stop ] || [ -z "${command}" ] &&
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 1bf819e7..47a007b6 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -14,46 +14,56 @@ description_cgroup_cleanup="Kill all processes in the cgroup"
cgroup_find_path()
{
- local OIFS n name dir result
+ local OIFS name dir result
[ -n "$1" ] || return 0
OIFS="$IFS"
IFS=":"
- while read n name dir; do
+ while read -r _ name dir; do
[ "$name" = "$1" ] && result="$dir"
done < /proc/1/cgroup
IFS="$OIFS"
- echo $result
+ printf "%s" "${result}"
}
cgroup_get_pids()
{
- local p
- pids=
- while read p; do
- [ $p -eq $$ ] || pids="${pids} ${p}"
- done < /sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks
- [ -n "$pids" ]
+ local cgroup_procs p pids
+ cgroup_procs="$(cgroup2_find_path)"
+ [ -n "${cgroup_procs}" ] &&
+ cgroup_procs="${cgroup_procs}/${RC_SVCNAME}/cgroup.procs" ||
+ cgroup_procs="/sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks"
+ [ -f "${cgroup_procs}" ] || return 0
+ while read -r p; do
+ [ "$p" -eq $$ ] || pids="${pids} ${p}"
+ done < "${cgroup_procs}"
+ printf "%s" "${pids}"
+ return 0
}
cgroup_running()
{
- [ -d "/sys/fs/cgroup/openrc/${RC_SVCNAME}" ]
+ [ -d "/sys/fs/cgroup/unified/${RC_SVCNAME}" ] ||
+ [ -d "/sys/fs/cgroup/${RC_SVCNAME}" ] ||
+ [ -d "/sys/fs/cgroup/openrc/${RC_SVCNAME}" ]
}
cgroup_set_values()
{
- [ -n "$1" -a -n "$2" -a -d "/sys/fs/cgroup/$1" ] || return 0
+ [ -n "$1" ] && [ -n "$2" ] && [ -d "/sys/fs/cgroup/$1" ] || return 0
- local controller="$1" h=$(cgroup_find_path "$1")
+ local controller h
+ controller="$1"
+ h=$(cgroup_find_path "$1")
cgroup="/sys/fs/cgroup/${1}${h}openrc_${RC_SVCNAME}"
[ -d "$cgroup" ] || mkdir -p "$cgroup"
set -- $2
local name val
- while [ -n "$1" -a "$controller" != "cpuacct" ]; do
+ while [ -n "$1" ] && [ "$controller" != "cpuacct" ]; do
case "$1" in
$controller.*)
- if [ -n "$name" -a -w "$cgroup/$name" -a -n "$val" ]; then
+ if [ -n "${name}" ] && [ -w "${cgroup}/${name}" ] &&
+ [ -n "${val}" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
printf "%s" "$val" > "$cgroup/$name"
fi
@@ -68,7 +78,7 @@ cgroup_set_values()
esac
shift
done
- if [ -n "$name" -a -w "$cgroup/$name" -a -n "$val" ]; then
+ if [ -n "${name}" ] && [ -w "${cgroup}/${name}" ] && [ -n "${val}" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
printf "%s" "$val" > "$cgroup/$name"
fi
@@ -145,7 +155,8 @@ cgroup2_find_path()
cgroup2_remove()
{
- local cgroup_path="$(cgroup2_find_path)" rc_cgroup_path
+ local cgroup_path rc_cgroup_path
+ cgroup_path="$(cgroup2_find_path)"
[ -z "${cgroup_path}" ] && return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
[ ! -d "${rc_cgroup_path}" ] ||
@@ -154,7 +165,7 @@ cgroup2_remove()
grep -qx "$$" "${rc_cgroup_path}/cgroup.procs" &&
echo 0 > "${cgroup_path}/cgroup.procs"
local key populated vvalue
- while read key value; do
+ while read -r key value; do
case "${key}" in
populated) populated=${value} ;;
*) ;;
@@ -167,7 +178,8 @@ cgroup2_remove()
cgroup2_set_limits()
{
- local cgroup_path="$(cgroup2_find_path)"
+ local cgroup_path
+ cgroup_path="$(cgroup2_find_path)"
[ -z "${cgroup_path}" ] && return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
local OIFS="$IFS"
@@ -175,7 +187,7 @@ cgroup2_set_limits()
"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
echo 0 > "${rc_cgroup_path}/cgroup.procs"
- echo "${rc_cgroup_settings}" | while IFS="$OIFS" read key value; do
+ echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do
[ -z "${key}" ] || [ -z "${value}" ] && continue
[ ! -e "${rc_cgroup_path}/${key}" ] && continue
veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}"
@@ -189,17 +201,13 @@ cgroup_cleanup()
{
cgroup_running || return 0
ebegin "starting cgroups cleanup"
- for sig in TERM QUIT INT; do
- cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
- for i in 0 1; do
- kill -s $sig $pids
- for j in 0 1 2; do
- cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
- sleep 1
- done
- done 2>/dev/null
- done
- cgroup_get_pids || { eend 0 "finished" ; return 0; }
- kill -9 $pids
- eend $(cgroup_running && echo 1 || echo 0) "fail to stop all processes"
+ local pids
+ pids="$(cgroup_get_pids)"
+ if [ -n "${pids}" ]; then
+ kill -s TERM "${pids}"
+ sleep 1
+ pids="$(cgroup_get_pids)"
+ [ -n "${pids}" ] &&
+ kill -s KILL "${pids}"
+ fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-08-15 22:19 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-08-15 22:19 UTC (permalink / raw
To: gentoo-commits
commit: 66ed8082d0c865a0b4f4cc436cf9e13351e3d6fe
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Aug 15 22:15:14 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Aug 15 22:15:14 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=66ed8082
sh/openrc-run: source service script before ulimit is processed
This is needed to allow the service script author to set a default for
rc_ulimit inside the service script.
sh/openrc-run.sh.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index f5ffe17e..a38d46d6 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -243,6 +243,9 @@ sourcex "@LIBEXECDIR@/sh/s6.sh"
sourcex "@LIBEXECDIR@/sh/start-stop-daemon.sh"
sourcex "@LIBEXECDIR@/sh/supervise-daemon.sh"
+# Load our script
+sourcex "$RC_SERVICE"
+
# Set verbose mode
if yesno "${rc_verbose:-$RC_VERBOSE}"; then
EINFO_VERBOSE=yes
@@ -272,9 +275,6 @@ for _cmd; do
fi
done
-# Load our script
-sourcex "$RC_SERVICE"
-
eval "printf '%s\n' $required_dirs" | while read _d; do
if [ -n "$_d" ] && [ ! -d "$_d" ]; then
eerror "$RC_SVCNAME: \`$_d' is not a directory"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-03-23 18:27 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-03-23 18:27 UTC (permalink / raw
To: gentoo-commits
commit: 50fccf47d4bd2ed6e7ea6ff7f72577c8e7b95d0d
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Mar 23 18:17:11 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Mar 23 18:17:11 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=50fccf47
sh/gendepends.sh.in: fix detection of service scripts
We do not need to care about the path on the shebang line of a service
script as long as the shebang line ends with "openrc-run".
This fixes #119 and #120.
sh/gendepends.sh.in | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in
index 82088c51..45147e6a 100644
--- a/sh/gendepends.sh.in
+++ b/sh/gendepends.sh.in
@@ -74,11 +74,22 @@ do
# Only generate dependencies for OpenRC scripts
read one two three <"$RC_SERVICE"
- [ "$one" = "#!@SBINDIR@/runscript" ] || \
- [ "$one" = "#!@SBINDIR@/openrc-run" ] || \
- [ "$one" = "#!" -a "$two" = "@SBINDIR@/runscript" ] || \
- [ "$one" = "#!" -a "$two" = "@SBINDIR@/openrc-run" ] || \
- continue
+ case "$one" in
+ \#*/openrc-run) ;;
+ \#*/runscript) ;;
+ \#!)
+ case "$two" in
+ */openrc-run) ;;
+ */runscript) ;;
+ *)
+ continue
+ ;;
+ esac
+ ;;
+ *)
+ continue
+ ;;
+ esac
unset one two three
RC_SVCNAME=${RC_SERVICE##*/} ; export RC_SVCNAME
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2017-02-24 0:19 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2017-02-24 0:19 UTC (permalink / raw
To: gentoo-commits
commit: 1cb44092fce298004ab4c4547c6fbcac29c5997f
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Feb 23 18:50:33 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 24 00:16:15 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1cb44092
sh/rc-functions.sh.in: add get_bootparam_value function
sh/rc-functions.sh.in | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 12eb4e2a..7b771f82 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -85,6 +85,40 @@ get_bootparam()
return 1
}
+get_bootparam_value()
+{
+ local match="$1" which_value="$2" sep="$3" result value
+ if [ -n "$match" -a -r /proc/cmdline ]; then
+ set -- $(cat /proc/cmdline)
+ while [ -n "$1" ]; do
+ case "$1" in
+ $match=*)
+ value="${1##*=}"
+ case "$which_value" in
+ all)
+ [ -z "$sep" ] && sep=' '
+ if [ -z "$result" ]; then
+ result="$value"
+ else
+ result="${result}${sep}${value}"
+ fi
+ ;;
+ last)
+ result="$value"
+ ;;
+ *)
+ result="$value"
+ break
+ ;;
+ esac
+ ;;
+ esac
+ shift
+ done
+ fi
+ echo $result
+}
+
# Called from openrc-run.sh or gendepends.sh
_get_containers() {
local c
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-12-18 17:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-12-18 17:54 UTC (permalink / raw
To: gentoo-commits
commit: d3f833179b39368442221c448f90b87f76d28ee8
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Dec 18 17:52:54 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Dec 18 17:53:12 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=d3f83317
sh/init.sh.Linux.in: remove unused check for Gnu/KFreeBSD
This script only runs on Linux, so the check will always be false.
sh/init.sh.Linux.in | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 96555d2..b07463b 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -44,11 +44,9 @@ fi
unset f
if $mountproc; then
- procfs="proc"
- [ "$RC_UNAME" = "GNU/kFreeBSD" ] && procfs="linprocfs"
ebegin "Mounting /proc"
if ! fstabinfo --mount /proc; then
- mount -n -t "$procfs" -o noexec,nosuid,nodev proc /proc
+ mount -n -t proc -o noexec,nosuid,nodev proc /proc
fi
eend $?
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-12-18 17:22 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-12-18 17:22 UTC (permalink / raw
To: gentoo-commits
commit: 856eafb006655b7dda630a94cbd16f5db9f781be
Author: Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Sat Dec 17 19:59:45 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 23:27:37 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=856eafb0
sh/init.sh.Linux.in: skip /proc test if no md5sum
This will also warn users if md5sum is missing, which serves as a pretty
good indicator that /usr is not mounted.
sh/init.sh.Linux.in | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index fcae0d2..96555d2 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -11,6 +11,16 @@ if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
done
fi
+# check for md5sum, and probably /usr too
+if command -v md5sum >/dev/null; then
+ got_md5sum=true
+else
+ eerror "md5sum is missing, which suggests /usr is not mounted"
+ eerror "If you have separate /usr, it must be mounted by initramfs"
+ eerror "If not, you should check coreutils is installed correctly"
+ got_md5sum=false
+fi
+
# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
# NFC how they managed that, but the end result means we have to test if
@@ -21,9 +31,12 @@ fi
mountproc=true
f=/proc/self/environ
if [ -e $f ]; then
- if [ "$(VAR=a md5sum $f)" = "$(VAR=b md5sum $f)" ]; then
+ if $got_md5sum && [ "$(VAR=a md5sum $f)" = "$(VAR=b md5sum $f)" ]; then
eerror "You have cruft in /proc that should be deleted"
else
+ # If they don't have md5sum, this will fail in pretty ways if
+ # /proc isn't really mounted. Oh well, their system is busted
+ # anyway, and they get to keep the pieces.
einfo "/proc is already mounted"
mountproc=false
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-12-17 22:57 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-12-17 22:57 UTC (permalink / raw
To: gentoo-commits
commit: f27d60add9ee1ef8a90ea0034edf6f4e4e6d0ed8
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 15 22:43:34 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 22:50:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=f27d60ad
sh/openrc-run.sh: expose default start/stop/status
Supervisor setups break easily when start/stop/status functions are not
default.
Applications that write multiple PIDs to a pidfile (eg HAProxy as
described in bug 601540), can also benefit from being able to call the
default start/stop/status with modified environment variables.
Expose the default start/stop/status functions as
default_start/stop/status, and use them for the defaults
start/stop/status.
Trivial usage example:
```
stop()
{
t=$(mktemp)
for pid in $(cat $pidfile) ; do
echo $pid >$t
pidfile=$t default_stop
done
rm -f $t
}
```
X-Gentoo-Bug: 601540
X-Gentoo-Bug-URL: https://bugs.gentoo.org/601540
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
sh/openrc-run.sh.in | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 4cbfb16..f5ffe17 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -146,10 +146,9 @@ _status()
fi
}
-# Template start / stop / status functions
# These functions select the appropriate function to call from the
# supervisor modules
-start()
+default_start()
{
local func=ssd_start
case "$supervisor" in
@@ -163,7 +162,7 @@ start()
$func
}
-stop()
+default_stop()
{
local func=ssd_stop
case "$supervisor" in
@@ -177,7 +176,7 @@ stop()
$func
}
-status()
+default_status()
{
local func=ssd_status
case "$supervisor" in
@@ -191,6 +190,26 @@ status()
$func
}
+# Template start / stop / status functions
+# package init scripts may override these, but the bodies are as minimal as
+# possible, so that the init scripts can creatively wrap default_*
+# functions.
+start()
+{
+ default_start
+}
+
+stop()
+{
+ default_stop
+}
+
+status()
+{
+ default_status
+}
+
+# Start debug output
yesno $RC_DEBUG && set -x
# Load configuration settings. First the global ones, then any
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-22 23:21 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-22 23:21 UTC (permalink / raw
To: gentoo-commits
commit: bbf98befb86337a36ef5af7f273e503a6de4b9bd
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 22 22:22:03 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 22:37:09 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bbf98bef
sh/init.sh.Linux.in: update test for live /proc to use md5sum
This allows us to avoid the warnings from bash-4.4 about null bytes in
command substitutions.
If you have separate /usr, are not using an initramfs, and have a file
called /proc/self/environ on your root file system, this will break.
X-Gentoo-Bug: 594534
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594534
sh/init.sh.Linux.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 344f627..7645775 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -21,7 +21,7 @@ fi
mountproc=true
f=/proc/self/environ
if [ -e $f ]; then
- if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
+ if [ "$(VAR=a md5sum $f)" = "$(VAR=b md5sum $f)" ]; then
eerror "You have cruft in /proc that should be deleted"
else
einfo "/proc is already mounted"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-20 16:36 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-20 16:36 UTC (permalink / raw
To: gentoo-commits
commit: d6c30ab12a3b335ac57cd1f0ac00231bb34fc0c4
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Sep 20 16:23:46 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 16:33:56 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=d6c30ab1
Revert "Remove eval calls from supervisor start functions"
This reverts commit 0d1f1010c299a95332f224c3be9e8dfdd85eec54.
We need the eval in case someone uses something like:
command_args="this \"is a\" test"
This is related to #77.
sh/start-stop-daemon.sh | 5 ++++-
sh/supervise-daemon.sh | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 0449e5b..0793b19 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -38,7 +38,10 @@ ssd_start()
service_inactive && _inactive=true
mark_service_inactive
fi
- start-stop-daemon --start \
+ #the eval call is necessary for cases like:
+ # command_args="this \"is a\" test"
+ # to work properly.
+ eval start-stop-daemon --start \
--exec $command \
${chroot:+--chroot} $chroot \
${procname:+--name} $procname \
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 389635f..bff68a4 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -19,7 +19,10 @@ supervise_start()
fi
ebegin "Starting ${name:-$RC_SVCNAME}"
- supervise-daemon --start \
+ # The eval call is necessary for cases like:
+ # command_args="this \"is a\" test"
+ # to work properly.
+ eval supervise-daemon --start \
${chroot:+--chroot} $chroot \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-19 23:05 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-19 23:05 UTC (permalink / raw
To: gentoo-commits
commit: 0d1f1010c299a95332f224c3be9e8dfdd85eec54
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 19 23:03:57 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 19 23:03:57 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0d1f1010
Remove eval calls from supervisor start functions
This fixes #77.
sh/start-stop-daemon.sh | 2 +-
sh/supervise-daemon.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 6f396b3..0449e5b 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -38,7 +38,7 @@ ssd_start()
service_inactive && _inactive=true
mark_service_inactive
fi
- eval start-stop-daemon --start \
+ start-stop-daemon --start \
--exec $command \
${chroot:+--chroot} $chroot \
${procname:+--name} $procname \
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index e6ac117..389635f 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -19,7 +19,7 @@ supervise_start()
fi
ebegin "Starting ${name:-$RC_SVCNAME}"
- eval supervise-daemon --start \
+ supervise-daemon --start \
${chroot:+--chroot} $chroot \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-14 19:00 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-14 19:00 UTC (permalink / raw
To: gentoo-commits
commit: c4d7e02abd7008b8e8ad16f62c2abbb60fab252b
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Sep 14 16:08:48 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 17:34:42 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c4d7e02a
Fix permission checks for cgroups
This is needed because containers may give read access to cgroups but
not allow the settings to be changed.
sh/rc-cgroup.sh.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 20b2c6e..5987f96 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -53,7 +53,7 @@ cgroup_set_values()
while [ -n "$1" -a "$controller" != "cpuacct" ]; do
case "$1" in
$controller.*)
- if [ -n "$name" -a -f "$cgroup/$name" -a -n "$val" ]; then
+ if [ -n "$name" -a -w "$cgroup/$name" -a -n "$val" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
printf "%s" "$val" > "$cgroup/$name"
fi
@@ -68,12 +68,12 @@ cgroup_set_values()
esac
shift
done
- if [ -n "$name" -a -f "$cgroup/$name" -a -n "$val" ]; then
+ if [ -n "$name" -a -w "$cgroup/$name" -a -n "$val" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
printf "%s" "$val" > "$cgroup/$name"
fi
- if [ -f "$cgroup/tasks" ]; then
+ if [ -w "$cgroup/tasks" ]; then
veinfo "$RC_SVCNAME: adding to $cgroup/tasks"
printf "%d" 0 > "$cgroup/tasks"
fi
@@ -88,14 +88,14 @@ cgroup_add_service()
# cgroups. But may lead to a problems where that inheriting
# is needed.
for d in /sys/fs/cgroup/* ; do
- [ -f "${d}"/tasks ] && printf "%d" 0 > "${d}"/tasks
+ [ -w "${d}"/tasks ] && printf "%d" 0 > "${d}"/tasks
done
openrc_cgroup=/sys/fs/cgroup/openrc
if [ -d "$openrc_cgroup" ]; then
cgroup="$openrc_cgroup/$RC_SVCNAME"
mkdir -p "$cgroup"
- [ -f "$cgroup/tasks" ] && printf "%d" 0 > "$cgroup/tasks"
+ [ -w "$cgroup/tasks" ] && printf "%d" 0 > "$cgroup/tasks"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-13 17:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-13 17:54 UTC (permalink / raw
To: gentoo-commits
commit: 8a8032478a755f6e2ceaebc5425e61c6817df936
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Sep 13 17:27:08 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Sep 13 17:52:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=8a803247
Make use of name vs RC_SVCNAME consistent in supervisor scripts
This fixes #79.
sh/runit.sh | 4 ++--
sh/s6.sh | 4 ++--
sh/start-stop-daemon.sh | 4 ++--
sh/supervise-daemon.sh | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sh/runit.sh b/sh/runit.sh
index e9c1d22..3cef0f3 100644
--- a/sh/runit.sh
+++ b/sh/runit.sh
@@ -21,7 +21,7 @@ runit_start()
ebegin "Starting ${name:-$RC_SVCNAME}"
ln -snf "${service_path}" "${service_link}"
sv start "${service_link}" > /dev/null 2>&1
- eend $? "Failed to start $RC_SVCNAME"
+ eend $? "Failed to start ${name:-$RC_SVCNAME}"
}
runit_stop()
@@ -36,7 +36,7 @@ runit_stop()
ebegin "Stopping ${name:-$RC_SVCNAME}"
sv stop "${service_link}" > /dev/null 2>&1 &&
rm "${service_link}"
- eend $? "Failed to stop $RC_SVCNAME"
+ eend $? "Failed to stop ${name:-$RC_SVCNAME}"
}
runit_status()
diff --git a/sh/s6.sh b/sh/s6.sh
index 447419c..d1b9c10 100644
--- a/sh/s6.sh
+++ b/sh/s6.sh
@@ -30,7 +30,7 @@ s6_start()
sleep 1.5
set -- $(s6-svstat "${s6_service_link}")
[ "$1" = "up" ]
- eend $? "Failed to start $RC_SVCNAME"
+ eend $? "Failed to start ${name:-$RC_SVCNAME}"
}
s6_stop()
@@ -44,7 +44,7 @@ s6_stop()
s6-svc -wD -d -T ${s6_service_timeout_stop:-10000} "${s6_service_link}"
set -- $(s6-svstat "${s6_service_link}")
[ "$1" = "down" ]
- eend $? "Failed to stop $RC_SVCNAME"
+ eend $? "Failed to stop ${name:-$RC_SVCNAME}"
}
s6_status()
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 65ee660..6b679ac 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -46,7 +46,7 @@ ssd_start()
${command_user+--user} $command_user \
$_background $start_stop_daemon_args \
-- $command_args $command_args_background
- if eend $? "Failed to start $RC_SVCNAME"; then
+ if eend $? "Failed to start ${name:-$RC_SVCNAME}"; then
service_set_value "command" "${command}"
[ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
@@ -80,7 +80,7 @@ ssd_stop()
${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
- eend $? "Failed to stop $RC_SVCNAME"
+ eend $? "Failed to stop ${name:-$RC_SVCNAME}"
}
ssd_status()
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 2d889a6..e6ac117 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -31,7 +31,7 @@ supervise_start()
[ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
fi
- eend $rc "failed to start $RC_SVCNAME"
+ eend $rc "failed to start ${name:-$RC_SVCNAME}"
}
supervise_stop()
@@ -46,7 +46,7 @@ supervise_stop()
${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
- eend $? "Failed to stop $RC_SVCNAME"
+ eend $? "Failed to stop ${name:-$RC_SVCNAME}"
}
supervise_status()
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-09-12 17:59 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-09-12 17:59 UTC (permalink / raw
To: gentoo-commits
commit: ac53c9a658589456c678b6bfe674a66a3845e564
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 12 16:20:26 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 17:58:31 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ac53c9a6
sh/init.sh: fix the test for cache restoration
This fixes the test for cache restoration since we are no longer caching
the dependency tree.
sh/init.sh.BSD.in | 2 +-
sh/init.sh.GNU-kFreeBSD.in | 2 +-
sh/init.sh.GNU.in | 2 +-
sh/init.sh.Linux.in | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh/init.sh.BSD.in b/sh/init.sh.BSD.in
index 6fe0bde..64282e9 100644
--- a/sh/init.sh.BSD.in
+++ b/sh/init.sh.BSD.in
@@ -57,7 +57,7 @@ case "$(openrc --sys)" in
esac
retval=$?
-if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
+if [ -e "$RC_LIBEXECDIR"/cache/softlevel ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
diff --git a/sh/init.sh.GNU-kFreeBSD.in b/sh/init.sh.GNU-kFreeBSD.in
index db3eec3..5eb8064 100644
--- a/sh/init.sh.GNU-kFreeBSD.in
+++ b/sh/init.sh.GNU-kFreeBSD.in
@@ -34,7 +34,7 @@ ebegin "Creating $RC_SVCDIR"
mkdir -p $RC_SVCDIR
eend $?
-if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
+if [ -e "$RC_LIBEXECDIR"/cache/softlevel ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
diff --git a/sh/init.sh.GNU.in b/sh/init.sh.GNU.in
index f08bac7..08a492a 100644
--- a/sh/init.sh.GNU.in
+++ b/sh/init.sh.GNU.in
@@ -36,7 +36,7 @@ ebegin "Creating $RC_SVCDIR"
mkdir -p $RC_SVCDIR
eend $?
-if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
+if [ -e "$RC_LIBEXECDIR"/cache/softlevel ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 7d36e7a..344f627 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -85,7 +85,7 @@ if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
eend $?
fi
-if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
+if [ -e "$RC_LIBEXECDIR"/cache/softlevel ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-07-26 15:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-07-26 15:54 UTC (permalink / raw
To: gentoo-commits
commit: 0c229faf7e6a57bcff70f2143b83cb69a34c89f4
Author: Martin Väth <martin <AT> mvath <DOT> de>
AuthorDate: Wed May 25 09:03:12 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 15:53:54 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0c229faf
tmpfiles.sh: Support lines with q Q h H
btrfs support is not implemented yet (for q Q v), but at least tmpfiles.sh
no longer chokes about tmpfiles.d lines of recent systemd versions
This fixes #87.
sh/tmpfiles.sh.in | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f7ee11b..87545ed 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -10,8 +10,10 @@
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
#
# See the tmpfiles.d manpage as well:
+# https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
+# This script should match the old manpage
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
-# This script should match the manpage as of 2012/03/12
+# as of 2012/03/12 and also implements some more recent features
#
DRYRUN=0
@@ -44,6 +46,17 @@ dryrun_or_real() {
$dryrun "$@"
}
+_chattr() {
+ local attr="$2"
+ case $attr in
+ [+-=]*) : ;;
+ '') return ;;
+ *) attr="+$attr" ;;
+ esac
+ local IFS=
+ dryrun_or_real chattr $1 "$attr" -- $3
+}
+
relabel() {
local path
local paths=$1 mode=$2 uid=$3 gid=$4
@@ -163,6 +176,37 @@ _v() {
_d "$@"
}
+_q() {
+ # Similar to _v. However, make sure that the subvolume will be assigned
+ # to the same higher-level quota groups as the subvolume it has
+ # been created in.
+ # TODO: Implement btrfs subvol creation.
+ _d "$@"
+}
+
+_Q() {
+ # Similar to q. However, instead of copying the higher-level quota
+ # group assignments from the parent as-is, the lowest quota group
+ # of the parent subvolume is determined that is not the
+ # leaf quota group.
+ # TODO: Implement btrfs subvol creation.
+ _d "$@"
+}
+
+_h() {
+ # Set file/directory attributes. Lines of this type accept
+ # shell-style globs in place of normal path names.
+ # The format of the argument field matches chattr
+ _chattr '' "$6" "$1"
+}
+
+_H() {
+ # Recursively set file/directory attributes. Lines of this type accept
+ # shell-syle globs in place of normal path names.
+ # Does not follow symlinks
+ _chattr -R "$6" "$1"
+}
+
_L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
@@ -371,7 +415,7 @@ for FILE in $tmpfiles_d ; do
# whine about invalid entries
case $cmd in
- f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z) ;;
+ f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z|q|Q|h|H) ;;
*) warninvalid ; continue ;;
esac
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-07-25 20:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-07-25 20:54 UTC (permalink / raw
To: gentoo-commits
commit: 3092e310acd376fc626cc051549e02bcd7697aed
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 19:10:42 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 20:37:18 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3092e310
tmpfiles: Accept filenames as command line arguments
This brings us closer to being able to use tmpfiles.sh as a full
replacement for systemd-tmpfiles.
This closes #83.
sh/tmpfiles.sh.in | 61 ++++++++++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 95b8b93..f7ee11b 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -264,6 +264,7 @@ _Z() {
BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
EXCLUDE=
PREFIX=
+FILES=
while [ $# -gt 0 ]; do
case $1 in
@@ -276,6 +277,7 @@ while [ $# -gt 0 ]; do
--exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
--prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
-*) invalid_option "$1" ;;
+ *) FILES="${FILES} $1"
esac
shift
done
@@ -290,40 +292,49 @@ if [ "$CREATE$REMOVE" = '00' ]; then
exit 1
fi
-FILE=
-fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
-tmpfiles_dirs='/usr/lib/tmpfiles.d/ /run/tmpfiles.d/ /etc/tmpfiles.d/'
+tmpfiles_dirs='/usr/lib/tmpfiles.d /run/tmpfiles.d /etc/tmpfiles.d'
tmpfiles_basenames=''
+
+if [ -z "${FILES}" ]; then
+ # Build a list of sorted unique basenames
+ # directories declared later in the tmpfiles_d array will override earlier
+ # directories, on a per file basename basis.
+ # `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
+ # `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
+ for d in ${tmpfiles_dirs} ; do
+ [ -d $d ] && for f in ${d}/*.conf ; do
+ case "${f##*/}" in
+ systemd.conf|systemd-*.conf) continue;;
+ esac
+ [ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
+ done # for f in ${d}
+ done # for d in ${tmpfiles_dirs}
+ FILES="$(printf "${tmpfiles_basenames}\n" | sort -u )"
+fi
+
tmpfiles_d=''
-# Build a list of sorted unique basenames
-# directories declared later in the tmpfiles_d array will override earlier
-# directories, on a per file basename basis.
-# `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
-# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
-for d in ${tmpfiles_dirs} ; do
- [ -d $d ] && for f in ${d}/*.conf ; do
- case "${f##*/}" in
- systemd.conf|systemd-*.conf) continue;;
- esac
- [ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
- done # for f in ${d}
-done # for d in ${tmpfiles_dirs}
-tmpfiles_basenames="$(printf "${tmpfiles_basenames}\n" | sort -u )"
-
-for b in $tmpfiles_basenames ; do
- real_f=''
- for d in $tmpfiles_dirs ; do
- f=${d}/${b}
- [ -f "${f}" ] && real_f=$f
- done
- [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
+
+for b in ${FILES} ; do
+ if [ "${b##*/}" != "${b}" ]; then
+ # The user specified a path on the command line
+ # Just pass it through unaltered
+ tmpfiles_d="${tmpfiles_d} ${b}"
+ else
+ real_f=''
+ for d in $tmpfiles_dirs ; do
+ f=${d}/${b}
+ [ -f "${f}" ] && real_f=$f
+ done
+ [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
+ fi
done
error=0
# loop through the gathered fragments, sorted globally by filename.
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
+FILE=
for FILE in $tmpfiles_d ; do
LINENUM=0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-07-25 20:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-07-25 20:54 UTC (permalink / raw
To: gentoo-commits
commit: 671911762d1bcd90c10d8ac0eb30fe10be4a65f6
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 18:13:56 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 20:37:02 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=67191176
tmpfiles: Process command line before gathering config files
This is part of #83.
sh/tmpfiles.sh.in | 51 ++++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f711b1d..95b8b93 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -264,6 +264,32 @@ _Z() {
BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
EXCLUDE=
PREFIX=
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --boot) BOOT=1 ;;
+ --create) CREATE=1 ;;
+ --remove) REMOVE=1 ;;
+ --clean) CLEAN=1 ;; # TODO: Not implemented
+ --verbose) VERBOSE=1 ;;
+ --dryrun|--dry-run) DRYRUN=1 ;;
+ --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
+ --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
+ -*) invalid_option "$1" ;;
+ esac
+ shift
+done
+
+if [ $(( CLEAN )) -eq 1 ] ; then
+ printf '%s clean mode is not implemented\n' "${0##*/}"
+ exit 1
+fi
+
+if [ "$CREATE$REMOVE" = '00' ]; then
+ printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
+ exit 1
+fi
+
FILE=
fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
@@ -294,31 +320,6 @@ for b in $tmpfiles_basenames ; do
[ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
done
-while [ $# -gt 0 ]; do
- case $1 in
- --boot) BOOT=1 ;;
- --create) CREATE=1 ;;
- --remove) REMOVE=1 ;;
- --clean) CLEAN=1 ;; # TODO: Not implemented
- --verbose) VERBOSE=1 ;;
- --dryrun|--dry-run) DRYRUN=1 ;;
- --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
- --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
- -*) invalid_option "$1" ;;
- esac
- shift
-done
-
-if [ $(( CLEAN )) -eq 1 ] ; then
- printf '%s clean mode is not implemented\n' "${0##*/}"
- exit 1
-fi
-
-if [ "$CREATE$REMOVE" = '00' ]; then
- printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
- exit 1
-fi
-
error=0
# loop through the gathered fragments, sorted globally by filename.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-07-25 20:54 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-07-25 20:54 UTC (permalink / raw
To: gentoo-commits
commit: 7d68839e9ea89b0a92aef69a9b4fd298554bb9b1
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 18:01:51 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 20:36:44 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7d68839e
tmpfiles: Make unrecognized options fatal
This is part of #83.
sh/tmpfiles.sh.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 43442d7..f711b1d 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -33,6 +33,11 @@ warninvalid() {
error=$(( error+1 ))
} >&2
+invalid_option() {
+ printf "tmpfiles: invalid option '%s'\n" "$1" >&2
+ exit 1
+}
+
dryrun_or_real() {
local dryrun=
[ $DRYRUN -eq 1 ] && dryrun=echo
@@ -299,6 +304,7 @@ while [ $# -gt 0 ]; do
--dryrun|--dry-run) DRYRUN=1 ;;
--exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
--prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
+ -*) invalid_option "$1" ;;
esac
shift
done
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-05-24 16:43 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-05-24 16:43 UTC (permalink / raw
To: gentoo-commits
commit: a8214af2fe3aa91930e3270af99cf1d9b7ef5b0a
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 19 22:58:14 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 19 22:58:14 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a8214af2
start-stop-daemon.sh: fix regression in chroot support
The support for the chroot variable was broken in 0.16, this fixes that
breakage.
sh/start-stop-daemon.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 3e42137..65ee660 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -40,6 +40,7 @@ ssd_start()
fi
eval start-stop-daemon --start \
--exec $command \
+ ${chroot:+--chroot} $chroot \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
@@ -47,6 +48,7 @@ ssd_start()
-- $command_args $command_args_background
if eend $? "Failed to start $RC_SVCNAME"; then
service_set_value "command" "${command}"
+ [ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
[ -n "${procname}" ] && service_set_value "procname" "${procname}"
return 0
@@ -62,9 +64,11 @@ ssd_start()
ssd_stop()
{
local startcommand="$(service_get_value "command")"
+ local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
local startprocname="$(service_get_value "procname")"
command="${startcommand:-$command}"
+ chroot="${startchroot:-$chroot}"
pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
@@ -73,7 +77,7 @@ ssd_stop()
${retry:+--retry} $retry \
${command:+--exec} $command \
${procname:+--name} $procname \
- ${pidfile:+--pidfile} $pidfile \
+ ${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
eend $? "Failed to stop $RC_SVCNAME"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-05-24 16:43 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-05-24 16:43 UTC (permalink / raw
To: gentoo-commits
commit: 3351c8b4c3027f09003f8ba33e43f46762f5c453
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 19 22:59:40 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 19 22:59:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3351c8b4
supervise-daemon.sh: add support for chroot variable
sh/supervise-daemon.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index 34e3ef7..2d889a6 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -20,24 +20,30 @@ supervise_start()
ebegin "Starting ${name:-$RC_SVCNAME}"
eval supervise-daemon --start \
+ ${chroot:+--chroot} $chroot \
${pidfile:+--pidfile} $pidfile \
${command_user+--user} $command_user \
$supervise_daemon_args \
$command \
-- $command_args $command_args_foreground
rc=$?
- [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ if [ $rc = 0 ]; then
+ [ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
+ [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ fi
eend $rc "failed to start $RC_SVCNAME"
}
supervise_stop()
{
+ local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
+ chroot="${startchroot:-$chroot}"
pidfile="${startpidfile:-$pidfile}"
[ -n "$pidfile" ] || return 0
ebegin "Stopping ${name:-$RC_SVCNAME}"
supervise-daemon --stop \
- ${pidfile:+--pidfile} $pidfile \
+ ${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
eend $? "Failed to stop $RC_SVCNAME"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-02-19 21:34 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-02-19 21:34 UTC (permalink / raw
To: gentoo-commits
commit: beaa71df0ab2cfa61beba4be0303099aa6c75e6a
Author: Dustin C. Hatch <dustin <AT> hatch <DOT> name>
AuthorDate: Fri Feb 19 01:18:13 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 19 21:25:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=beaa71df
binfmt.sh: use read in raw mode
The read builtin in most shells will interpret backslash characters
as escapes, and they are lost when reading binfmt files line-by-line.
This causes magic strings containing backslashes to be mangled and
become invalid, resulting in erroneous 'invalid entry' messages.
The -r option to read disables special handling of backslashes and
keeps all lines intact.
X-Gentoo-Bug: 575114
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=575114
sh/binfmt.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/binfmt.sh.in b/sh/binfmt.sh.in
index fd422f8..be0ed48 100644
--- a/sh/binfmt.sh.in
+++ b/sh/binfmt.sh.in
@@ -22,7 +22,7 @@ apply_file() {
### FILE FORMAT ###
# See https://www.kernel.org/doc/Documentation/binfmt_misc.txt
- while read line; do
+ while read -r line; do
LINENUM=$(( LINENUM+1 ))
case $line in
\#*) continue ;;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2016-01-19 23:02 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2016-01-19 23:02 UTC (permalink / raw
To: gentoo-commits
commit: 30c3561b6b648d60174a22a73555b680d2cc86fc
Author: Colin Booth <colin <AT> heliocat <DOT> net>
AuthorDate: Mon Sep 14 07:43:42 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan 19 22:52:58 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=30c3561b
sh/s6.sh: update s6-svc syntax to be valid for 2.2.0.0+
The s6-svc syntax changed for wait-up, wait-ready, wait-down, and
wait-finished. This changes the s6 handling script to use the current
valid syntax.
This fixes #65.
sh/s6.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/s6.sh b/sh/s6.sh
index 7f378d5..447419c 100644
--- a/sh/s6.sh
+++ b/sh/s6.sh
@@ -41,7 +41,7 @@ s6_stop()
fi
s6_service_link="${RC_SVCDIR}/s6-scan/${s6_service_path##*/}"
ebegin "Stopping ${name:-$RC_SVCNAME}"
- s6-svc -Dd -T ${s6_service_timeout_stop:-10000} "${s6_service_link}"
+ s6-svc -wD -d -T ${s6_service_timeout_stop:-10000} "${s6_service_link}"
set -- $(s6-svstat "${s6_service_link}")
[ "$1" = "down" ]
eend $? "Failed to stop $RC_SVCNAME"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-12-09 18:42 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-12-09 18:42 UTC (permalink / raw
To: gentoo-commits
commit: cc9c23c8484ea7d07b1f8e54bcab46cc31ec727d
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Dec 9 18:38:10 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Dec 9 18:38:10 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=cc9c23c8
Complete support for rc.conf.d
- gendepends.sh needs to read this directory to allow dependencies to be
overridden
- init.sh for Linux and Bsd need to read it to allow config settings
they use to be overridden.
sh/gendepends.sh.in | 5 +++++
sh/init.sh.BSD.in | 5 +++++
sh/init.sh.Linux.in | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in
index 2ab798d..79a4bff 100644
--- a/sh/gendepends.sh.in
+++ b/sh/gendepends.sh.in
@@ -96,6 +96,11 @@ do
fi
[ -e @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
+ if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
+ for _f in "@SYSCONFDIR@"/rc.conf.d/*.conf; do
+ [ -e "$_f" ] && . "$_f"
+ done
+ fi
if . "$_dir/$RC_SVCNAME"; then
echo "$RC_SVCNAME" >&3
diff --git a/sh/init.sh.BSD.in b/sh/init.sh.BSD.in
index 2a53dcd..5912a95 100644
--- a/sh/init.sh.BSD.in
+++ b/sh/init.sh.BSD.in
@@ -23,6 +23,11 @@ mount_svcdir()
. "$RC_LIBEXECDIR"/sh/functions.sh
[ -r "@SYSCONFDIR@/rc.conf" ] && . "@SYSCONFDIR@/rc.conf"
+if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
+ for _f in "@SYSCONFDIR@"/rc.conf.d/*.conf; do
+ [ -r "$_f" ] && . "$_f"
+ done
+fi
# Disable devd until we need it
if [ -z "$RC_SYS" -a "$RC_UNAME" = "FreeBSD" ]; then
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index a8ee69e..7d36e7a 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -5,6 +5,11 @@
. "$RC_LIBEXECDIR"/sh/functions.sh
[ -r "@SYSCONFDIR@/rc.conf" ] && . "@SYSCONFDIR@/rc.conf"
+if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
+ for _f in "@SYSCONFDIR@"/rc.conf.d/*.conf; do
+ [ -e "$_f" ] && . "$_f"
+ done
+fi
# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-12-01 18:31 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-12-01 18:31 UTC (permalink / raw
To: gentoo-commits
commit: bd9456ff3172cc88f32d67bd4e789e2beee43595
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Dec 1 18:31:28 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Dec 1 18:31:28 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bd9456ff
rc-functions.sh: add support for user-defined want dependencies
sh/rc-functions.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 911d65a..c854876 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -91,7 +91,7 @@ _depend() {
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends=
# Add any user defined depends
- for _deptype in config:CONFIG need:NEED use:USE \
+ for _deptype in config:CONFIG need:NEED use:USE want:WANT \
after:AFTER before:BEFORE \
provide:PROVIDE keyword:KEYWORD; do
IFS=:
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-10-13 22:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-10-13 22:45 UTC (permalink / raw
To: gentoo-commits
commit: fc777aeaf3e6e2d47f4599acfe6c8d1bf5bc760a
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Oct 13 20:50:59 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 13 20:51:15 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fc777aea
typo fix
X-Gentoo-Bug: 563010
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=563010
sh/openrc-run.sh.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index e9369e4..37ed96f 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -222,7 +222,7 @@ done
sourcex "$RC_SERVICE"
eval "printf '%s\n' $required_dirs" | while read _d; do
- if [ ! -d "$_d" ]; then
+ if [ -n "$_d" ] && [ ! -d "$_d" ]; then
eerror "$RC_SVCNAME: \`$_d' is not a directory"
exit 1
fi
@@ -230,7 +230,7 @@ done
unset _d
eval "printf '%s\n' $required_files" | while read _f; do
- if [ ! -r "$_f" ]; then
+ if [ -n "$_f" ] && [ ! -r "$_f" ]; then
eerror "$RC_SVCNAME: \`$_f' is not readable"
exit 1
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-10-13 22:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-10-13 22:45 UTC (permalink / raw
To: gentoo-commits
commit: 7da72ce487a8d92d992e7fd3db881c198ae02609
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Oct 13 22:42:46 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 13 22:45:05 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7da72ce4
openrc-run.sh: fix new required_* tests to exit properly
sh/openrc-run.sh.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 37ed96f..8aba4e0 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -227,6 +227,7 @@ eval "printf '%s\n' $required_dirs" | while read _d; do
exit 1
fi
done
+[ $? -ne 0 ] && exit 1
unset _d
eval "printf '%s\n' $required_files" | while read _f; do
@@ -235,6 +236,7 @@ eval "printf '%s\n' $required_files" | while read _f; do
exit 1
fi
done
+[ $? -ne 0 ] && exit 1
unset _f
if [ -n "$opts" ]; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-10-13 13:36 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-10-13 13:36 UTC (permalink / raw
To: gentoo-commits
commit: 29f7e335927d4c1fb151124de8cdf01fb87723fa
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Oct 13 12:59:50 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 13 12:59:50 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=29f7e335
openrc-run.sh: allow spaces in required_{files,dirs}
X-Gentoo-Bug: 562320
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=562320
sh/openrc-run.sh.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 33dc59c..e9369e4 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -221,16 +221,16 @@ done
# Load our script
sourcex "$RC_SERVICE"
-for _d in $required_dirs; do
- if [ ! -d $_d ]; then
+eval "printf '%s\n' $required_dirs" | while read _d; do
+ if [ ! -d "$_d" ]; then
eerror "$RC_SVCNAME: \`$_d' is not a directory"
exit 1
fi
done
unset _d
-for _f in $required_files; do
- if [ ! -r $_f ]; then
+eval "printf '%s\n' $required_files" | while read _f; do
+ if [ ! -r "$_f" ]; then
eerror "$RC_SVCNAME: \`$_f' is not readable"
exit 1
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-10-06 17:17 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-10-06 17:17 UTC (permalink / raw
To: gentoo-commits
commit: b20a1951adf9a705a903fb3047b7ef26c013103c
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Oct 6 16:59:55 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 6 17:11:29 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b20a1951
rc-cgroup.sh: Do not add leading spaces to cgroup values
We were starting the value we write to the cgroup setting file with
leading spaces and this was causing issues. This change makes sure that
we aren't adding leading spaces to the value.
X-Gentoo-Bug: 562354
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=562354
sh/rc-cgroup.sh.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index c7cac2a..3f34d17 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -54,7 +54,9 @@ cgroup_set_values()
val=
;;
*)
- val="$val $1"
+ [ -n "$val" ] &&
+ val="$val $1" ||
+ val="$1"
;;
esac
shift
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-10-04 20:37 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-10-04 20:37 UTC (permalink / raw
To: gentoo-commits
commit: a59365a582c3a8c9a8b863b572fddcb65fccadfd
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Oct 2 21:34:15 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct 2 21:34:15 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a59365a5
start-stop-daemon.sh: complain in start if command is undefined
The default start-stop-daemon start function expects the command
variable to be defined to point to the daemon we want to start.
If the variable is undefined, this means that there will be nothing to
start, and in this case we should complain because it is possible that
the script writer made a typo in the variable name.
sh/start-stop-daemon.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 6a3e205..ea99269 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -4,7 +4,13 @@
ssd_start()
{
- [ -n "$command" ] || return 0
+ if [ -z "$command" ]; then
+ ewarn "The command variable is undefined."
+ ewarn "There is nothing for ${name:-$RC_SVCNAME} to start."
+ ewarn "If this is what you intend, please write a start function."
+ ewarn "This will become a failure in a future release."
+ return 0
+ fi
local _background=
ebegin "Starting ${name:-$RC_SVCNAME}"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-08-04 19:41 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-08-04 19:41 UTC (permalink / raw
To: gentoo-commits
commit: 6a422982579786cb8308af04ccca6622afa06e50
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Fri Jul 10 20:45:11 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Aug 3 19:51:16 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6a422982
tmpfiles: run restorecon on the entire path
The tmpfiles "d" entry will create a full path and only the last dir in
the path will have its SELinux label set correctly. This patch will
restorecon the parents as well so that the selinux labels are correct.
eg, "d /run/libvirt/lxc", then "lxc" would have the correct SELinux
label but "libvirt" would not.
Signed-off-by: Jason Zaman <jason <AT> perfinion.com>
sh/tmpfiles.sh.in | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 89bd03e..43442d7 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -53,10 +53,18 @@ relabel() {
done
}
+splitpath() {
+ local path=$1
+ while [ -n "$path" ]; do
+ echo $path
+ path=${path%/*}
+ done
+}
+
_restorecon() {
local path=$1
if [ -x /sbin/restorecon ]; then
- dryrun_or_real restorecon -F "$path"
+ dryrun_or_real restorecon -F $(splitpath "$path")
fi
}
@@ -122,6 +130,7 @@ _d() {
if [ ! -d "$path" ]; then
dryrun_or_real mkdir -p "$path" 2>/dev/null
+ _restorecon "$path"
dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
@@ -137,6 +146,7 @@ _D() {
if [ $CREATE -gt 0 ]; then
dryrun_or_real mkdir -p "$path" 2>/dev/null
+ _restorecon "$path"
dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-07-10 18:26 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-07-10 18:26 UTC (permalink / raw
To: gentoo-commits
commit: 9310ccc06bcadd8897aed51cd51c94fccb7d9c07
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 14 01:11:18 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 05:40:02 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9310ccc0
Remove execute bit from tmpfiles.sh.in
sh/tmpfiles.sh.in | 0
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
old mode 100755
new mode 100644
^ permalink raw reply [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-07-10 18:26 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-07-10 18:26 UTC (permalink / raw
To: gentoo-commits
commit: a36a635b016a7427dd1739a26c951fedf22f0dec
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 14 01:25:33 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 05:40:35 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a36a635b
tmpfiles: Recognize type 'v' (create btrfs subvol)
This change does NOT implement btrfs subvol creation. Instead, it
treats 'v' the same as 'd', which is an acceptable fallback
according to the manual.
Fixes #58
sh/tmpfiles.sh.in | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 046bf9f..89bd03e 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -141,6 +141,13 @@ _D() {
fi
}
+_v() {
+ # Create a subvolume if the path does not exist yet and the file system
+ # supports this (btrfs). Otherwise create a normal directory.
+ # TODO: Implement btrfs subvol creation.
+ _d "$@"
+}
+
_L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
@@ -336,7 +343,7 @@ for FILE in $tmpfiles_d ; do
# whine about invalid entries
case $cmd in
- f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
+ f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z) ;;
*) warninvalid ; continue ;;
esac
@@ -344,7 +351,7 @@ for FILE in $tmpfiles_d ; do
if [ "$mode" = '-' -o "$mode" = '' ]; then
case "$cmd" in
p|f|F) mode=0644 ;;
- d|D) mode=0755 ;;
+ d|D|v) mode=0755 ;;
C|z|Z|x|r|R|L) ;;
esac
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-05-14 19:29 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-05-14 19:29 UTC (permalink / raw
To: gentoo-commits
commit: a7fcc1e264b035177b4e524a40b27145baa86969
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 14 19:26:52 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 14 19:26:52 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a7fcc1e2
S6: kick the scanner and sleep 1.5 seconds to avoid a race condition
sh/s6.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sh/s6.sh b/sh/s6.sh
index 99aba3f..a45456a 100644
--- a/sh/s6.sh
+++ b/sh/s6.sh
@@ -13,6 +13,8 @@ s6_start()
s6_service_link="${RC_SVCDIR}/s6-scan/${s6_service_path##*/}"
ebegin "Starting ${name:-$RC_SVCNAME}"
ln -sf "${s6_service_path}" "${s6_service_link}"
+ s6-svscanctl -na "${RC_SVCDIR}"/s6-scan
+ sleep 1.5
s6-svc -u "${s6_service_link}"
if [ -n "$s6_svwait_options_start" ]; then
s6-svwait ${s6_svwait_options_start} "${s6_service_link}"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-05-13 21:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-05-13 21:56 UTC (permalink / raw
To: gentoo-commits
commit: ddce529c71c2e9f01d8e5666e27050b6ed6c6761
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed May 13 21:51:55 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed May 13 21:51:55 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ddce529c
More s6 fixes
- When no service link is in the scan directory, show the default
stopped message.
- Do not remove the service link when stopping the service.
sh/s6.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sh/s6.sh b/sh/s6.sh
index 01527b6..a99fd5b 100644
--- a/sh/s6.sh
+++ b/sh/s6.sh
@@ -37,12 +37,16 @@ s6_stop()
fi
sleep 1.5
set -- $(s6-svstat "${s6_service_link}")
- [ "$1" = "down" ] && rm -fr "${s6_service_link}"
+ [ "$1" = "down" ]
eend $? "Failed to stop $RC_SVCNAME"
}
s6_status()
{
s6_service_link="${RC_SVCDIR}/s6-scan/${s6_service_path##*/}"
- s6-svstat "${s6_service_link}"
+ if [ -L "${s6_service_link}" ]; then
+ s6-svstat "${s6_service_link}"
+ else
+ _status
+ fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-04-21 21:33 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-04-21 21:33 UTC (permalink / raw
To: gentoo-commits
commit: 15ab3f39c69ff8d69fd08a9cde7495a04b4dec9e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Apr 13 16:15:58 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Apr 21 16:30:24 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=15ab3f39
cgroups: use printf to write to cgroup files
This fixes #33.
sh/rc-cgroup.sh.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 0426026..c7cac2a 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -1,6 +1,7 @@
#!@SHELL@
# Copyright (c) 2012 Alexander Vershilov <qnikst@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"
@@ -47,7 +48,7 @@ cgroup_set_values()
$controller.*)
if [ -n "$name" -a -f "$cgroup/$name" -a -n "$val" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
- echo $val > "$cgroup/$name"
+ printf "%s" "$val" > "$cgroup/$name"
fi
name=$1
val=
@@ -60,12 +61,12 @@ cgroup_set_values()
done
if [ -n "$name" -a -f "$cgroup/$name" -a -n "$val" ]; then
veinfo "$RC_SVCNAME: Setting $cgroup/$name to $val"
- echo $val > "$cgroup/$name"
+ printf "%s" "$val" > "$cgroup/$name"
fi
if [ -f "$cgroup/tasks" ]; then
veinfo "$RC_SVCNAME: adding to $cgroup/tasks"
- echo 0 > "$cgroup/tasks"
+ printf "%d" 0 > "$cgroup/tasks"
fi
return 0
@@ -78,14 +79,14 @@ cgroup_add_service()
# cgroups. But may lead to a problems where that inheriting
# is needed.
for d in /sys/fs/cgroup/* ; do
- [ -f "${d}"/tasks ] && echo 0 > "${d}"/tasks
+ [ -f "${d}"/tasks ] && printf "%d" 0 > "${d}"/tasks
done
openrc_cgroup=/sys/fs/cgroup/openrc
if [ -d "$openrc_cgroup" ]; then
cgroup="$openrc_cgroup/$RC_SVCNAME"
mkdir -p "$cgroup"
- [ -f "$cgroup/tasks" ] && echo 0 > "$cgroup/tasks"
+ [ -f "$cgroup/tasks" ] && printf "%d" 0 > "$cgroup/tasks"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-04-08 15:33 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-04-08 15:33 UTC (permalink / raw
To: gentoo-commits
commit: 1eab656ca1d3258ff00495710a68ad459ce50d3e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Apr 1 15:55:09 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Apr 8 14:57:46 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1eab656c
Fix tmpfiles processing
Tmpfiles.d processing had /run overriding /usr/lib and /etc, but this is
not correct. The correct order, from lowest to highest, for tmpfiles
processing is:
* /usr/lib/tmpfiles.d/*.conf
* /run/tmpfiles.d/*.conf
* /etc/tmpfiles.d
This means /run/tmpfiles.d/*.conf can override /etc/tmpfiles.d/*.conf,
but /etc/tmpfiles.d/*.conf can override both of them.
This fixes #49.
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 6e7be42..046bf9f 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -245,7 +245,7 @@ PREFIX=
FILE=
fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
-tmpfiles_dirs='/usr/lib/tmpfiles.d/ /etc/tmpfiles.d/ /run/tmpfiles.d/'
+tmpfiles_dirs='/usr/lib/tmpfiles.d/ /run/tmpfiles.d/ /etc/tmpfiles.d/'
tmpfiles_basenames=''
tmpfiles_d=''
# Build a list of sorted unique basenames
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-03-29 23:37 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-03-29 23:37 UTC (permalink / raw
To: gentoo-commits
commit: c068762c4cf49e7ea9719dcab2e5f7d4c4e7e2e5
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Mar 29 20:20:52 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Mar 29 23:05:32 2015 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c068762c
Fix rc_verbose processing
We were processing the rc_verbose setting before we sourced the
configuration file where it was set; this fixes the issue.
Fixes #46
sh/runscript.sh.in | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 06d51d0..4c47260 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -189,10 +189,6 @@ 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
@@ -213,6 +209,12 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
+# Set verbose mode
+if yesno "${rc_verbose:-$RC_VERBOSE}"; then
+ EINFO_VERBOSE=yes
+ export EINFO_VERBOSE
+fi
+
for _cmd; do
if [ "$_cmd" != status -a "$_cmd" != describe ]; then
# Apply any ulimit defined
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2015-01-12 21:02 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2015-01-12 21:02 UTC (permalink / raw
To: gentoo-commits
commit: 7e3a33c8f5ccae03e035cf4c9d1c3c01a0f57b1e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Jan 12 20:37:10 2015 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jan 12 20:45:06 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=7e3a33c8
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 <qnikst@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()
{
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-09-11 19:06 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-09-11 19:06 UTC (permalink / raw
To: gentoo-commits
commit: 50658449bd46f1a53b8eb11d34f6eefdd1ceba9c
Author: Roy Marples <roy <AT> marples <DOT> name>
AuthorDate: Thu Sep 11 18:26:58 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 11 18:26:58 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=50658449
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"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-09-11 17:03 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-09-11 17:03 UTC (permalink / raw
To: gentoo-commits
commit: de60ffeebe93ffdc09c1dda51e04f29485d96cdb
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 11 17:02:51 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Sep 11 17:02:51 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=de60ffee
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
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-08-28 14:49 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-08-28 14:49 UTC (permalink / raw
To: gentoo-commits
commit: 6f3f50d4530f583d0d2aedec8af20077a9d07f4f
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Mon Aug 25 19:37:45 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 27 22:48:34 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f3f50d4
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=$?
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-08-28 14:49 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-08-28 14:49 UTC (permalink / raw
To: gentoo-commits
commit: d4204a97a2410fcf37a64385204e6452c6958e8d
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Mon Aug 25 19:46:28 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 27 22:49:00 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=d4204a97
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
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-08-22 19:10 William Hubbs
2014-08-07 18:35 ` William Hubbs
0 siblings, 1 reply; 148+ messages in thread
From: William Hubbs @ 2014-08-22 19:10 UTC (permalink / raw
To: gentoo-commits
commit: 647e08eb9166d23d0c64f0c8767d93a06bd21a40
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Tue Aug 5 22:12:35 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Aug 7 17:54:04 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=647e08eb
tmpfiles.sh: do not use install
install is in /usr which causes problems if /usr is not mounted.
Instead, checkpath and "mkdir -p" can do everything required and are
both available before /usr is mounted.
Since checkpath also handles selinux labels correctly,
_restorecon after is not required.
X-Gentoo-Bug: 503408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=503408
---
sh/tmpfiles.sh.in | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index da64011..63c5d14 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -15,6 +15,7 @@
#
DRYRUN=0
+CHECKPATH="@LIBEXECDIR@/bin/checkpath"
checkprefix() {
n=$1
@@ -87,9 +88,8 @@ _f() {
[ $CREATE -gt 0 ] || return 0
if [ ! -e "$path" ]; then
- dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
- _restorecon "$path"
fi
}
@@ -99,9 +99,8 @@ _F() {
[ $CREATE -gt 0 ] || return 0
- dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
- _restorecon "$path"
}
_d() {
@@ -111,8 +110,8 @@ _d() {
[ $CREATE -gt 0 ] || return 0
if [ ! -d "$path" ]; then
- dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real mkdir -p "$path" 2>/dev/null
+ dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
@@ -126,8 +125,8 @@ _D() {
fi
if [ $CREATE -gt 0 ]; then
- dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real mkdir -p "$path" 2>/dev/null
+ dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
@@ -145,9 +144,7 @@ _p() {
[ $CREATE -gt 0 ] || return 0
if [ ! -p "$path" ]; then
- dryrun_or_real mkfifo -m$mode "$path"
- dryrun_or_real chown "$uid:$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
2014-08-22 19:10 William Hubbs
@ 2014-08-07 18:35 ` William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-08-07 18:35 UTC (permalink / raw
To: gentoo-commits
commit: 647e08eb9166d23d0c64f0c8767d93a06bd21a40
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Tue Aug 5 22:12:35 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Aug 7 17:54:04 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=647e08eb
tmpfiles.sh: do not use install
install is in /usr which causes problems if /usr is not mounted.
Instead, checkpath and "mkdir -p" can do everything required and are
both available before /usr is mounted.
Since checkpath also handles selinux labels correctly,
_restorecon after is not required.
X-Gentoo-Bug: 503408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=503408
---
sh/tmpfiles.sh.in | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index da64011..63c5d14 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -15,6 +15,7 @@
#
DRYRUN=0
+CHECKPATH="@LIBEXECDIR@/bin/checkpath"
checkprefix() {
n=$1
@@ -87,9 +88,8 @@ _f() {
[ $CREATE -gt 0 ] || return 0
if [ ! -e "$path" ]; then
- dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
- _restorecon "$path"
fi
}
@@ -99,9 +99,8 @@ _F() {
[ $CREATE -gt 0 ] || return 0
- dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path"
[ -z "$arg" ] || _w "$@"
- _restorecon "$path"
}
_d() {
@@ -111,8 +110,8 @@ _d() {
[ $CREATE -gt 0 ] || return 0
if [ ! -d "$path" ]; then
- dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real mkdir -p "$path" 2>/dev/null
+ dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
@@ -126,8 +125,8 @@ _D() {
fi
if [ $CREATE -gt 0 ]; then
- dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real mkdir -p "$path" 2>/dev/null
+ dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
fi
}
@@ -145,9 +144,7 @@ _p() {
[ $CREATE -gt 0 ] || return 0
if [ ! -p "$path" ]; then
- dryrun_or_real mkfifo -m$mode "$path"
- dryrun_or_real chown "$uid:$gid" "$path"
- _restorecon "$path"
+ dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-08-22 19:10 William Hubbs
2014-08-13 20:29 ` William Hubbs
0 siblings, 1 reply; 148+ messages in thread
From: William Hubbs @ 2014-08-22 19:10 UTC (permalink / raw
To: gentoo-commits
commit: c8018d04a7b238b57a3d74a68e2af02af395f510
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Aug 13 20:26:37 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 20:26:37 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c8018d04
tmpfiles: fix relabel to run restorecon before chown and chmod
---
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 8538545..42a3639 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -45,10 +45,10 @@ relabel() {
for path in ${paths}; do
if [ -e "$path" ]; then
+ [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
- [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
fi
done
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
2014-08-22 19:10 William Hubbs
@ 2014-08-13 20:29 ` William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-08-13 20:29 UTC (permalink / raw
To: gentoo-commits
commit: c8018d04a7b238b57a3d74a68e2af02af395f510
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Aug 13 20:26:37 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 20:26:37 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c8018d04
tmpfiles: fix relabel to run restorecon before chown and chmod
---
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 8538545..42a3639 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -45,10 +45,10 @@ relabel() {
for path in ${paths}; do
if [ -e "$path" ]; then
+ [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
- [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
fi
done
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-08-22 19:10 William Hubbs
2014-08-13 15:07 ` William Hubbs
0 siblings, 1 reply; 148+ messages in thread
From: William Hubbs @ 2014-08-22 19:10 UTC (permalink / raw
To: gentoo-commits
commit: 6f080e9c1a2a9b9c308cdc03f9cf782c4ce4d440
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Wed Aug 13 06:50:34 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 15:02:20 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f080e9c
tmpfiles: Move relabelling before any other calls for device nodes
Device nodes are normally never device_t so this type does not
have many permissions. After the mknod, the device should have
its label corrected before any other operations (like chmod).
---
sh/tmpfiles.sh.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 63c5d14..8538545 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -65,8 +65,8 @@ _b() {
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
- dryrun_or_real chown $uid:$gid $path
_restorecon "$path"
+ dryrun_or_real chown $uid:$gid $path
fi
}
@@ -75,8 +75,8 @@ _c() {
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
- dryrun_or_real chown $uid:$gid $path
_restorecon "$path"
+ dryrun_or_real chown $uid:$gid $path
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
2014-08-22 19:10 William Hubbs
@ 2014-08-13 15:07 ` William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-08-13 15:07 UTC (permalink / raw
To: gentoo-commits
commit: 6f080e9c1a2a9b9c308cdc03f9cf782c4ce4d440
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Wed Aug 13 06:50:34 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 13 15:02:20 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f080e9c
tmpfiles: Move relabelling before any other calls for device nodes
Device nodes are normally never device_t so this type does not
have many permissions. After the mknod, the device should have
its label corrected before any other operations (like chmod).
---
sh/tmpfiles.sh.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 63c5d14..8538545 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -65,8 +65,8 @@ _b() {
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
- dryrun_or_real chown $uid:$gid $path
_restorecon "$path"
+ dryrun_or_real chown $uid:$gid $path
fi
}
@@ -75,8 +75,8 @@ _c() {
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
- dryrun_or_real chown $uid:$gid $path
_restorecon "$path"
+ dryrun_or_real chown $uid:$gid $path
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-07-16 18:14 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-07-16 18:14 UTC (permalink / raw
To: gentoo-commits
commit: 4f784bd46923486773edcd7749246a21bd419e6b
Author: Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Tue Jul 15 18:27:32 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Jul 16 15:53:25 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=4f784bd4
tmpfiles: set the proper SELinux context
Restore the label on the created file / dir based on the policy
fcontexts.
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
---
sh/tmpfiles.sh.in | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 66612fc..da64011 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -52,12 +52,20 @@ relabel() {
done
}
+_restorecon() {
+ local path=$1
+ if [ -x /sbin/restorecon ]; then
+ dryrun_or_real restorecon -F "$path"
+ fi
+}
+
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
dryrun_or_real chown $uid:$gid $path
+ _restorecon "$path"
fi
}
@@ -67,6 +75,7 @@ _c() {
if [ ! -e "$path" ]; then
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
dryrun_or_real chown $uid:$gid $path
+ _restorecon "$path"
fi
}
@@ -80,6 +89,7 @@ _f() {
if [ ! -e "$path" ]; then
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
[ -z "$arg" ] || _w "$@"
+ _restorecon "$path"
fi
}
@@ -91,6 +101,7 @@ _F() {
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
[ -z "$arg" ] || _w "$@"
+ _restorecon "$path"
}
_d() {
@@ -101,6 +112,7 @@ _d() {
if [ ! -d "$path" ]; then
dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ _restorecon "$path"
fi
}
@@ -110,10 +122,12 @@ _D() {
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
+ _restorecon "$path"
fi
if [ $CREATE -gt 0 ]; then
dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ _restorecon "$path"
fi
}
@@ -121,6 +135,7 @@ _L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
[ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
+ _restorecon "$path"
}
_p() {
@@ -132,6 +147,7 @@ _p() {
if [ ! -p "$path" ]; then
dryrun_or_real mkfifo -m$mode "$path"
dryrun_or_real chown "$uid:$gid" "$path"
+ _restorecon "$path"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-07-10 17:08 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-07-10 17:08 UTC (permalink / raw
To: gentoo-commits
commit: 75e06d85584fc3ebfa26fbca97ea60b687247bb0
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Jul 10 10:18:00 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jul 10 15:57:56 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=75e06d85
Style Fixes
---
sh/runscript.sh.in | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index c72a784..9b2ae0e 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -216,12 +216,12 @@ fi
# 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
-fi
-[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
- cgroup_set_limits
+ 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
+ fi
+ [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
+ cgroup_set_limits
fi
# Load our script
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-07-10 17:08 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-07-10 17:08 UTC (permalink / raw
To: gentoo-commits
commit: 1a44be0f16a7a1de8a176e7c656f8513494e0e64
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 16 00:27:52 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jul 10 15:56:37 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1a44be0f
cgroups: only run cgroup setup when starting a service
Status call should not set limits as it requires root permissions,
also this is not safe, as current process may reach limitation.
Solution is to set limits and move process to service cgroup only
on start.
X-GENTOO-BUG: 500364
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364
---
sh/runscript.sh.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index ceb9ab4..c72a784 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -215,12 +215,14 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then
fi
# 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
fi
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
cgroup_set_limits
+fi
# Load our script
sourcex "$RC_SERVICE"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-06-21 0:44 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-06-21 0:44 UTC (permalink / raw
To: gentoo-commits
commit: 094bc17cb0ad75da189ebf1a8242a378928a1eef
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Jun 21 00:39:07 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Jun 21 00:39:07 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=094bc17c
tmpfiles.sh: fix comment processing
If you happened to format a comment with no white space after the '#',
it was not being processed.
Reported-by: consus <AT> gmx.com
X-Gentoo-Bug: 511804
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511804
---
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 6d4c614..66612fc 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -304,7 +304,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) ;;
- \#) continue ;;
+ \#*) continue ;;
*) warninvalid ; continue ;;
esac
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-06-20 21:22 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-06-20 21:22 UTC (permalink / raw
To: gentoo-commits
commit: 19cccb2e9416311b85fcad3c15d4d988fed2f954
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon May 26 06:51:37 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jun 20 21:19:25 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=19cccb2e
sh/tmpfiles.sh: license under 2-clause BSD
As the author of our tmpfiles.sh script, I hereby license it under
2-clause BSD, like the rest of openrc.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index a903163..6d4c614 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -3,10 +3,11 @@
# Control creation, deletion, and cleaning of volatile and temporary files
#
# Copyright (c) 2012 Gentoo Foundation
+# Released under the 2-clause BSD license.
#
-# This instance based on the Arch Linux version:
+# This instance is a pure-POSIX sh version, written by Robin H Johnson
+# <robbat2@gentoo.org>, based on the Arch Linux version as of 2012/01/01:
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
-# As of 2012/01/01
#
# See the tmpfiles.d manpage as well:
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-05-26 6:52 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2014-05-26 6:52 UTC (permalink / raw
To: gentoo-commits
commit: a0596076dd97a35f0dfb6d601bc12e2297f66c7f
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon May 26 06:51:37 2014 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon May 26 06:51:44 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a0596076
sh/tmpfiles.sh: license under 2-clause BSD
As the author of our tmpfiles.sh script, I hereby license it under
2-clause BSD, like the rest of openrc.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index a903163..6d4c614 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -3,10 +3,11 @@
# Control creation, deletion, and cleaning of volatile and temporary files
#
# Copyright (c) 2012 Gentoo Foundation
+# Released under the 2-clause BSD license.
#
-# This instance based on the Arch Linux version:
+# This instance is a pure-POSIX sh version, written by Robin H Johnson
+# <robbat2@gentoo.org>, based on the Arch Linux version as of 2012/01/01:
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
-# As of 2012/01/01
#
# See the tmpfiles.d manpage as well:
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-04-03 18:05 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-04-03 18:05 UTC (permalink / raw
To: gentoo-commits
commit: c081633762dc66235fe385eedcc2cdf6bff83391
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Thu Mar 27 15:02:47 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Mar 27 15:36:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c0816337
tmpfiles: ignore all files starting with systemd-
systemd recently moved creation of /run/nologin to systemd-nologin.conf
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/tmpfiles.sh.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 1a263f2..da588e2 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -230,7 +230,9 @@ tmpfiles_d=''
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
for d in ${tmpfiles_dirs} ; do
[ -d $d ] && for f in ${d}/*.conf ; do
- [ "$f" = "$d/systemd.conf" ] && continue
+ case "${f##*/}" in
+ systemd.conf|systemd-*.conf) continue;;
+ esac
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
done # for f in ${d}
done # for d in ${tmpfiles_dirs}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-01-18 8:50 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-01-18 8:50 UTC (permalink / raw
To: gentoo-commits
commit: cdc0dd061bed38be298e714e45cd0faa7cf77bf6
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Jan 18 08:34:39 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Jan 18 08:34:39 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cdc0dd06
init-Linux.sh: do not mount /run with nosuid
This is so that we will be consistent with the systemd spec forr the
/run directory mentioned in this wiki article:
http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/
---
sh/init.sh.Linux.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 9054978..a8ee69e 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -57,7 +57,7 @@ elif ! mountinfo -q /run; then
ebegin "Mounting /run"
rc=0
if ! fstabinfo --mount /run; then
- mount -t tmpfs -o mode=0755,nosuid,nodev,size=10% tmpfs /run
+ mount -t tmpfs -o mode=0755,nodev,size=10% tmpfs /run
rc=$?
fi
if [ $rc != 0 ]; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2014-01-18 7:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2014-01-18 7:56 UTC (permalink / raw
To: gentoo-commits
commit: 54ab12d2186d907ea8d7d882b6a9e0536fcc8f5c
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Jan 11 19:32:43 2014 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Jan 11 19:32:43 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=54ab12d2
Merge init-common-post code into BSD init script
This code is no longer part of the initialization script for Linux, so
we can move it into the init script for *BSD which is the only place it
is used.
---
sh/.gitignore | 1 -
sh/Makefile | 4 ++--
sh/init-common-post.sh.in | 25 -------------------------
sh/init.sh.BSD.in | 23 ++++++++++++++++++++++-
4 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/sh/.gitignore b/sh/.gitignore
index 386c42f..d5cb215 100644
--- a/sh/.gitignore
+++ b/sh/.gitignore
@@ -1,6 +1,5 @@
functions.sh
gendepends.sh
-init-common-post.sh
rc-functions.sh
runscript.sh
cgroup-release-agent.sh
diff --git a/sh/Makefile b/sh/Makefile
index 7307f63..c1953f3 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -1,7 +1,7 @@
DIR= ${LIBEXECDIR}/sh
-SRCS= init.sh.in functions.sh.in gendepends.sh.in init-common-post.sh.in \
+SRCS= init.sh.in functions.sh.in gendepends.sh.in \
rc-functions.sh.in runscript.sh.in tmpfiles.sh.in ${SRCS-${OS}}
-INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
+INC= rc-mount.sh functions.sh rc-functions.sh
BIN= gendepends.sh init.sh runscript.sh tmpfiles.sh ${BIN-${OS}}
INSTALLAFTER= _installafter
diff --git a/sh/init-common-post.sh.in b/sh/init-common-post.sh.in
deleted file mode 100644
index 96eeeee..0000000
--- a/sh/init-common-post.sh.in
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
-# Released under the 2-clause BSD license.
-
-# mount $RC_SVCDIR as something we can write to if it's not rw
-# On vservers, / is always rw at this point, so we need to clean out
-# the old service state data
-: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
-: ${RC_SVCDIR:=@LIBEXECDIR@/init.d}
-case "$(openrc --sys)" in
- OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;;
- *) if mountinfo --quiet "$RC_SVCDIR"; then
- rm -rf "$RC_SVCDIR"/*
- else
- mount_svcdir
- fi
- ;;
-esac
-retval=$?
-
-if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
- cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
-fi
-
-echo sysinit >"$RC_SVCDIR"/softlevel
-exit $retval
diff --git a/sh/init.sh.BSD.in b/sh/init.sh.BSD.in
index 0bd3e9b..2a53dcd 100644
--- a/sh/init.sh.BSD.in
+++ b/sh/init.sh.BSD.in
@@ -29,4 +29,25 @@ if [ -z "$RC_SYS" -a "$RC_UNAME" = "FreeBSD" ]; then
sysctl hw.bus.devctl_disable=1 >/dev/null
fi
-. "$RC_LIBEXECDIR"/sh/init-common-post.sh
+# mount $RC_SVCDIR as something we can write to if it's not rw
+# On vservers, / is always rw at this point, so we need to clean out
+# the old service state data
+: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
+: ${RC_SVCDIR:=@LIBEXECDIR@/init.d}
+case "$(openrc --sys)" in
+ OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;;
+ *) if mountinfo --quiet "$RC_SVCDIR"; then
+ rm -rf "$RC_SVCDIR"/*
+ else
+ mount_svcdir
+ fi
+ ;;
+esac
+retval=$?
+
+if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
+ cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
+fi
+
+echo sysinit >"$RC_SVCDIR"/softlevel
+exit $retval
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-12-11 4:47 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-12-11 4:47 UTC (permalink / raw
To: gentoo-commits
commit: 09733d3fae77265263b1e918b9fce66a1c7a519a
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Dec 11 04:34:40 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Dec 11 04:34:40 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=09733d3f
tmpfiles.sh: small fixes
Change "sort | uniq" to "sort -u". Also, change `...` to $(...).
X-Gentoo-Bug: 493736
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=493736
---
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index b59f4cb..1a263f2 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -234,7 +234,7 @@ for d in ${tmpfiles_dirs} ; do
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
done # for f in ${d}
done # for d in ${tmpfiles_dirs}
-tmpfiles_basenames="`printf "${tmpfiles_basenames}\n" | sort | uniq`"
+tmpfiles_basenames="$(printf "${tmpfiles_basenames}\n" | sort -u )"
for b in $tmpfiles_basenames ; do
real_f=''
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-11-30 21:33 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2013-11-30 21:33 UTC (permalink / raw
To: gentoo-commits
commit: af30c4b86e20512cbd2cfa861ff8346ed6bd1c3e
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 30 21:21:15 2013 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Nov 30 21:33:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=af30c4b8
functions.sh: yesno: (mostly) fix eval logic
We need to quote the expansion.
X-Gentoo-Bug: 475032
X-Gentoo-Bug: https://bugs.gentoo.org/475032
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
sh/functions.sh.in | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index 52a8ae7..e4e69eb 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -24,13 +24,18 @@ yesno()
{
[ -z "$1" ] && return 1
+ # Check the value directly so people can do:
+ # yesno ${VAR}
case "$1" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
esac
+ # Check the value of the var so people can do:
+ # yesno VAR
+ # Note: this breaks when the var contains a double quote.
local value=
- eval value=\$${1}
+ eval value=\"\$$1\"
case "$value" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-10-31 21:09 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-10-31 21:09 UTC (permalink / raw
To: gentoo-commits
commit: 6965d85f2efb4e1d7b37e04af890b715091fe3d9
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Oct 31 21:04:19 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 21:04:19 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6965d85f
Fix the service-level rc_verbose setting
This commit fixes the rc_verbose setting so that it is honored if it is
set for an individual service.
Thanks to whissi <AT> whissi.de for the original patch; this one is slightly
modified to be more posix.
X-Gentoo-Bug: 489358
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=489358
---
sh/runscript.sh.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index f8fcbc5..ceb9ab4 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -208,6 +208,12 @@ 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 [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
cgroup_add_service /sys/fs/cgroup/openrc
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-09-27 21:22 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-09-27 21:22 UTC (permalink / raw
To: gentoo-commits
commit: 993e7d704404a8ff1a355bf4a38d1d92e7cc56cd
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Sep 26 01:05:41 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 20:55:46 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=993e7d70
fix cgroup_cleanup function
The yesno test for rc_cgroup_cleanup belongs at the point where this
function is called from runscript, not in the function itself.
X-Gentoo-Bug: 486210
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=486210
---
sh/rc-cgroup.sh.in | 2 +-
sh/runscript.sh.in | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 9329b57..b635340 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -116,7 +116,7 @@ cgroup_set_limits()
cgroup_cleanup()
{
- yesno "${rc_cgroup_cleanup:-no}" && cgroup_running || return 0
+ cgroup_running || return 0
ebegin "starting cgroups cleanup"
for sig in TERM QUIT INT; do
cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index a1ed9c6..f8fcbc5 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -308,6 +308,7 @@ while [ -n "$1" ]; do
fi
[ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
"$1" = "stop" ] && \
+ yesno "${rc_cgroup_cleanup}" && \
cgroup_cleanup
shift
continue 2
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-27 16:12 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-27 16:12 UTC (permalink / raw
To: gentoo-commits
commit: e90dcf39dd3f3658a7d9804e73d0442ae6c7935c
Author: Dirk Sondermann <ds-gentoo <AT> dyximaq <DOT> de>
AuthorDate: Sat Jul 27 15:53:32 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Jul 27 15:53:32 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e90dcf39
tmpfiles: do not signal an error if device nodes already exist
X-Gentoo-Bug: 478336
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=478336
---
sh/tmpfiles.sh.in | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 22d5f1f..b59f4cb 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -54,17 +54,19 @@ relabel() {
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && \
- dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:} && \
+ if [ ! -e "$path" ]; then
+ dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
dryrun_or_real chown $uid:$gid $path
+ fi
}
_c() {
# Create a character device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && \
- dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:} && \
+ if [ ! -e "$path" ]; then
+ dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
dryrun_or_real chown $uid:$gid $path
+ fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-26 1:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-26 1:56 UTC (permalink / raw
To: gentoo-commits
commit: bee59c68c5ff5be426e68ecb603d4cc26542f4af
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Jul 26 01:33:51 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 01:33:51 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=bee59c68
rc-cgroup: make sure the tasks file exists before adding the pid
---
sh/rc-cgroup.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 389e8a0..9329b57 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -77,7 +77,7 @@ cgroup_add_service()
# cgroups. But may lead to a problems where that inheriting
# is needed.
for d in /sys/fs/cgroup/* ; do
- echo 0 > "${d}"/tasks
+ [ -f "${d}"/tasks ] && echo 0 > "${d}"/tasks
done
openrc_cgroup=/sys/fs/cgroup/openrc
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-25 6:01 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-25 6:01 UTC (permalink / raw
To: gentoo-commits
commit: e9189cd8a24b5614f3e82aec4a779e4d90656b1e
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Jul 25 05:58:38 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jul 25 05:58:38 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e9189cd8
tmpfiles: add --prefix and --exclude-prefix options
---
sh/tmpfiles.sh.in | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 59fdcd7..22d5f1f 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -15,6 +15,17 @@
DRYRUN=0
+checkprefix() {
+ n=$1
+ shift
+ for x in $@; do
+ case $n in
+ ${x}*) return 0 ;;
+ esac
+ done
+ return 1
+}
+
warninvalid() {
printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
error=$(( error+1 ))
@@ -202,6 +213,8 @@ _Z() {
}
CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
+EXCLUDE=
+PREFIX=
FILE=
fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
@@ -237,6 +250,8 @@ while [ $# -gt 0 ]; do
--clean) CLEAN=1 ;; # TODO: Not implemented
--verbose) VERBOSE=1 ;;
--dryrun|--dry-run) DRYRUN=1 ;;
+ --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
+ --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
esac
shift
done
@@ -247,7 +262,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
fi
if [ "$CREATE$REMOVE" = '00' ]; then
- printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
+ printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
@@ -297,6 +312,8 @@ for FILE in $tmpfiles_d ; do
[ "$arg" = '-' -o "$arg" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
+ [ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
+ [ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
_$cmd "$@"
rc=$?
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-23 23:01 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-23 23:01 UTC (permalink / raw
To: gentoo-commits
commit: 3af434a4e90f6e964105d94163169f843113a1fb
Author: Hank Leininger <hlein <AT> korelogic <DOT> com>
AuthorDate: Tue Jul 16 22:09:05 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jul 16 22:12:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=3af434a4
typo fix
X-Gentoo-Bug: 477006
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=477006
---
sh/tmpfiles.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f20cd0d..cb9eceb 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -102,7 +102,7 @@ _D() {
_L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && dryrun_or_real ln -s "$args" "$path"
+ [ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
}
_p() {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-23 23:01 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-23 23:01 UTC (permalink / raw
To: gentoo-commits
commit: 19579687fd6d4fb80ffbd83c010fab6777c3120c
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Jul 23 22:58:42 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jul 23 22:58:42 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=19579687
tmpfiles: make b and c commands set ownership and permissions
The b and c commands in tmpfiles.sh were not setting ownership and
permissions for the device nodes.
---
sh/tmpfiles.sh.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index cb9eceb..59fdcd7 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -43,13 +43,17 @@ relabel() {
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && dryrun_or_real mknod $path b ${arg%:*} ${arg#*:}
+ [ ! -e "$path" ] && \
+ dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:} && \
+ dryrun_or_real chown $uid:$gid $path
}
_c() {
# Create a character device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && dryrun_or_real mknod $path c ${arg%:*} ${arg#*:}
+ [ ! -e "$path" ] && \
+ dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:} && \
+ dryrun_or_real chown $uid:$gid $path
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-16 18:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-16 18:56 UTC (permalink / raw
To: gentoo-commits
commit: 992807de55bd9b0e8cbb569a86bb84b75fe9482e
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 30 12:32:30 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 1 05:18:02 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=992807de
Put a service on into a top hierarchy of each cgroup
This change will fix unwanted cgroup inheriting from user cgroups,
and fixes issues with systemd cgroup tracking by logind.
However this fix can lead to incorrect work for some user cgroup
controllers - so more advanced solution, that coveres such cases
will be created later.
Thanks to Fabio Erculiani (lxnay) for testing and general idea.
---
sh/rc-cgroup.sh.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index d96aa16..21f5f50 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -72,6 +72,14 @@ cgroup_set_values()
cgroup_set_limits()
{
+ # relocate starting process to the top of the cgroup
+ # it prevents from unwanted inheriting of the user
+ # cgroups. But may lead to a problems where that inheriting
+ # is needed.
+ for d in /sys/fs/cgroup/* ; do
+ echo $$ > "${d}"/tasks
+ done
+
openrc_cgroup=/sys/fs/cgroup/openrc
if [ -d "$openrc_cgroup" ]; then
cgroup="$openrc_cgroup/$RC_SVCNAME"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-16 18:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-16 18:56 UTC (permalink / raw
To: gentoo-commits
commit: 2391ddff772ce541bc2237c89a2792a0b85e076c
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Jun 25 15:50:13 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jun 25 15:58:27 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=2391ddff
cgroups: add support for systemd cgroup hierarchy
The systemd cgroup hierarchy support is being added so we can run
logind outside of systemd. This is needed because software that was
using consolekit is now migrating to logind.
We do not create this hierarchy, we just add services to it if it
exists.
---
sh/rc-cgroup.sh.in | 10 ++++++----
sh/runscript.sh.in | 4 ++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index d96aa16..afcbb03 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -70,15 +70,17 @@ cgroup_set_values()
return 0
}
-cgroup_set_limits()
+cgroup_add_service()
{
- openrc_cgroup=/sys/fs/cgroup/openrc
- if [ -d "$openrc_cgroup" ]; then
- cgroup="$openrc_cgroup/$RC_SVCNAME"
+ if [ -d "$1" ]; then
+ cgroup="$1/$RC_SVCNAME"
mkdir -p "$cgroup"
[ -f "$cgroup/tasks" ] && echo 0 > "$cgroup/tasks"
fi
+}
+cgroup_set_limits()
+{
local blkio="${rc_cgroup_blkio:-$RC_CGROUP_BLKIO}"
[ -n "$blkio" ] && cgroup_set_values blkio "$blkio"
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 58e8eac..a1ed9c6 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -209,6 +209,10 @@ sourcex -e "@SYSCONFDIR@/rc.conf"
[ -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
+ 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
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-07-16 18:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-07-16 18:56 UTC (permalink / raw
To: gentoo-commits
commit: a7a6092f015642c86ea2a545bc8f6928afcffc66
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Jul 5 16:04:45 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jul 5 16:04:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a7a6092f
cgroups: change '$$' to 0 for consistency
---
sh/rc-cgroup.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index b3bab0f..389e8a0 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -77,7 +77,7 @@ cgroup_add_service()
# cgroups. But may lead to a problems where that inheriting
# is needed.
for d in /sys/fs/cgroup/* ; do
- echo $$ > "${d}"/tasks
+ echo 0 > "${d}"/tasks
done
openrc_cgroup=/sys/fs/cgroup/openrc
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-06-24 20:46 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-06-24 20:46 UTC (permalink / raw
To: gentoo-commits
commit: 9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 2 18:49:19 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jun 16 19:22:23 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9f14fd7a
Fix quoting in cgroup-release-agent
---
sh/cgroup-release-agent.sh.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/cgroup-release-agent.sh.in b/sh/cgroup-release-agent.sh.in
index c3174fe..d6dd1e1 100644
--- a/sh/cgroup-release-agent.sh.in
+++ b/sh/cgroup-release-agent.sh.in
@@ -5,6 +5,6 @@
cgroup=/sys/fs/cgroup/openrc
PATH=/bin:/usr/bin:/sbin:/usr/sbin
-if [ -d ${cgroup}/$1 ]; then
- rmdir ${cgroup}/$1
+if [ -d ${cgroup}/"$1" ]; then
+ rmdir ${cgroup}/"$1"
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-06-24 20:46 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-06-24 20:46 UTC (permalink / raw
To: gentoo-commits
commit: dce989e96df05c0777e407b7d2cbd1c67a67f630
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sat May 25 13:37:56 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jun 16 19:14:30 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=dce989e9
cgroups: hide messages about non-existent processes
---
sh/rc-cgroup.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 81fc7d8..d96aa16 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -115,7 +115,7 @@ cgroup_cleanup()
cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
sleep 1
done
- done
+ done 2>/dev/null
done
cgroup_get_pids || { eend 0 "finished" ; return 0; }
kill -9 $pids
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-05-26 2:06 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-05-26 2:06 UTC (permalink / raw
To: gentoo-commits
commit: e451d173faeef52bd4723a50363e37e6d481521f
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun May 26 02:04:10 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun May 26 02:04:10 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e451d173
runscript.sh: run cgroup_cleanup automatically after stop
---
sh/runscript.sh.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index dcddd9b..58e8eac 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -302,7 +302,8 @@ while [ -n "$1" ]; do
then
"$1"_post || exit $?
fi
- [ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" ] && \
+ [ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
+ "$1" = "stop" ] && \
cgroup_cleanup
shift
continue 2
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-05-26 1:15 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-05-26 1:15 UTC (permalink / raw
To: gentoo-commits
commit: b5cb1f5020c1e4969b6c870f665a87606c494997
Author: Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sat May 25 13:37:56 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun May 26 00:58:08 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b5cb1f50
rc_cgroup.sh: fix typo
This fixes an incorrect variable assignment in cgroup_get_pids
---
sh/rc-cgroup.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index c057fc8..81fc7d8 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -21,7 +21,7 @@ cgroup_get_pids()
local p
pids=
while read p; do
- [ $p -eq $$ ] || $pids="${pids} ${p}"
+ [ $p -eq $$ ] || pids="${pids} ${p}"
done < /sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks
[ -n "$pids" ]
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-05-05 19:29 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-05-05 19:29 UTC (permalink / raw
To: gentoo-commits
commit: 248434329b8ffd56b02bd13629a780bfae86f9ce
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun May 5 18:47:45 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun May 5 18:47:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=24843432
fix setfont detection in early startup on Linux
Most of the time, setfont is an external command (part of the kbd
package), but it can also be a builtin if busybox is being used. This
corrects the test in early startup to work for both cases. I would like
to thank Steve L. for pointing this out.
---
sh/init-early.sh.Linux.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index ba1da98..9270e7f 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -30,7 +30,8 @@ fi
if service_present "$RC_DEFAULTLEVEL" consolefont ||
service_present "$RC_BOOTLEVEL" consolefont; then
printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null
- if [ -r "$RC_LIBEXECDIR"/console/font -a -x /usr/bin/setfont ]; then
+ if [ -r "$RC_LIBEXECDIR"/console/font ] && \
+ type setfont > /dev/null 2>&1; then
[ -c "$CONSOLE" ] && cons="-C $CONSOLE"
setfont $cons "$RC_LIBEXECDIR"/console/font 2>/dev/null
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-04-03 16:34 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-04-03 16:34 UTC (permalink / raw
To: gentoo-commits
commit: 9314ac64ead736c3e2b0d990a8b7030c16013993
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Apr 3 16:25:19 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Apr 3 16:25:19 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9314ac64
migrate-to-run: fix test for successful migration
This script originally tested the file system type for the source
location of the data we were migrating to determine if the migration was
complete. Now we test the destination, and if the softlevel file is
there the migration was successful.
Reported-by: Piotr Karbowski <piotr.karbowski <AT> gmail.com>
---
sh/migrate-to-run.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/migrate-to-run.sh.in b/sh/migrate-to-run.sh.in
index b18c541..91f49fa 100644
--- a/sh/migrate-to-run.sh.in
+++ b/sh/migrate-to-run.sh.in
@@ -4,7 +4,7 @@
. "@LIBEXECDIR@/sh/functions.sh"
-if ! mountinfo -q -f tmpfs "@LIBEXECDIR@/init.d"; then
+if [ -e /run/openrc/softlevel ]; then
einfo "The OpenRC dependency data has already been migrated."
exit 0
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-03-11 6:11 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-03-11 6:11 UTC (permalink / raw
To: gentoo-commits
commit: 274d6eee662c7f4fe0233da08247c9e40af5c382
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Mar 11 06:03:06 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 06:03:06 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=274d6eee
tmpfiles: add support for the new X line type
tmpfiles now has a new line type, X, which is similar to the x line type
used by the cleanup function.
This is not supported yet by OpenRc, because we do not have the cleanup
function in tmpfiles.sh, so I have added a dummy procedure for it so
we don't get complaints about this line type.
Reported-by: mgorny <AT> gentoo.org
X-Gentoo-Bug: 460880
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=460880
---
sh/tmpfiles.sh.in | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index ca0cbc3..f20cd0d 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -126,6 +126,16 @@ _x() {
# XXX: we don't implement this
}
+_X() {
+ # Ignore a path during cleanup. Use this type to prevent path
+ # removal as controled with the age parameter. Note that if path is
+ # a directory, the content of the directory is not excluded from
+ # clean-up, only the directory itself.
+ # Lines of this type accept shell-style globs in place of normal path names.
+ :
+ # XXX: we don't implement this
+}
+
_r() {
# Remove a file or directory if it exists. This may not be used to remove
# non-empty directories, use R for that. Lines of this type accept shell-style
@@ -263,7 +273,7 @@ for FILE in $tmpfiles_d ; do
# whine about invalid entries
case $cmd in
- f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
+ f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
\#) continue ;;
*) warninvalid ; continue ;;
esac
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-02-24 3:38 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-02-24 3:38 UTC (permalink / raw
To: gentoo-commits
commit: a82a2b5f7c4d42e4d12f066aa35708501dc8794c
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Tue Feb 12 22:09:51 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Feb 24 02:30:40 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a82a2b5f
include BINDIR and SBINDIR in the sanitized PATH
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/functions.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index 23f3f62..52a8ae7 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -49,7 +49,7 @@ _sanitize_path()
for p in $PATH; do
case "$p" in
@LIBEXECDIR@/bin|@LIBEXECDIR@/sbin);;
- @PREFIX@/bin|@PREFIX@/sbin|/usr/bin|/usr/sbin);;
+ @BINDIR@|@SBINDIR@|/usr/bin|/usr/sbin);;
@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);;
@LOCAL_PREFIX@/bin|@LOCAL_PREFIX@/sbin);;
*) path="$path${path:+:}$p";;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-02-19 22:53 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-02-19 22:53 UTC (permalink / raw
To: gentoo-commits
commit: ebf85d598e6ad2628e5d472ceeda3f86b2f0eac1
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Feb 19 22:52:49 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Feb 19 22:52:49 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ebf85d59
cgroups: fix shebang line in rc-cgroup.sh
---
sh/rc-cgroup.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 09b9b56..c9a0062 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -1,4 +1,4 @@
-#@SHELL@
+#!@SHELL@
# Copyright (c) 2012 Alexander Vershilov <qnikst@gentoo.org>
# Released under the 2-clause BSD license.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-02-17 2:49 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-02-17 2:49 UTC (permalink / raw
To: gentoo-commits
commit: cd4becf6cd9611defda298f984efa01c441723d3
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Tue Feb 12 03:13:28 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Feb 17 01:56:47 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cd4becf6
make init.sh and init-early.sh honor SYSCONFDIR
Fixes hardcoded paths that break when built with SYSCONFDIR
set to anything other than /etc/
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/init-early.sh.Linux.in | 2 +-
sh/init.sh.BSD.in | 2 +-
sh/init.sh.Linux.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index f9d2388..ba1da98 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -7,7 +7,7 @@
service_present()
{
- local p="/etc/runlevels/$1/$2"
+ local p="@SYSCONFDIR@/runlevels/$1/$2"
# fail if the file doesn't exist
[ ! -e "$p" ] && return 1
# succeed if $RC_SYS empty, can't check further, assume script will run
diff --git a/sh/init.sh.BSD.in b/sh/init.sh.BSD.in
index 25b46a4..0bd3e9b 100644
--- a/sh/init.sh.BSD.in
+++ b/sh/init.sh.BSD.in
@@ -22,7 +22,7 @@ mount_svcdir()
}
. "$RC_LIBEXECDIR"/sh/functions.sh
-[ -r /etc/rc.conf ] && . /etc/rc.conf
+[ -r "@SYSCONFDIR@/rc.conf" ] && . "@SYSCONFDIR@/rc.conf"
# Disable devd until we need it
if [ -z "$RC_SYS" -a "$RC_UNAME" = "FreeBSD" ]; then
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index ed81a9e..09bcbdb 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -4,7 +4,7 @@
# Released under the 2-clause BSD license.
. "$RC_LIBEXECDIR"/sh/functions.sh
-[ -r /etc/rc.conf ] && . /etc/rc.conf
+[ -r "@SYSCONFDIR@/rc.conf" ] && . "@SYSCONFDIR@/rc.conf"
# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-02-16 7:30 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-02-16 7:30 UTC (permalink / raw
To: gentoo-commits
commit: b46747f9981337470353014bfa34e9f9f8bace34
Author: Alexander Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 3 22:01:16 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Feb 16 07:28:35 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b46747f9
Add module for cgroup processing
sh/rc-cgroup.sh.in: new script to handle cgroup processing
sh/rc-cgroup.sh.in: do not use grep or cut (modification by William Hubbs)
sh/runscript.sh.in: use the cgroup script
---
sh/.gitignore | 1 +
sh/Makefile | 4 +-
sh/rc-cgroup.sh.in | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sh/runscript.sh.in | 26 ++++------------------
4 files changed, 67 insertions(+), 23 deletions(-)
diff --git a/sh/.gitignore b/sh/.gitignore
index a07afb3..9fe5510 100644
--- a/sh/.gitignore
+++ b/sh/.gitignore
@@ -8,6 +8,7 @@ init.sh
init-early.sh
ifwatchd-carrier.sh
ifwatchd-nocarrier.sh
+rc-cgroup.sh
udhcpc-hook.sh
tmpfiles.sh
migrate-to-run.sh
diff --git a/sh/Makefile b/sh/Makefile
index 356c37e..043b144 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -13,9 +13,9 @@ SRCS-FreeBSD=
BIN-FreeBSD=
SRCS-Linux= cgroup-release-agent.sh.in init-early.sh.in migrate-to-run.sh.in \
- udhcpc-hook.sh.in
+ rc-cgroup.sh.in udhcpc-hook.sh.in
BIN-Linux= cgroup-release-agent.sh init-early.sh migrate-to-run.sh \
- udhcpc-hook.sh
+ rc-cgroup.sh udhcpc-hook.sh
SRCS-NetBSD= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in
BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
new file mode 100644
index 0000000..09b9b56
--- /dev/null
+++ b/sh/rc-cgroup.sh.in
@@ -0,0 +1,59 @@
+#@SHELL@
+# Copyright (c) 2012 Alexander Vershilov <qnikst@gentoo.org>
+# Released under the 2-clause BSD license.
+
+cgroup_find_path()
+{
+ local OIFS n name dir result
+ [ -n "$1" ] || return 0
+ OIFS="$IFS"
+ IFS=":"
+ while read n name dir; do
+ [ "$name" = "$1" ] && result="$dir"
+ done < /proc/1/cgroup
+ IFS="$OIFS"
+ echo $result
+}
+
+# prepare values to be attached inside cgroups
+cgroup_prepare()
+{
+ local h=$(cgroup_find_path "$1")
+ cgroup="/sys/fs/cgroup/${1}${h}openrc_${RC_SVCNAME}"
+ [ -d ${cgroup} ] || mkdir -p ${cgroup}
+ return 0
+}
+
+cgroup_set_value()
+{
+ [ -f "$cgroup/${1}" -a -n "$2" ] && echo $2 > "${cgroup}/${1}"
+ return 0
+}
+
+cgroup_add_process()
+{
+ [ -f "${cgroup}"/tasks ] && echo 0 > "${cgroup}"/tasks
+ return 0
+}
+
+cgroup_set_limits()
+{
+ openrc_cgroup=/sys/fs/cgroup/openrc
+ if [ -d ${openrc_cgroup} ]; then
+ cgroup=${openrc_cgroup}/${RC_SVCNAME}
+ mkdir -p ${cgroup}
+ [ -f "${cgroup}"/tasks ] && echo 0 > "${cgroup}"/tasks
+ fi
+
+ if [ -d /sys/fs/cgroup/cpu ]; then
+ local share
+
+ share=${rc_cgroup_cpu_shares:-$RC_CGROUP_CPU_SHARES}
+ if [ -n "$share" ]; then
+ cgroup_prepare "cpu"
+ cgroup_set_value "cpu.shares" $share
+ cgroup_add_process
+ fi
+ fi
+ return 0
+}
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index f953afb..c9a3745 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -34,6 +34,7 @@ sourcex()
sourcex "@LIBEXECDIR@/sh/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
+[ "$RC_SYS" != "PREFIX" ] && sourcex -e "@LIBEXECDIR@/sh/rc-cgroup.sh"
# Support LiveCD foo
if sourcex -e "/sbin/livecd-functions.sh"; then
@@ -204,30 +205,13 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
-if [ "$RC_UNAME" = "Linux" -a "$RC_SYS" != "PREFIX" -a "$1" = "start" ]; then
- openrc_cgroup=/sys/fs/cgroup/openrc
- if [ -d ${openrc_cgroup} ]; then
- cgroup=${openrc_cgroup}/${RC_SVCNAME}
- mkdir -p ${cgroup}
- [ -f "${cgroup}"/tasks ] && echo 0 > "${cgroup}"/tasks
- fi
-
- shares="${rc_cgroup_cpu_shares:-$RC_CGROUP_CPU_SHARES}"
- if [ -n "${shares}" -a -d /sys/fs/cgroup/cpu ]; then
- cgroup=/sys/fs/cgroup/cpu/openrc_${RC_SVCNAME}
- if [ ! -d ${cgroup} ]; then
- mkdir -p ${cgroup}
- fi
- [ -f "${cgroup}"/cpu.shares ] && echo ${shares} > "${cgroup}"/cpu.shares
- [ -f "${cgroup}"/tasks ] && echo 0 >> "${cgroup}"/tasks
- fi
-
- #todo: add processes to cgroups based on settings in conf.d
-fi
-
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
+# Apply cgroups settings if defined
+[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
+ cgroup_set_limits
+
# Load our script
sourcex "$RC_SERVICE"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-01-17 3:14 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2013-01-17 3:14 UTC (permalink / raw
To: gentoo-commits
commit: 8328b8836021e638a9b18640df4eb9f64bdcc812
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 17 03:17:08 2013 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan 17 03:17:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8328b883
rc-functions.sh: add ceph to net fs list
X-Gentoo-Bug: 452552
X-Gentoo-Bug-URL: https://bugs.gentoo.org/452552
Reported-by: Tomas Mozes <hydrapolic <AT> gmail.com>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
sh/rc-functions.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 7fe1294..d52b82e 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -38,7 +38,7 @@ stop_addon()
( import_addon "$1-stop" )
}
-net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre
+net_fs_list="afs ceph cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre
ncpfs nfs nfs4 ocfs2 shfs smbfs"
is_net_fs()
{
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-01-15 18:36 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-01-15 18:36 UTC (permalink / raw
To: gentoo-commits
commit: cb31b132767db0d67941e4de022f2a21deb3ca74
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Jan 15 18:36:12 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 18:36:12 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=cb31b132
typo fix
---
sh/runscript.sh.in | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 237186a..f953afb 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -161,9 +161,9 @@ start()
stop()
{
- local startcommand="$(rc_service_get "command")"
- local startpidfile="$(rc_service_get "pidfile")"
- local startprocname="$(rc_service_get "procname")"
+ local startcommand="$(service_get_value "command")"
+ local startpidfile="$(service_get_value "pidfile")"
+ local startprocname="$(service_get_value "procname")"
command="${startcommand:-$command}"
pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2013-01-15 18:21 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2013-01-15 18:21 UTC (permalink / raw
To: gentoo-commits
commit: 6b3a4110cc0ff21631ad601d994f4c72fb5219c2
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Jan 15 18:14:05 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 18:14:05 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6b3a4110
runscript: fix stopping changed service issues
If an init script or service was upgraded while it was running and the
settings for the pid file, command and process name were changed, it
would not be possible to stop the old service.
Runscript now saves the values it used to start the service and re-uses
them to stop the service.
Reported-by: flameeyes <AT> gentoo.org
X-Gentoo-Bug: 434032
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434032
---
sh/runscript.sh.in | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 21ff39a..237186a 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -145,7 +145,12 @@ start()
${pidfile:+--pidfile} $pidfile \
$_background $start_stop_daemon_args \
-- $command_args
- eend $? "Failed to start $RC_SVCNAME" && return 0
+ if eend $? "Failed to start $RC_SVCNAME"; then
+ service_set_value "command" "${command}"
+ [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ [ -n "${procname}" ] && service_set_value "procname" "${procname}"
+ return 0
+ fi
if yesno "$start_inactive"; then
if ! $_inactive; then
mark_service_stopped
@@ -156,6 +161,12 @@ start()
stop()
{
+ local startcommand="$(rc_service_get "command")"
+ local startpidfile="$(rc_service_get "pidfile")"
+ local startprocname="$(rc_service_get "procname")"
+ command="${startcommand:-$command}"
+ pidfile="${startpidfile:-$pidfile}"
+ procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
ebegin "Stopping ${name:-$RC_SVCNAME}"
start-stop-daemon --stop \
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-12-22 15:47 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-12-22 15:47 UTC (permalink / raw
To: gentoo-commits
commit: 7bda62d844a31b5dda34706c80850027a17f03e7
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Dec 22 15:38:38 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Dec 22 15:38:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=7bda62d8
udhcpc: fix resolv.conf setting for domain
The value that was supposed to be in the domain setting was being added
incorrectly to search.
Reported-by: bug <AT> mejor.pl
X-Gentoo-Bug: 446862
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446862
---
sh/udhcpc-hook.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/udhcpc-hook.sh.in b/sh/udhcpc-hook.sh.in
index 31f5e68..0744a04 100644
--- a/sh/udhcpc-hook.sh.in
+++ b/sh/udhcpc-hook.sh.in
@@ -14,7 +14,7 @@ update_dns()
[ -z "${domain}" ] && [ -z "${dns}" ] && return
conf="# Generated by udhcpc for ${interface}\n"
- [ -n "${domain}" ] && conf="${conf}search ${domain}\n"
+ [ -n "${domain}" ] && conf="${conf}domain ${domain}\n"
for i in ${dns} ; do
conf="${conf}nameserver ${i}\n"
done
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-12-22 14:40 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-12-22 14:40 UTC (permalink / raw
To: gentoo-commits
commit: b00f85864dffd6de406e109e74372618ced71312
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Dec 22 14:15:50 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Dec 22 14:37:45 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b00f8586
Set a default size for /run on Linux
Reported-by: alpiturchi <AT> gmail.com
X-Gentoo-Bug: 447076
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=447076
---
sh/init.sh.Linux.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 0eca736..ed81a9e 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -57,7 +57,7 @@ elif ! mountinfo -q /run; then
ebegin "Mounting /run"
rc=0
if ! fstabinfo --mount /run; then
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ mount -t tmpfs -o mode=0755,nosuid,nodev,size=10% tmpfs /run
rc=$?
fi
if [ $rc != 0 ]; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-12-19 17:43 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-12-19 17:43 UTC (permalink / raw
To: gentoo-commits
commit: b44f96ac9bb6427c41480cc6ef2beb1818ca4f93
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Dec 19 17:20:08 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Dec 19 17:42:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b44f96ac
init.sh.Linux: do not try to remove the /run/openrc symlink
In order to make migration from /lib*/rc/init.d to /run/openrc possible
without rebooting, the migration script creates a symlink from
/run/openrc to /lib*/rc/init.d. We were trying to remove it on the next
reboot, but this is not possible since / is ro when /run is mounted.
Reported-by: fturco <AT> fastmail.fm
X-Gentoo-Bug: 447678
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=447678
---
sh/init.sh.Linux.in | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 9b13aad..0eca736 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -51,10 +51,6 @@ if [ ! -d /run ]; then
fi
fi
-if [ -L /run/openrc ]; then
- rm /run/openrc
-fi
-
if [ "$sys" = VSERVER ]; then
rm -rf /run/*
elif ! mountinfo -q /run; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-12-07 15:48 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-12-07 15:48 UTC (permalink / raw
To: gentoo-commits
commit: 230a678824811fe73e308b9a41697ae80df21611
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Dec 7 15:39:12 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Dec 7 15:39:12 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=230a6788
init-linux: Do not remove the $rc_libexecdir/init.d directory
Reported-by: toralf.foerster <AT> gmx.de
X-Gentoo-Bug: 446342
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446342
---
sh/init.sh.Linux.in | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index f45eae1..9b13aad 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -88,9 +88,5 @@ if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
-if [ -e "$RC_LIBEXECDIR"/init.d ]; then
- rm -rf "$RC_LIBEXECDIR"/init.d
-fi
-
echo sysinit >"$RC_SVCDIR"/softlevel
exit 0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-12-06 22:51 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-12-06 22:51 UTC (permalink / raw
To: gentoo-commits
commit: e5173b9127a42b7c6a209c278fbbcbcd29dcdccc
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Dec 6 22:43:24 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Dec 6 22:43:24 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e5173b91
migrate-to-run: do not require a reboot
The script that migrates the @libexecdir <AT> /rc/init.d directory to
/run/openrc should not require a reboot.
Reported-by: chainsaw <AT> gentoo.org
---
sh/init.sh.Linux.in | 8 ++++++++
sh/migrate-to-run.sh.in | 37 +++++++++----------------------------
2 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 0eca736..f45eae1 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -51,6 +51,10 @@ if [ ! -d /run ]; then
fi
fi
+if [ -L /run/openrc ]; then
+ rm /run/openrc
+fi
+
if [ "$sys" = VSERVER ]; then
rm -rf /run/*
elif ! mountinfo -q /run; then
@@ -84,5 +88,9 @@ if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
+if [ -e "$RC_LIBEXECDIR"/init.d ]; then
+ rm -rf "$RC_LIBEXECDIR"/init.d
+fi
+
echo sysinit >"$RC_SVCDIR"/softlevel
exit 0
diff --git a/sh/migrate-to-run.sh.in b/sh/migrate-to-run.sh.in
index 73978e7..b18c541 100644
--- a/sh/migrate-to-run.sh.in
+++ b/sh/migrate-to-run.sh.in
@@ -11,38 +11,19 @@ fi
if [ ! -d /run ]; then
eerror "/run is not a directory."
- eerror "This means the OpenRC dependency data cannot be migrated."
- eerror "Please create the /run directory and reboot the system."
- exit 1
+ eerror "moving /run to /run.pre-openrc"
+ mv /run /run.pre-openrc
+ mkdir /run
fi
-if ! mountinfo -q -f tmpfs /run; then
- for x in /run/.* /run/*; do
- case "$x" in
- /run/.|/run/..)
- continue
- ;;
- esac
- if [ -e "$x" ]; then
- eerror "Your /run directory contains files."
- eerror "Please reboot the system."
- exit 1
- fi
- done
+rm -rf /run/openrc
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run 2> /dev/null
- if [ $? != 0 ]; then
- eerror "Unable to mount a tmpfs on /run."
- eerror "This means the OpenRC dependency data cannot be migrated."
- eerror "Please create the /run directory and reboot the system."
- exit 1
- fi
+if ! mountinfo -q -f tmpfs /run; then
+ ln -s "@LIBEXECDIR@"/init.d /run/openrc
+else
+ cp -a "@LIBEXECDIR@/init.d" /run/openrc
+ rc-update -u
fi
-rm -rf /run/openrc
-cp -a "@LIBEXECDIR@/init.d" /run/openrc
-rc-update -u
-umount "@LIBEXECDIR@/init.d"
-rm -rf "@LIBEXECDIR@/init.d"
einfo "The OpenRC dependency data was migrated successfully."
exit 0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-11-26 3:45 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-11-26 3:45 UTC (permalink / raw
To: gentoo-commits
commit: 0a72893c8b02e70a51e7ee0148a3fe586a82cd9d
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Nov 26 03:27:36 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Nov 26 03:27:36 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=0a72893c
migrate-to-run: Remove old RC_SVCDIR after unmounting tmpfs
reporrrrted-by: netfab <AT> gmail.com
X-Gentoo-Bug: 443996
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=443996
---
sh/migrate-to-run.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/migrate-to-run.sh.in b/sh/migrate-to-run.sh.in
index aa31c62..6689f88 100644
--- a/sh/migrate-to-run.sh.in
+++ b/sh/migrate-to-run.sh.in
@@ -43,7 +43,7 @@ fi
rm -rf "@PREFIX@/run/openrc"
cp -a "@LIBEXECDIR@/init.d" "@PREFIX@/run/openrc"
rc-update -u
-rm -rf "@LIBEXECDIR@/init.d"
umount "@LIBEXECDIR@/init.d"
+rm -rf "@LIBEXECDIR@/init.d"
einfo "The OpenRC dependency data was migrated successfully."
exit 0
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-11-06 22:41 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-11-06 22:41 UTC (permalink / raw
To: gentoo-commits
commit: ec60e20331c7becd1b46ca38291f4c75db25e168
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Nov 6 22:32:59 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Nov 6 22:32:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ec60e203
tmpfiles: fix bashism
reported-by: <pesa <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index a5041bb..ca0cbc3 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -232,7 +232,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
exit 1
fi
-if [ "$CREATE$REMOVE" == '00' ]; then
+if [ "$CREATE$REMOVE" = '00' ]; then
printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-11-05 21:25 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-11-05 21:25 UTC (permalink / raw
To: gentoo-commits
commit: 4936b72e0f0d20168473df9a4598b8159245d45b
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 5 21:25:32 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Nov 5 21:25:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=4936b72e
tmpfilesd: Doing both create+remove at the same time is valid.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index ae7b7ca..a5041bb 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -232,7 +232,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
exit 1
fi
-if [ $(( CREATE + REMOVE )) -ne 1 ] ; then
+if [ "$CREATE$REMOVE" == '00' ]; then
printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-10-22 0:53 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-10-22 0:53 UTC (permalink / raw
To: gentoo-commits
commit: 525c731f0e4d8975ba692016202ef92e470c6fdf
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Thu Oct 11 18:34:20 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 22 00:50:54 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=525c731f
tmpfilesd: parse arguments with spaces
systemd allows the final arg in tmpfiles to contain spaces. Using the read()
call to set the variables includes all trailing components in $arg so it
doesn't get cut off.
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/tmpfiles.sh.in | 32 ++++++++++----------------------
1 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 57cedbe..ae7b7ca 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -253,46 +253,34 @@ for FILE in $tmpfiles_d ; do
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
- while read line; do
+ while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
- # This will skip over comments and empty lines
- set -- $line
-
# Unless we have both command and path, skip this line.
- if [ -z "$1" -o -z "$2" ]; then
+ if [ -z "$cmd" -o -z "$path" ]; then
continue
fi
# whine about invalid entries
- case $1 in
+ case $cmd in
f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
\#) continue ;;
*) warninvalid ; continue ;;
esac
- cmd=$1
- path=$2
-
# fall back on defaults when parameters are passed as '-'
- if [ "$3" = '-' -o "$3" = '' ]; then
- case ${1} in
+ if [ "$mode" = '-' -o "$mode" = '' ]; then
+ case "$cmd" in
p|f|F) mode=0644 ;;
d|D) mode=0755 ;;
z|Z|x|r|R|L) ;;
esac
- else
- mode=$3
fi
- uid=$4
- gid=$5
- age=$6
- arg=$7
-
- [ "${4}" = '-' -o "${4}" = '' ] && uid=0
- [ "${5}" = '-' -o "${5}" = '' ] && gid=0
- [ "${6}" = '-' -o "${6}" = '' ] && age=0
- [ "${7}" = '-' -o "${7}" = '' ] && arg=''
+
+ [ "$uid" = '-' -o "$uid" = '' ] && uid=0
+ [ "$gid" = '-' -o "$gid" = '' ] && gid=0
+ [ "$age" = '-' -o "$age" = '' ] && age=0
+ [ "$arg" = '-' -o "$arg" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-10-22 0:53 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-10-22 0:53 UTC (permalink / raw
To: gentoo-commits
commit: 5647946e61380c9f917828440d4c6e5bd8796f56
Author: Andrew Gregory <andrew.gregory.8 <AT> gmail <DOT> com>
AuthorDate: Thu Oct 11 18:34:19 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 22 00:49:42 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=5647946e
tmpfiles: return success from _f/_F on empty $arg
'[ -n "$arg" ] && _w' causes _f/_F to return the failure from the test when
$arg is empty. Inverting the test causes the test and _f/_F to return success.
Signed-off-by: Andrew Gregory <andrew.gregory.8 <AT> gmail.com>
---
sh/tmpfiles.sh.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 2486da2..57cedbe 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -61,7 +61,7 @@ _f() {
if [ ! -e "$path" ]; then
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
- [ -n "$arg" ] && _w "$@"
+ [ -z "$arg" ] || _w "$@"
fi
}
@@ -72,7 +72,7 @@ _F() {
[ $CREATE -gt 0 ] || return 0
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
- [ -n "$arg" ] && _w "$@"
+ [ -z "$arg" ] || _w "$@"
}
_d() {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-10-21 19:51 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-10-21 19:51 UTC (permalink / raw
To: gentoo-commits
commit: 74c6b554bcdbed5e41c9d6dde16bf636bfa8a758
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Oct 21 19:45:45 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Oct 21 19:50:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=74c6b554
tmpfiles: do not process systemd.conf
This file contains definitions specific to systemd, so we should not
process it.
Reported-by: <andrew.gregory.8 <AT> gmail.com>
---
sh/tmpfiles.sh.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index a341845..2486da2 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -201,6 +201,7 @@ tmpfiles_d=''
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
for d in ${tmpfiles_dirs} ; do
[ -d $d ] && for f in ${d}/*.conf ; do
+ [ "$f" = "$d/systemd.conf" ] && continue
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
done # for f in ${d}
done # for d in ${tmpfiles_dirs}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-10-17 23:19 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-10-17 23:19 UTC (permalink / raw
To: gentoo-commits
commit: f88637274991e4d427da6dae3ef0e181f0e1d9a1
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Oct 17 22:55:02 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Oct 17 22:55:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f8863727
functions.sh: do not hard code path in e* wrapper functions
We should use the "command" shell builtin to execute a binary from
within the wrapper with the same name. Hard coding the path to the
binary makes our test suite fail.
---
sh/functions.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index b00ec68..cdd8856 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -105,7 +105,7 @@ else
# the last ecmd
for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \
vebegin veend veinfo vewarn vewend; do
- eval "$_e() { local _r; @LIBEXECDIR@/bin/$_e \"\$@\"; _r=\$?; \
+ eval "$_e() { local _r; command $_e \"\$@\"; _r=\$?; \
export EINFO_LASTCMD=$_e; return \$_r; }"
done
unset _e
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-09-26 22:12 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-09-26 22:12 UTC (permalink / raw
To: gentoo-commits
commit: 5c736ad63e65949f7488474cc08cf3c8f2e7b0f9
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 26 22:13:16 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Sep 26 22:14:04 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=5c736ad6
sh/tmpfiles.sh: Improve dry-run mode.
Dry-run with more detail is more useful this way.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 60 +++++++++++++++++++++++++++++++++++-----------------
1 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 1460bdf..64f93de 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -13,21 +13,29 @@
# This script should match the manpage as of 2012/03/12
#
+DRYRUN=0
+
warninvalid() {
printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
error=$(( error+1 ))
} >&2
+dryrun_or_real() {
+ local dryrun=
+ [ $DRYRUN -eq 1 ] && dryrun=echo
+ $dryrun "$@"
+}
+
relabel() {
local path
local paths=$1 mode=$2 uid=$3 gid=$4
for path in ${paths}; do
if [ -e "$path" ]; then
- [ $uid != '-' ] && chown $CHOPTS "$uid" "$path"
- [ $gid != '-' ] && chgrp $CHOPTS "$gid" "$path"
- [ $mode != '-' ] && chmod $CHOPTS "$mode" "$path"
- [ -x /sbin/restorecon ] && restorecon $CHOPTS "$path"
+ [ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
+ [ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
+ [ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
+ [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
fi
done
}
@@ -35,13 +43,13 @@ relabel() {
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && mknod $path b ${arg%:*} ${arg#*:}
+ [ ! -e "$path" ] && dryrun_or_real mknod $path b ${arg%:*} ${arg#*:}
}
_c() {
# Create a character device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && mknod $path c ${arg%:*} ${arg#*:}
+ [ ! -e "$path" ] && dryrun_or_real mknod $path c ${arg%:*} ${arg#*:}
}
@@ -52,7 +60,7 @@ _f() {
[ $CREATE -gt 0 ] || return 0
if [ ! -e "$path" ]; then
- install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
[ -n "$arg" ] && _w "$@"
fi
}
@@ -63,7 +71,7 @@ _F() {
[ $CREATE -gt 0 ] || return 0
- install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
[ -n "$arg" ] && _w "$@"
}
@@ -74,7 +82,7 @@ _d() {
[ $CREATE -gt 0 ] || return 0
if [ ! -d "$path" ]; then
- install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
fi
}
@@ -83,18 +91,18 @@ _D() {
local path=$1 mode=$2 uid=$3 gid=$4
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
- find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
+ dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
fi
if [ $CREATE -gt 0 ]; then
- install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
fi
}
_L() {
# Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ ! -e "$path" ] && ln -s "$args" "$path"
+ [ ! -e "$path" ] && dryrun_or_real ln -s "$args" "$path"
}
_p() {
@@ -104,8 +112,8 @@ _p() {
[ $CREATE -gt 0 ] || return 0
if [ ! -p "$path" ]; then
- mkfifo -m$mode "$path"
- chown "$uid:$gid" "$path"
+ dryrun_or_real mkfifo -m$mode "$path"
+ dryrun_or_real chown "$uid:$gid" "$path"
fi
}
@@ -129,9 +137,9 @@ _r() {
for path in ${paths}; do
if [ -f "$path" ]; then
- rm -f "$path"
+ dryrun_or_real rm -f "$path"
elif [ -d "$path" ]; then
- rmdir "$path"
+ dryrun_or_real rmdir "$path"
fi
done
}
@@ -145,14 +153,20 @@ _R() {
[ $REMOVE -gt 0 ] || return 0
for path in ${paths}; do
- [ -d "$path" ] && rm -rf --one-file-system "$path"
+ [ -d "$path" ] && dryrun_or_real rm -rf --one-file-system "$path"
done
}
_w() {
# Write the argument parameter to a file, if it exists.
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
- [ -f "$path" ] && echo "$arg" >>"$path"
+ if [ -f "$path" ]; then
+ if [ $DRYRUN -eq 1 ]; then
+ echo "echo \"$arg\" >>\"$path\""
+ else
+ echo "$arg" >>"$path"
+ fi
+ fi
}
_z() {
@@ -212,6 +226,11 @@ while [ $# -gt 0 ]; do
shift
done
+if [ $(( CLEAN )) -eq 1 ] ; then
+ printf '%s clean mode is not implemented\n' "${0##*/}"
+ exit 1
+fi
+
if [ $(( CREATE + REMOVE )) -ne 1 ] ; then
printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
@@ -247,6 +266,7 @@ for FILE in $tmpfiles_d ; do
# whine about invalid entries
case $1 in
f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
+ \#) continue ;;
*) warninvalid ; continue ;;
esac
@@ -275,9 +295,9 @@ for FILE in $tmpfiles_d ; do
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
+ _$cmd "$@"
+ rc=$?
if [ "${DRYRUN}" -eq "0" ]; then
- _$cmd "$@"
- rc=$?
[ $rc -ne 0 ] && error=$((error + 1))
fi
done <$FILE
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-08-16 18:45 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-08-16 18:45 UTC (permalink / raw
To: gentoo-commits
commit: c8703354e36d85468e4b336371be424b76a68726
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 16 18:44:47 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu Aug 16 18:45:23 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c8703354
sh/tmpfiles: fix quoting for optional arguments
Some optional arguments were missing quotes in the tests, so produced
spurious warnings.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index de81964..1460bdf 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -268,10 +268,10 @@ for FILE in $tmpfiles_d ; do
age=$6
arg=$7
- [ ${4} = '-' ] && uid=0
- [ ${5} = '-' ] && gid=0
- [ ${6} = '-' ] && age=0
- [ ${7} = '-' ] && arg=''
+ [ "${4}" = '-' -o "${4}" = '' ] && uid=0
+ [ "${5}" = '-' -o "${5}" = '' ] && gid=0
+ [ "${6}" = '-' -o "${6}" = '' ] && age=0
+ [ "${7}" = '-' -o "${7}" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-07-02 18:27 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-07-02 18:27 UTC (permalink / raw
To: gentoo-commits
commit: a5b4fab7321c4feac2bc981b7fbf4b32bb5bb981
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 2 18:22:04 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 2 18:22:04 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a5b4fab7
fix handling of /run for vserver
Mount can't be used in vservers, but /run is still needed. So we create
the directory and clear it out instead of mounting a tmpfs in that
situation.
reported-by: <patrick <AT> gentoo.org>
X-Gentoo-Bug: 423739
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=423739
---
sh/init.sh.Linux.in | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 5daa1bb..0eca736 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -37,14 +37,23 @@ fi
# /run is a new directory for storing volatile runtime data.
# Read more about /run at https://lwn.net/Articles/436012
+sys="$(rc --sys)"
+
if [ ! -d /run ]; then
- eerror "The /run directory does not exist. Unable to continue."
- return 1
+ if [ "$sys" = VSERVER ]; then
+ if [ -e /run ]; then
+ rm -rf /run
+ fi
+ mkdir /run
+ else
+ eerror "The /run directory does not exist. Unable to continue."
+ return 1
+ fi
fi
-if mountinfo -q /run; then
- einfo "/run is already mounted, skipping"
-else
+if [ "$sys" = VSERVER ]; then
+ rm -rf /run/*
+elif ! mountinfo -q /run; then
ebegin "Mounting /run"
rc=0
if ! fstabinfo --mount /run; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-05-16 22:00 Christian Ruppert
0 siblings, 0 replies; 148+ messages in thread
From: Christian Ruppert @ 2012-05-16 22:00 UTC (permalink / raw
To: gentoo-commits
commit: 6cecc7b4a6bd2fed40006d85f3ea855723c93840
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 22:00:22 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Wed May 16 22:00:22 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6cecc7b4
local is only allowed in functions
---
sh/migrate-to-run.sh.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/sh/migrate-to-run.sh.in b/sh/migrate-to-run.sh.in
index f296a5c..aa31c62 100644
--- a/sh/migrate-to-run.sh.in
+++ b/sh/migrate-to-run.sh.in
@@ -17,7 +17,6 @@ if [ ! -d "@PREFIX@/run" ]; then
fi
if ! mountinfo -q -f tmpfs "@PREFIX@/run"; then
- local x
for x in "@PREFIX@/run/."* "@PREFIX@/run/"*; do
case "$x" in
"@PREFIX@/run/."|"@PREFIX@/run/..")
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-05-02 19:50 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-05-02 19:50 UTC (permalink / raw
To: gentoo-commits
commit: 9e196a71ad7f4e7a8ae51ab29e9b34c0af9a2595
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed May 2 19:48:52 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed May 2 19:48:52 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9e196a71
clarify the message about /proc being already mounted
This message was being taken by some users as an error, so I have
removed the part about "skipping..." Hopefully this will make the
message less alarming.
---
sh/init.sh.Linux.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index f86c5f2..176dba7 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -75,7 +75,7 @@ if [ -e $f ]; then
if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
eerror "You have cruft in /proc that should be deleted"
else
- einfo "/proc is already mounted, skipping"
+ einfo "/proc is already mounted"
mountproc=false
fi
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-04-26 17:59 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-04-26 17:59 UTC (permalink / raw
To: gentoo-commits
commit: 8c82637e76dcc6a076bdc5e17c142ec8999364a1
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 26 17:56:44 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Apr 26 17:56:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8c82637e
fix references to functions.sh
There were a couple of places where we were sourcing functions.sh in
@SYSCONFDIR <AT> /init.d. This is only a backward compatibility symlink, so
it should not be used for openrc. The correct place to source this from
is @LIBEXECDIR@/sh.
---
sh/gendepends.sh.in | 2 +-
sh/runscript.sh.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in
index 8858bac..8dab3c2 100644
--- a/sh/gendepends.sh.in
+++ b/sh/gendepends.sh.in
@@ -4,7 +4,7 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
-. @SYSCONFDIR@/init.d/functions.sh
+. @LIBEXECDIR@/sh/functions.sh
. @LIBEXECDIR@/sh/rc-functions.sh
config() {
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index bc93b51..6ad2ded 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -32,7 +32,7 @@ sourcex()
fi
}
-sourcex "@SYSCONFDIR@/init.d/functions.sh"
+sourcex "@LIBEXECDIR@/sh/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
# Support LiveCD foo
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-04-26 17:21 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-04-26 17:21 UTC (permalink / raw
To: gentoo-commits
commit: 8d63719418de14248bb4bd3b4a0ce5599f8f3092
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 26 17:19:42 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Apr 26 17:19:42 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8d637194
Change the working directory for depend only
We already have a special case for depend processing, so we should
change the working directory there only. This prevents us from forcing
all init scripts to be run in the init directory.
---
sh/runscript.sh.in | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index a4d9e7c..bc93b51 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -174,10 +174,6 @@ status()
yesno $RC_DEBUG && set -x
-# Enter the dir of the init script to fix the globbing with e.g. depend()
-# bug 412677
-cd ${RC_SERVICE%/*}
-
_conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
_c=${RC_SVCNAME%%.*}
@@ -237,7 +233,12 @@ while [ -n "$1" ]; do
# Special case depend
if [ "$1" = depend ]; then
shift
+
+ # Enter the dir of the init script to fix the globbing
+ # bug 412677
+ cd ${RC_SERVICE%/*}
_depend
+ cd /
continue
fi
# See if we have the required function and run it
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-04-26 17:12 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-04-26 17:12 UTC (permalink / raw
To: gentoo-commits
commit: 3967077da3901b4f10d71dec1ee977af36fae956
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 26 17:11:58 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Apr 26 17:11:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=3967077d
Revert "Revert "Let runscript enter the service dir before expand globs""
This reverts commit f971c4c0b5e45500f1255f2e076f2c101d2f9281.
After further discussion, this is a good first step toward a fix, so I
am putting it back.
---
sh/runscript.sh.in | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 15cdb86..a4d9e7c 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -174,6 +174,10 @@ status()
yesno $RC_DEBUG && set -x
+# Enter the dir of the init script to fix the globbing with e.g. depend()
+# bug 412677
+cd ${RC_SERVICE%/*}
+
_conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
_c=${RC_SVCNAME%%.*}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-04-26 16:28 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-04-26 16:28 UTC (permalink / raw
To: gentoo-commits
commit: f971c4c0b5e45500f1255f2e076f2c101d2f9281
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 26 16:28:02 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Apr 26 16:28:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f971c4c0
Revert "Let runscript enter the service dir before expand globs"
This reverts commit 9d0dce35c3e46b4515499f3f0f1c47645be0bc48.
This is being reverted due to the fix still being under discussion.
---
sh/runscript.sh.in | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index a4d9e7c..15cdb86 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -174,10 +174,6 @@ status()
yesno $RC_DEBUG && set -x
-# Enter the dir of the init script to fix the globbing with e.g. depend()
-# bug 412677
-cd ${RC_SERVICE%/*}
-
_conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
_c=${RC_SVCNAME%%.*}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-03-12 19:05 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-03-12 19:05 UTC (permalink / raw
To: gentoo-commits
commit: 65be94a34a60c5c09e40aa85b65820a1b792f91f
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 12 18:59:53 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Mar 12 19:04:30 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=65be94a3
sh/tmpfiles: Upstream clarifications & quoting fixes.
Upstream has clarified via IRC:
- hardcoding /usr/lib/ is an explicit choice. It should NOT consider
$libdir at all.
- The z/Z relabel types should call restorecon, not chcon.
- Whitespace is not allowed in tmpfiles.d/*.conf path entries,
but is allowed in globs results. Fixed quoting of path arguments for
this.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/tmpfiles.sh.in | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 9c73897..de81964 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -19,17 +19,19 @@ warninvalid() {
} >&2
relabel() {
+ local path
local paths=$1 mode=$2 uid=$3 gid=$4
for path in ${paths}; do
- if [ -e $path ]; then
+ if [ -e "$path" ]; then
[ $uid != '-' ] && chown $CHOPTS "$uid" "$path"
[ $gid != '-' ] && chgrp $CHOPTS "$gid" "$path"
[ $mode != '-' ] && chmod $CHOPTS "$mode" "$path"
- # TODO: SELinux relabel
+ [ -x /sbin/restorecon ] && restorecon $CHOPTS "$path"
fi
done
}
+
_b() {
# Create a block device node if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
@@ -49,7 +51,7 @@ _f() {
[ $CREATE -gt 0 ] || return 0
- if [ ! -e $path ]; then
+ if [ ! -e "$path" ]; then
install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
[ -n "$arg" ] && _w "$@"
fi
@@ -80,7 +82,7 @@ _D() {
# Create or empty a directory
local path=$1 mode=$2 uid=$3 gid=$4
- if [ -d $path ] && [ $REMOVE -gt 0 ]; then
+ if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
fi
@@ -125,10 +127,10 @@ _r() {
[ $REMOVE -gt 0 ] || return 0
- for path in "${paths}"; do
- if [ -f $path ]; then
+ for path in ${paths}; do
+ if [ -f "$path" ]; then
rm -f "$path"
- elif [ -d $path ]; then
+ elif [ -d "$path" ]; then
rmdir "$path"
fi
done
@@ -142,8 +144,8 @@ _R() {
[ $REMOVE -gt 0 ] || return 0
- for path in "${paths}"; do
- [ -d $path ] && rm -rf --one-file-system "$path"
+ for path in ${paths}; do
+ [ -d "$path" ] && rm -rf --one-file-system "$path"
done
}
@@ -174,9 +176,8 @@ _Z() {
CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
FILE=
fragments=
-# TODO: The systemd spec explicitly says /usr/lib/, but it should probably be
-# OUTSIDE of lib entirely, or at the very least handle multilib systems better.
-tmpfiles_dirs='/usr/lib64/tmpfiles.d/ /usr/lib/tmpfiles.d/ /etc/tmpfiles.d/ /run/tmpfiles.d/'
+# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
+tmpfiles_dirs='/usr/lib/tmpfiles.d/ /etc/tmpfiles.d/ /run/tmpfiles.d/'
tmpfiles_basenames=''
tmpfiles_d=''
# Build a list of sorted unique basenames
@@ -212,7 +213,7 @@ while [ $# -gt 0 ]; do
done
if [ $(( CREATE + REMOVE )) -ne 1 ] ; then
- printf 'usage: %s [--create] [--remove]\n' "${0##*/}"
+ printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
@@ -230,14 +231,15 @@ for FILE in $tmpfiles_d ; do
# d /run/user 0755 root root 10d -
# Mode, UID, GID, Age, Argument may be omitted!
- # TODO: Sorry, we don't handle whitespace in paths.
+ # XXX: Upstream says whitespace is NOT permitted in the Path argument.
+ # But IS allowed when globs are expanded for the x/r/R/z/Z types.
while read line; do
LINENUM=$(( LINENUM+1 ))
- # This will fix up whitespace and comment lines
- # skip over comments and empty lines
+ # This will skip over comments and empty lines
set -- $line
+ # Unless we have both command and path, skip this line.
if [ -z "$1" -o -z "$2" ]; then
continue
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-03-12 8:38 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-03-12 8:38 UTC (permalink / raw
To: gentoo-commits
commit: c75352af3d787377c4aa62baa1331f37db3d1d97
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 12 08:28:44 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Mar 12 08:37:31 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c75352af
sh/tmpfiles: tmpfiles.d support.
This is the baseline support for tmpfiles.d.
Still missing:
- SELinux relabel, pending upstream clarification
- LIBDIR vs multilib systems, pending upstream clarification
- Whitespace in paths?
- Clean support not implemented
- "x" exclude type not implemented
X-Gentoo-Bug: 396003
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=396003
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/.gitignore | 1 +
sh/Makefile | 4 +-
sh/tmpfiles.sh.in | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 289 insertions(+), 2 deletions(-)
diff --git a/sh/.gitignore b/sh/.gitignore
index f67b992..3f6ef3f 100644
--- a/sh/.gitignore
+++ b/sh/.gitignore
@@ -9,3 +9,4 @@ init-early.sh
ifwatchd-carrier.sh
ifwatchd-nocarrier.sh
udhcpc-hook.sh
+tmpfiles.sh
diff --git a/sh/Makefile b/sh/Makefile
index 15b24d0..4df8fde 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -1,8 +1,8 @@
DIR= ${LIBEXECDIR}/sh
SRCS= init.sh.in functions.sh.in gendepends.sh.in init-common-post.sh.in \
- rc-functions.sh.in runscript.sh.in ${SRCS-${OS}}
+ rc-functions.sh.in runscript.sh.in tmpfiles.sh.in ${SRCS-${OS}}
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
-BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}}
+BIN= gendepends.sh init.sh runscript.sh tmpfiles.sh ${BIN-${OS}}
INSTALLAFTER= _installafter
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
new file mode 100755
index 0000000..9c73897
--- /dev/null
+++ b/sh/tmpfiles.sh.in
@@ -0,0 +1,286 @@
+#!/bin/sh
+# This is a reimplementation of the systemd tmpfiles.d code
+# Control creation, deletion, and cleaning of volatile and temporary files
+#
+# Copyright (c) 2012 Gentoo Foundation
+#
+# This instance based on the Arch Linux version:
+# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
+# As of 2012/01/01
+#
+# See the tmpfiles.d manpage as well:
+# http://0pointer.de/public/systemd-man/tmpfiles.d.html
+# This script should match the manpage as of 2012/03/12
+#
+
+warninvalid() {
+ printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
+ error=$(( error+1 ))
+} >&2
+
+relabel() {
+ local paths=$1 mode=$2 uid=$3 gid=$4
+
+ for path in ${paths}; do
+ if [ -e $path ]; then
+ [ $uid != '-' ] && chown $CHOPTS "$uid" "$path"
+ [ $gid != '-' ] && chgrp $CHOPTS "$gid" "$path"
+ [ $mode != '-' ] && chmod $CHOPTS "$mode" "$path"
+ # TODO: SELinux relabel
+ fi
+ done
+}
+_b() {
+ # Create a block device node if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+ [ ! -e "$path" ] && mknod $path b ${arg%:*} ${arg#*:}
+}
+
+_c() {
+ # Create a character device node if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+ [ ! -e "$path" ] && mknod $path c ${arg%:*} ${arg#*:}
+}
+
+
+_f() {
+ # Create a file if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+
+ [ $CREATE -gt 0 ] || return 0
+
+ if [ ! -e $path ]; then
+ install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ [ -n "$arg" ] && _w "$@"
+ fi
+}
+
+_F() {
+ # Create or truncate a file
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+
+ [ $CREATE -gt 0 ] || return 0
+
+ install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
+ [ -n "$arg" ] && _w "$@"
+}
+
+_d() {
+ # Create a directory if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4
+
+ [ $CREATE -gt 0 ] || return 0
+
+ if [ ! -d "$path" ]; then
+ install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ fi
+}
+
+_D() {
+ # Create or empty a directory
+ local path=$1 mode=$2 uid=$3 gid=$4
+
+ if [ -d $path ] && [ $REMOVE -gt 0 ]; then
+ find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
+ fi
+
+ if [ $CREATE -gt 0 ]; then
+ install -d -m"$mode" -o"$uid" -g"$gid" "$path"
+ fi
+}
+
+_L() {
+ # Create a symlink if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+ [ ! -e "$path" ] && ln -s "$args" "$path"
+}
+
+_p() {
+ # Create a named pipe (FIFO) if it doesn't exist yet
+ local path=$1 mode=$2 uid=$3 gid=$4
+
+ [ $CREATE -gt 0 ] || return 0
+
+ if [ ! -p "$path" ]; then
+ mkfifo -m$mode "$path"
+ chown "$uid:$gid" "$path"
+ fi
+}
+
+_x() {
+ # Ignore a path during cleaning. Use this type to exclude paths from clean-up as
+ # controlled with the Age parameter. Note that lines of this type do not
+ # influence the effect of r or R lines. Lines of this type accept shell-style
+ # globs in place of of normal path names.
+ :
+ # XXX: we don't implement this
+}
+
+_r() {
+ # Remove a file or directory if it exists. This may not be used to remove
+ # non-empty directories, use R for that. Lines of this type accept shell-style
+ # globs in place of normal path names.
+ local path
+ local paths=$1
+
+ [ $REMOVE -gt 0 ] || return 0
+
+ for path in "${paths}"; do
+ if [ -f $path ]; then
+ rm -f "$path"
+ elif [ -d $path ]; then
+ rmdir "$path"
+ fi
+ done
+}
+
+_R() {
+ # Recursively remove a path and all its subdirectories (if it is a directory).
+ # Lines of this type accept shell-style globs in place of normal path names.
+ local path
+ local paths=$1
+
+ [ $REMOVE -gt 0 ] || return 0
+
+ for path in "${paths}"; do
+ [ -d $path ] && rm -rf --one-file-system "$path"
+ done
+}
+
+_w() {
+ # Write the argument parameter to a file, if it exists.
+ local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
+ [ -f "$path" ] && echo "$arg" >>"$path"
+}
+
+_z() {
+ # Set ownership, access mode and relabel security context of a file or
+ # directory if it exists. Lines of this type accept shell-style globs in
+ # place of normal path names.
+ [ $CREATE -gt 0 ] || return 0
+
+ relabel "$@"
+}
+
+_Z() {
+ # Recursively set ownership, access mode and relabel security context of a
+ # path and all its subdirectories (if it is a directory). Lines of this type
+ # accept shell-style globs in place of normal path names.
+ [ $CREATE -gt 0 ] || return 0
+
+ CHOPTS=-R relabel "$@"
+}
+
+CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
+FILE=
+fragments=
+# TODO: The systemd spec explicitly says /usr/lib/, but it should probably be
+# OUTSIDE of lib entirely, or at the very least handle multilib systems better.
+tmpfiles_dirs='/usr/lib64/tmpfiles.d/ /usr/lib/tmpfiles.d/ /etc/tmpfiles.d/ /run/tmpfiles.d/'
+tmpfiles_basenames=''
+tmpfiles_d=''
+# Build a list of sorted unique basenames
+# directories declared later in the tmpfiles_d array will override earlier
+# directories, on a per file basename basis.
+# `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
+# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
+for d in ${tmpfiles_dirs} ; do
+ [ -d $d ] && for f in ${d}/*.conf ; do
+ [ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
+ done # for f in ${d}
+done # for d in ${tmpfiles_dirs}
+tmpfiles_basenames="`printf "${tmpfiles_basenames}\n" | sort | uniq`"
+
+for b in $tmpfiles_basenames ; do
+ real_f=''
+ for d in $tmpfiles_dirs ; do
+ f=${d}/${b}
+ [ -f "${f}" ] && real_f=$f
+ done
+ [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
+done
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --create) CREATE=1 ;;
+ --remove) REMOVE=1 ;;
+ --clean) CLEAN=1 ;; # TODO: Not implemented
+ --verbose) VERBOSE=1 ;;
+ --dryrun|--dry-run) DRYRUN=1 ;;
+ esac
+ shift
+done
+
+if [ $(( CREATE + REMOVE )) -ne 1 ] ; then
+ printf 'usage: %s [--create] [--remove]\n' "${0##*/}"
+ exit 1
+fi
+
+error=0
+
+# loop through the gathered fragments, sorted globally by filename.
+# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
+for FILE in $tmpfiles_d ; do
+ LINENUM=0
+
+ ### FILE FORMAT ###
+ # XXX: We ignore the 'Age' parameter
+ # 1 2 3 4 5 6 7
+ # Cmd Path Mode UID GID Age Argument
+ # d /run/user 0755 root root 10d -
+ # Mode, UID, GID, Age, Argument may be omitted!
+
+ # TODO: Sorry, we don't handle whitespace in paths.
+ while read line; do
+ LINENUM=$(( LINENUM+1 ))
+
+ # This will fix up whitespace and comment lines
+ # skip over comments and empty lines
+ set -- $line
+
+ if [ -z "$1" -o -z "$2" ]; then
+ continue
+ fi
+
+ # whine about invalid entries
+ case $1 in
+ f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
+ *) warninvalid ; continue ;;
+ esac
+
+ cmd=$1
+ path=$2
+
+ # fall back on defaults when parameters are passed as '-'
+ if [ "$3" = '-' -o "$3" = '' ]; then
+ case ${1} in
+ p|f|F) mode=0644 ;;
+ d|D) mode=0755 ;;
+ z|Z|x|r|R|L) ;;
+ esac
+ else
+ mode=$3
+ fi
+ uid=$4
+ gid=$5
+ age=$6
+ arg=$7
+
+ [ ${4} = '-' ] && uid=0
+ [ ${5} = '-' ] && gid=0
+ [ ${6} = '-' ] && age=0
+ [ ${7} = '-' ] && arg=''
+ set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
+
+ [ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
+ if [ "${DRYRUN}" -eq "0" ]; then
+ _$cmd "$@"
+ rc=$?
+ [ $rc -ne 0 ] && error=$((error + 1))
+ fi
+ done <$FILE
+done
+
+exit $error
+
+# vim: set ts=2 sw=2 sts=2 noet ft=sh:
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-02-09 9:56 Robin H. Johnson
0 siblings, 0 replies; 148+ messages in thread
From: Robin H. Johnson @ 2012-02-09 9:56 UTC (permalink / raw
To: gentoo-commits
commit: f5e7e768522895d2efe31d1afbdf7f2214421c7f
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 9 09:49:04 2012 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu Feb 9 09:53:46 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f5e7e768
Fix early consolefont/termencoding usage vs rc_sys
During early boot, the keywords were not being checked for
consolefont/termencoding and they were running anyway when they should
not be.
X-Gentoo-Bug: 400549
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=400549
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
sh/init-early.sh.Linux.in | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index f546951..fb3860a 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -5,6 +5,19 @@
: ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
+service_present()
+{
+ local p="/etc/runlevels/$1/$2"
+ # fail if the file doesn't exist
+ [ ! -e "$p" ] && return 1
+ # succeed if $RC_SYS empty, can't check further, assume script will run
+ [ -z "$RC_SYS" ] && return 0
+ # fail if file contains "-$RC_SYS", because then it won't run
+ egrep -qi "^[[:space:]]*keyword[[:space:]].*-$RC_SYS\>" "$p" && return 1
+ # succeed otherwise
+ return 0
+}
+
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G"
kmode="-u"
@@ -14,8 +27,8 @@ else
fi
# Try and set a font and as early as we can
-if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \
- -o -e /etc/runlevels/"$RC_BOOTLEVEL"/consolefont ]; then
+if service_present "$RC_DEFAULTLEVEL" consolefont ||
+ service_present "$RC_BOOTLEVEL" consolefont; then
printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBEXECDIR"/console/font -a -x /usr/bin/setfont ]; then
font="$(cat "$RC_LIBEXECDIR"/console/font)"
@@ -25,8 +38,8 @@ if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \
fi
# Try and set a keyboard map as early as possible
-if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/keymaps \
- -o -e /etc/runlevels/"$RC_BOOTLEVEL"/keymaps ]; then
+if service_present "$RC_DEFAULTLEVEL" keymaps ||
+ service_present "$RC_BOOTLEVEL" keymaps; then
kbd_mode $kmode -C "$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBEXECDIR"/console/keymap ]; then
loadkeys -q "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-01-28 18:26 Christian Ruppert
0 siblings, 0 replies; 148+ messages in thread
From: Christian Ruppert @ 2012-01-28 18:26 UTC (permalink / raw
To: gentoo-commits
commit: 5a8344a3d1068b2a7b24bf88f9a2882475b2a5ae
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 28 18:26:00 2012 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat Jan 28 18:26:00 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=5a8344a3
Check if /sys/fs/cgroup/openrc is writable
---
sh/runscript.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 344e31c..faa85cc 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -195,7 +195,7 @@ unset _conf_d
sourcex -e "@SYSCONFDIR@/rc.conf"
if [ "$RC_UNAME" = "Linux" ]; then
- if [ -d /sys/fs/cgroup/openrc ]; then
+ if [ -d /sys/fs/cgroup/openrc ] && checkpath -W /sys/fs/cgroup/openrc ; then
mkdir -p /sys/fs/cgroup/openrc/${RC_SVCNAME}
echo $$ > /sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-01-27 4:18 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-01-27 4:18 UTC (permalink / raw
To: gentoo-commits
commit: ab9cf25197bccaff72d636f511b876aa2c379fdb
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 27 04:09:07 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jan 27 04:09:07 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ab9cf251
cgroups: add all services to the openrc cgroup
This is a modified version of a patch originally submitted by
Patrick Lauer <patrick <AT> gentoo.org>.
---
sh/runscript.sh.in | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 3b91001..344e31c 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -194,6 +194,14 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
+if [ "$RC_UNAME" = "Linux" ]; then
+ if [ -d /sys/fs/cgroup/openrc ]; then
+ mkdir -p /sys/fs/cgroup/openrc/${RC_SVCNAME}
+ echo $$ > /sys/fs/cgroup/openrc/${RC_SVCNAME}/tasks
+ fi
+ #todo: add processes to cgroups based on settings in conf.d
+fi
+
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2012-01-17 18:09 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2012-01-17 18:09 UTC (permalink / raw
To: gentoo-commits
commit: c529a5765097f020d3cfe4e58750c5382672c1e7
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 17 18:04:20 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan 17 18:04:20 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c529a576
drop the extra --pidfile option
---
sh/runscript.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index e042be6..8e7fa69 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -128,7 +128,7 @@ start()
eend 1 "command_background option used but no pidfile specified"
return 1
fi
- _background="--background --make-pidfile --pidfile"
+ _background="--background --make-pidfile"
fi
if yesno "$start_inactive"; then
local _inactive=false
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-11-18 14:39 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-11-18 14:39 UTC (permalink / raw
To: gentoo-commits
commit: a5ba2f3264397ac1ca1545ae67fbfdafa1b30b67
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 14:32:06 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 14:32:06 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a5ba2f32
CGroups: fix group initialization
Make sure cpuset.cpus and cpuset.mems exist in the parent group before
attempting to copy them to the new group.
---
sh/runscript.sh.in | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 722364a..c7d712b 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -194,8 +194,11 @@ if [ -d /sys/fs/cgroup/ ]; then
# use RC_SVCNAME unless overridden in conf.d
SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
mkdir -p /sys/fs/cgroup/${SVC_CGROUP}
- cp /sys/fs/cgroup/cpuset.cpus /sys/fs/cgroup/${SVC_CGROUP}
- cp /sys/fs/cgroup/cpuset.mems /sys/fs/cgroup/${SVC_CGROUP}
+ for f in cpuset.cpus cpuset.mems; do
+ if [ -f /sys/fs/cgroup/${f} ]; then
+ cp /sys/fs/cgroup/${f} /sys/fs/cgroup/${SVC_CGROUP}
+ fi
+ done
# now attach self to cgroup - any children of this process will inherit this
echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks
# TODO: set res limits from conf.d
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-11-18 6:06 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-11-18 6:06 UTC (permalink / raw
To: gentoo-commits
commit: 62f4438376098f20ed293fec1fec6fabc014b7ef
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 05:49:07 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 05:55:32 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=62f44383
CGroups: finish initializing the CGroup
When a CGroup is created, we need to copy cpuset.cpus and cpuset.mems
from the new group's parent into the new group before we can attach any
processes to it.
---
sh/runscript.sh.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index ca9c133..722364a 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -194,6 +194,8 @@ if [ -d /sys/fs/cgroup/ ]; then
# use RC_SVCNAME unless overridden in conf.d
SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
mkdir -p /sys/fs/cgroup/${SVC_CGROUP}
+ cp /sys/fs/cgroup/cpuset.cpus /sys/fs/cgroup/${SVC_CGROUP}
+ cp /sys/fs/cgroup/cpuset.mems /sys/fs/cgroup/${SVC_CGROUP}
# now attach self to cgroup - any children of this process will inherit this
echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks
# TODO: set res limits from conf.d
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-11-02 13:42 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-11-02 13:42 UTC (permalink / raw
To: gentoo-commits
commit: 27713e3a41574c20336fcbf4fd3522d126045f16
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 2 13:16:52 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Nov 2 13:31:43 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=27713e3a
Make sure we load external scripts before using eerror
Reported-by: Jochen Schlick <josch06 <AT> gmail.com>
X-Gentoo-Bug: 388715
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=388715
---
sh/runscript.sh.in | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 26dcfb3..010c794 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -33,6 +33,14 @@ loadconfig()
fi
}
+sourcex "@SYSCONFDIR@/init.d/functions.sh"
+sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
+
+# Support LiveCD foo
+if sourcex -e "/sbin/livecd-functions.sh"; then
+ livecd_read_commandline
+fi
+
if [ ! -e ${RC_SVCDIR}/softlevel ]; then
eerror "You are attempting to run an openrc service on a"
eerror "system which openrc did not boot."
@@ -45,14 +53,6 @@ if [ ! -e ${RC_SVCDIR}/softlevel ]; then
exit 1
fi
-sourcex "@SYSCONFDIR@/init.d/functions.sh"
-sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
-
-# Support LiveCD foo
-if sourcex -e "/sbin/livecd-functions.sh"; then
- livecd_read_commandline
-fi
-
if [ -z "$1" -o -z "$2" ]; then
eerror "$RC_SVCNAME: not enough arguments"
exit 1
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-18 20:07 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2011-09-18 20:07 UTC (permalink / raw
To: gentoo-commits
commit: 95adeb85bad458d3eb41c6c88289fdb462594641
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 03:07:33 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 19:25:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=95adeb85
runscript: simplify livecd-functions.sh loading
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
sh/runscript.sh.in | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index fe30a03..5853212 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -49,8 +49,7 @@ sourcex "@SYSCONFDIR@/init.d/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
# Support LiveCD foo
-if [ -r /sbin/livecd-functions.sh ]; then
- sourcex "/sbin/livecd-functions.sh"
+if sourcex -e "/sbin/livecd-functions.sh"; then
livecd_read_commandline
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-13 3:20 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-09-13 3:20 UTC (permalink / raw
To: gentoo-commits
commit: e14e78db16b8ce38235665ee52e3c13375e0d168
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 12 15:46:51 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Sep 13 03:15:24 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e14e78db
Revert "Mount /run as early as possible"
This reverts commit 5ed4d084d95608e40cb21888c18a8f381a44cd69.
/run needs to be mounted after /proc.
---
sh/init-early.sh.Linux.in | 18 ------------------
sh/init.sh.Linux.in | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index 83464f3..f546951 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -5,24 +5,6 @@
: ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
-# Mount tmpfs on /run when directory exists.
-# /run is a new directory for storing volatile runtime data.
-# Read more about /run at https://lwn.net/Articles/436012
-if [ -d /run ]; then
- if mountinfo -q /run; then
- einfo "/run is already mounted, skipping"
- else
- ebegin "Mounting /run"
- if ! fstabinfo --mount /run; then
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
- fi
- eend $?
- fi
- checkpath -d -m 0775 -o root:uucp /run/lock
-elif [ -e /run ]; then
- einfo "Unable to mount /run since it is not a directory"
-fi
-
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G"
kmode="-u"
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index d01cc7b..f86c5f2 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,6 +91,24 @@ if $mountproc; then
eend $?
fi
+# Mount tmpfs on /run when directory exists.
+# /run is a new directory for storing volatile runtime data.
+# Read more about /run at https://lwn.net/Articles/436012
+if [ -d /run ]; then
+ if mountinfo -q /run; then
+ einfo "/run is already mounted, skipping"
+ else
+ ebegin "Mounting /run"
+ if ! fstabinfo --mount /run; then
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ fi
+ eend $?
+ fi
+ checkpath -d -m 0775 -o root:uucp /run/lock
+elif [ -e /run ]; then
+ einfo "Unable to mount /run since it is not a directory"
+fi
+
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
# return RC_SYS_XENU and will think that we are in a domU while it's not.
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-12 15:48 Christian Ruppert
0 siblings, 0 replies; 148+ messages in thread
From: Christian Ruppert @ 2011-09-12 15:48 UTC (permalink / raw
To: gentoo-commits
commit: 504592c92ad046d35fb6c85d56adb15a96cb5eac
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 12 15:48:01 2011 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 15:48:01 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=504592c9
Use checkpath to create /run/lock
---
sh/init.sh.Linux.in | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index b357434..f86c5f2 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -104,13 +104,7 @@ if [ -d /run ]; then
fi
eend $?
fi
- if [ ! -d /run/lock ]; then
- mkdir /run/lock
- fi
- if [ -d /run/lock ]; then
- chown root:uucp /run/lock
- chmod 0775 /run/lock
- fi
+ checkpath -d -m 0775 -o root:uucp /run/lock
elif [ -e /run ]; then
einfo "Unable to mount /run since it is not a directory"
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-12 15:48 Christian Ruppert
0 siblings, 0 replies; 148+ messages in thread
From: Christian Ruppert @ 2011-09-12 15:48 UTC (permalink / raw
To: gentoo-commits
commit: dd965512773616913df0560302717a7adf252f03
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 12 15:46:51 2011 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 15:46:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=dd965512
Revert "Use checkpath to create /run/lock"
This reverts commit b42ab3b2f4daaebdac043478f0ae385200a25535.
---
sh/init-early.sh.Linux.in | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index 83464f3..3a81ef9 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -18,7 +18,13 @@ if [ -d /run ]; then
fi
eend $?
fi
- checkpath -d -m 0775 -o root:uucp /run/lock
+ if [ ! -d /run/lock ]; then
+ mkdir /run/lock
+ fi
+ if [ -d /run/lock ]; then
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
elif [ -e /run ]; then
einfo "Unable to mount /run since it is not a directory"
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-12 15:48 Christian Ruppert
0 siblings, 0 replies; 148+ messages in thread
From: Christian Ruppert @ 2011-09-12 15:48 UTC (permalink / raw
To: gentoo-commits
commit: b52927906cbaf5ca81fdc2bcc04e2579a342ad82
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 12 15:46:55 2011 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Sep 12 15:46:55 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b5292790
Revert "Mount /run as early as possible"
This reverts commit 5ed4d084d95608e40cb21888c18a8f381a44cd69.
The /run mount needs /proc first.
---
sh/init-early.sh.Linux.in | 24 ------------------------
sh/init.sh.Linux.in | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index 3a81ef9..f546951 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -5,30 +5,6 @@
: ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
-# Mount tmpfs on /run when directory exists.
-# /run is a new directory for storing volatile runtime data.
-# Read more about /run at https://lwn.net/Articles/436012
-if [ -d /run ]; then
- if mountinfo -q /run; then
- einfo "/run is already mounted, skipping"
- else
- ebegin "Mounting /run"
- if ! fstabinfo --mount /run; then
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
- fi
- eend $?
- fi
- if [ ! -d /run/lock ]; then
- mkdir /run/lock
- fi
- if [ -d /run/lock ]; then
- chown root:uucp /run/lock
- chmod 0775 /run/lock
- fi
-elif [ -e /run ]; then
- einfo "Unable to mount /run since it is not a directory"
-fi
-
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G"
kmode="-u"
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index d01cc7b..b357434 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,6 +91,30 @@ if $mountproc; then
eend $?
fi
+# Mount tmpfs on /run when directory exists.
+# /run is a new directory for storing volatile runtime data.
+# Read more about /run at https://lwn.net/Articles/436012
+if [ -d /run ]; then
+ if mountinfo -q /run; then
+ einfo "/run is already mounted, skipping"
+ else
+ ebegin "Mounting /run"
+ if ! fstabinfo --mount /run; then
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ fi
+ eend $?
+ fi
+ if [ ! -d /run/lock ]; then
+ mkdir /run/lock
+ fi
+ if [ -d /run/lock ]; then
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
+elif [ -e /run ]; then
+ einfo "Unable to mount /run since it is not a directory"
+fi
+
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
# return RC_SYS_XENU and will think that we are in a domU while it's not.
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-07 20:14 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-09-07 20:14 UTC (permalink / raw
To: gentoo-commits
commit: b42ab3b2f4daaebdac043478f0ae385200a25535
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 7 20:11:04 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Sep 7 20:11:04 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b42ab3b2
Use checkpath to create /run/lock
---
sh/init-early.sh.Linux.in | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index 3a81ef9..83464f3 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -18,13 +18,7 @@ if [ -d /run ]; then
fi
eend $?
fi
- if [ ! -d /run/lock ]; then
- mkdir /run/lock
- fi
- if [ -d /run/lock ]; then
- chown root:uucp /run/lock
- chmod 0775 /run/lock
- fi
+ checkpath -d -m 0775 -o root:uucp /run/lock
elif [ -e /run ]; then
einfo "Unable to mount /run since it is not a directory"
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-09-07 3:21 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-09-07 3:21 UTC (permalink / raw
To: gentoo-commits
commit: 5ed4d084d95608e40cb21888c18a8f381a44cd69
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 7 02:00:08 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Sep 7 02:00:08 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=5ed4d084
Mount /run as early as possible
This commit moves the code that mounts /run to the earliest possible
position in openrc.
---
sh/init-early.sh.Linux.in | 24 ++++++++++++++++++++++++
sh/init.sh.Linux.in | 24 ------------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index f546951..3a81ef9 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -5,6 +5,30 @@
: ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
+# Mount tmpfs on /run when directory exists.
+# /run is a new directory for storing volatile runtime data.
+# Read more about /run at https://lwn.net/Articles/436012
+if [ -d /run ]; then
+ if mountinfo -q /run; then
+ einfo "/run is already mounted, skipping"
+ else
+ ebegin "Mounting /run"
+ if ! fstabinfo --mount /run; then
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ fi
+ eend $?
+ fi
+ if [ ! -d /run/lock ]; then
+ mkdir /run/lock
+ fi
+ if [ -d /run/lock ]; then
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
+elif [ -e /run ]; then
+ einfo "Unable to mount /run since it is not a directory"
+fi
+
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G"
kmode="-u"
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index b357434..d01cc7b 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,30 +91,6 @@ if $mountproc; then
eend $?
fi
-# Mount tmpfs on /run when directory exists.
-# /run is a new directory for storing volatile runtime data.
-# Read more about /run at https://lwn.net/Articles/436012
-if [ -d /run ]; then
- if mountinfo -q /run; then
- einfo "/run is already mounted, skipping"
- else
- ebegin "Mounting /run"
- if ! fstabinfo --mount /run; then
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
- fi
- eend $?
- fi
- if [ ! -d /run/lock ]; then
- mkdir /run/lock
- fi
- if [ -d /run/lock ]; then
- chown root:uucp /run/lock
- chmod 0775 /run/lock
- fi
-elif [ -e /run ]; then
- einfo "Unable to mount /run since it is not a directory"
-fi
-
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
# return RC_SYS_XENU and will think that we are in a domU while it's not.
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-07-26 17:29 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-07-26 17:29 UTC (permalink / raw
To: gentoo-commits
commit: df1f02ac848a010092df2d3d40b8828051522b4b
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 17:19:59 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 17:19:59 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=df1f02ac
Runscript: print deprecation warning for opts variable
Openrc uses the extra_commands and extra_started_commands variables to
list extra commands for services. Also, it supports the opts variable
which is used to assist migration from baselayout-1.
I am adding this warning to encourage switching from opts to
extra_commands/extra_started_commands.
I would like to remove support for opts eventually.
---
sh/runscript.sh.in | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index a3f387e..df34b5e 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -206,6 +206,12 @@ for _f in $required_files; do
done
unset _f
+if [ -n "$opts" ]; then
+ ewarn "Use of the opts variable is deprecated and will be"
+ ewarn "removed in the future."
+ ewarn "Please use extra_commands or extra_started_commands."
+fi
+
while [ -n "$1" ]; do
# Sepcial case depend
if [ "$1" = depend ]; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-07-06 14:55 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-07-06 14:55 UTC (permalink / raw
To: gentoo-commits
commit: 9a068c2500b3d8d473900dfaaf7d3fb5d593862d
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 6 14:53:05 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Jul 6 14:53:05 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9a068c25
The is_net_fs function should use extra_net_fs_list
This was pointed out to me by Morse on #gentoo-base, so I would like to
thank him for the patch.
---
sh/rc-functions.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 50ba20b..de43074 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -50,7 +50,7 @@ is_net_fs()
# Fall back on fs types
local t=$(mountinfo --fstype "$1")
- for x in $net_fs_list; do
+ for x in $net_fs_list $extra_net_fs_list; do
[ "$x" = "$t" ] && return 0
done
return 1
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-07-03 4:34 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-07-03 4:34 UTC (permalink / raw
To: gentoo-commits
commit: 9076baa573a6e7a0ad7fb0de1919b051c8b3b012
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 3 04:33:23 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jul 3 04:33:23 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9076baa5
slight formatting change
Add a new line after "rc_runlevel()" for consistency.
---
sh/functions.sh.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index 0f0e1a9..1d1b0cd 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -38,7 +38,8 @@ yesno()
esac
}
-rc_runlevel() {
+rc_runlevel()
+{
rc-status --runlevel
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-06-27 17:11 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-06-27 17:11 UTC (permalink / raw
To: gentoo-commits
commit: e8413733c1716b62b9c139a640e1901fe316d8a9
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 27 17:11:01 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 17:11:01 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e8413733
Revert "remove functions.sh symbolic link in init.d"
This reverts commit f4407ac83d84e52c951b4a07640cdcad458010ea.
---
sh/Makefile | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sh/Makefile b/sh/Makefile
index c246f9e..73d4641 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -13,6 +13,8 @@ include ${MK}/scripts.mk
_installafter:
${INSTALL} -d ${DESTDIR}/${INITDIR}
+ @# Put functions.sh into init for backwards compat
+ ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
check test::
./runtests.sh
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-06-27 16:56 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-06-27 16:56 UTC (permalink / raw
To: gentoo-commits
commit: f4407ac83d84e52c951b4a07640cdcad458010ea
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 27 16:56:12 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 16:56:12 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f4407ac8
remove functions.sh symbolic link in init.d
---
sh/Makefile | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/sh/Makefile b/sh/Makefile
index 73d4641..c246f9e 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -13,8 +13,6 @@ include ${MK}/scripts.mk
_installafter:
${INSTALL} -d ${DESTDIR}/${INITDIR}
- @# Put functions.sh into init for backwards compat
- ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
check test::
./runtests.sh
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-06-04 0:43 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2011-06-04 0:43 UTC (permalink / raw
To: gentoo-commits
commit: 7ca74d7636b2fcd0c307ec2b972230f25457c786
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 4 00:41:43 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jun 4 00:41:43 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=7ca74d76
fix underquoting of wrapped color stubs of exit status
X-Gentoo-Bug: 369911
X-Gentoo-Bug-URL: http://bugs.gentoo.org/369911
Reported-by: Steve Dibb <beandog <AT> gentoo.org>
Reported-by: Christian Ruppert <idl0r <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
sh/functions.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index da2e51a..ef8281e 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -104,7 +104,7 @@ else
# the last ecmd
for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \
vebegin veend veinfo vewarn vewend; do
- eval "$_e() { local _r; @LIBEXECDIR@/bin/$_e \"\$@\"; _r=$?; \
+ eval "$_e() { local _r; @LIBEXECDIR@/bin/$_e \"\$@\"; _r=\$?; \
export EINFO_LASTCMD=$_e; return \$_r; }"
done
unset _e
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-05-16 22:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2011-05-16 22:49 UTC (permalink / raw
To: gentoo-commits
commit: 3d56124ed1ec127ae091391dc05581197eb29eac
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 22:49:21 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon May 16 22:49:21 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=3d56124e
only warn about /run if it exists
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
sh/init.sh.Linux.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 96474ff..21757fd 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -111,7 +111,7 @@ if [ -d /run ]; then
chown root:uucp /run/lock
chmod 0775 /run/lock
fi
-else
+elif [ -e /run ]; then
einfo "Unable to mount /run since it is not a directory"
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-05-11 19:55 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-05-11 19:55 UTC (permalink / raw
To: gentoo-commits
commit: 40341fcd7e66b8a72e0407bb509d149305aa529a
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 12:30:10 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed May 11 19:54:41 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=40341fcd
do not run services if openrc did not boot the system
X-Gentoo-Bug: 364159
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=364159
---
sh/runscript.sh.in | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 229d1ee..71935a0 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -16,6 +16,18 @@ sourcex()
fi
}
+if [ ! -e ${RC_SVCDIR}/softlevel ]; then
+ eerror "You are attempting to run an openrc service on a"
+ eerror "system which openrc did not boot."
+ eerror "You may be inside a chroot or you may have used"
+ eerror "another initialization system to boot this system."
+ eerror "In this situation, you will get unpredictable results!"
+ eerror
+ eerror "If you really want to do this, issue the following command:"
+ eerror "touch ${RC_SVCDIR}/softlevel"
+ exit 1
+fi
+
sourcex "@SYSCONFDIR@/init.d/functions.sh"
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-04-19 16:01 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-04-19 16:01 UTC (permalink / raw
To: gentoo-commits
commit: b6409feaac9922e5761ed7beef93bdf0fdf2faf7
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 19 15:56:14 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Apr 19 15:56:14 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b6409fea
fix permissions for /run/lock
If /run/lock is a directory, set the ownership and permissions for it,
whether or not we created the directory.
---
sh/init.sh.Linux.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 301c42f..96474ff 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -106,6 +106,8 @@ if [ -d /run ]; then
fi
if [ ! -d /run/lock ]; then
mkdir /run/lock
+ fi
+ if [ -d /run/lock ]; then
chown root:uucp /run/lock
chmod 0775 /run/lock
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-04-18 22:39 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-04-18 22:39 UTC (permalink / raw
To: gentoo-commits
commit: 64ef51ab09943ec28ddd4cb01647c982970cad9c
Author: Amadeusz Żołnowski <aidecoe <AT> aidecoe <DOT> name>
AuthorDate: Sun Apr 17 20:29:12 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 20:26:13 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=64ef51ab
Add support for /run directory
This is a new directory for storing volatile runtime data.
See https://lwn.net/Articles/436012
X-Gentoo-Bug: 363971
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=363971
---
sh/init.sh.Linux.in | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 361de0b..301c42f 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,6 +91,28 @@ if $mountproc; then
eend $?
fi
+# Mount tmpfs on /run when directory exists.
+# /run is a new directory for storing volatile runtime data.
+# Read more about /run at https://lwn.net/Articles/436012
+if [ -d /run ]; then
+ if mountinfo -q /run; then
+ einfo "/run is already mounted, skipping"
+ else
+ ebegin "Mounting /run"
+ if ! fstabinfo --mount /run; then
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ fi
+ eend $?
+ fi
+ if [ ! -d /run/lock ]; then
+ mkdir /run/lock
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
+else
+ einfo "Unable to mount /run since it is not a directory"
+fi
+
# Try to mount xenfs as early as possible, otherwise rc_sys() will always
# return RC_SYS_XENU and will think that we are in a domU while it's not.
if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/openrc:master commit in: sh/
@ 2011-03-25 0:18 William Hubbs
0 siblings, 0 replies; 148+ messages in thread
From: William Hubbs @ 2011-03-25 0:18 UTC (permalink / raw
To: gentoo-commits
commit: 1d63e85794ad850752eec95fa077e5895295f3b7
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 24 23:27:35 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Mar 25 00:14:16 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1d63e857
rework test for mounted /proc
The previous test assumed that we could always rely on the minor fault
counter to change between reads of /proc/self/stat, but we found that
this is not the case.
The new test compares two reads of /proc/self/environ for which we have
set the same environment variable to two different values.
If the comparison shows the two reads have the same contents, we know
that /proc is not working.
I would like to thank Robin Johnson and Mike Frysinger for their input
for this patch.
X-Gentoo-Bug: 348416
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=348416
---
sh/init.sh.Linux.in | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 9b04557..361de0b 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -65,27 +65,21 @@ mount_svcdir()
# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
# NFC how they managed that, but the end result means we have to test if
-# /proc actually works or not. We to this by comparing two reads of
-# /proc/self/stat. They will not match, because at least the minor fault count
-# field (field 10) should have changed.
-#
-# We can use any file here that fills the following requirements:
-# - changes between sequential reads
-# - is world-readable (not blocked in hardened kernel)
-# - Is only a single line (ergo entire check is doable with no forks)
+# /proc actually works or not. We do this by comparing two reads of
+# /proc/self/environ for which we have set the variable VAR to two
+# different values. If the comparison comes back equal, we know that
+# /proc is not working.
mountproc=true
-f=/proc/self/stat
+f=/proc/self/environ
if [ -e $f ]; then
- exec 9<$f ; read a <&9 ; exec 9<&-
- exec 9<$f ; read b <&9 ; exec 9<&-
- if [ "$a" = "$b" ]; then
+ if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
eerror "You have cruft in /proc that should be deleted"
else
einfo "/proc is already mounted, skipping"
mountproc=false
fi
fi
-unset a b f
+unset f
if $mountproc; then
procfs="proc"
^ permalink raw reply related [flat|nested] 148+ messages in thread
end of thread, other threads:[~2018-06-15 22:45 UTC | newest]
Thread overview: 148+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-29 15:53 [gentoo-commits] proj/openrc:master commit in: sh/ William Hubbs
-- strict thread matches above, loose matches on Subject: below --
2018-06-15 22:45 William Hubbs
2018-05-22 22:12 William Hubbs
2018-03-12 2:43 William Hubbs
2018-02-28 18:45 William Hubbs
2018-02-28 18:45 William Hubbs
2018-02-23 21:53 William Hubbs
2017-12-01 21:48 William Hubbs
2017-10-26 18:58 William Hubbs
2017-10-26 18:58 William Hubbs
2017-10-25 20:10 William Hubbs
2017-09-29 17:52 William Hubbs
2017-09-22 22:25 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-15 20:32 William Hubbs
2017-09-15 18:44 William Hubbs
2017-09-15 18:31 William Hubbs
2017-09-14 15:57 William Hubbs
2017-09-14 15:57 William Hubbs
2017-08-15 22:19 William Hubbs
2017-03-23 18:27 William Hubbs
2017-02-24 0:19 William Hubbs
2016-12-18 17:54 William Hubbs
2016-12-18 17:22 William Hubbs
2016-12-17 22:57 William Hubbs
2016-09-22 23:21 William Hubbs
2016-09-20 16:36 William Hubbs
2016-09-19 23:05 William Hubbs
2016-09-14 19:00 William Hubbs
2016-09-13 17:54 William Hubbs
2016-09-12 17:59 William Hubbs
2016-07-26 15:54 William Hubbs
2016-07-25 20:54 William Hubbs
2016-07-25 20:54 William Hubbs
2016-07-25 20:54 William Hubbs
2016-05-24 16:43 William Hubbs
2016-05-24 16:43 William Hubbs
2016-02-19 21:34 William Hubbs
2016-01-19 23:02 William Hubbs
2015-12-09 18:42 William Hubbs
2015-12-01 18:31 William Hubbs
2015-10-13 22:45 William Hubbs
2015-10-13 22:45 William Hubbs
2015-10-13 13:36 William Hubbs
2015-10-06 17:17 William Hubbs
2015-10-04 20:37 William Hubbs
2015-08-04 19:41 William Hubbs
2015-07-10 18:26 William Hubbs
2015-07-10 18:26 William Hubbs
2015-05-14 19:29 William Hubbs
2015-05-13 21:56 William Hubbs
2015-04-21 21:33 William Hubbs
2015-04-08 15:33 William Hubbs
2015-03-29 23:37 William Hubbs
2015-01-12 21:02 William Hubbs
2014-09-11 19:06 William Hubbs
2014-09-11 17:03 William Hubbs
2014-08-28 14:49 William Hubbs
2014-08-28 14:49 William Hubbs
2014-08-22 19:10 William Hubbs
2014-08-07 18:35 ` William Hubbs
2014-08-22 19:10 William Hubbs
2014-08-13 20:29 ` William Hubbs
2014-08-22 19:10 William Hubbs
2014-08-13 15:07 ` William Hubbs
2014-07-16 18:14 William Hubbs
2014-07-10 17:08 William Hubbs
2014-07-10 17:08 William Hubbs
2014-06-21 0:44 William Hubbs
2014-06-20 21:22 William Hubbs
2014-05-26 6:52 Robin H. Johnson
2014-04-03 18:05 William Hubbs
2014-01-18 8:50 William Hubbs
2014-01-18 7:56 William Hubbs
2013-12-11 4:47 William Hubbs
2013-11-30 21:33 Mike Frysinger
2013-10-31 21:09 William Hubbs
2013-09-27 21:22 William Hubbs
2013-07-27 16:12 William Hubbs
2013-07-26 1:56 William Hubbs
2013-07-25 6:01 William Hubbs
2013-07-23 23:01 William Hubbs
2013-07-23 23:01 William Hubbs
2013-07-16 18:56 William Hubbs
2013-07-16 18:56 William Hubbs
2013-07-16 18:56 William Hubbs
2013-06-24 20:46 William Hubbs
2013-06-24 20:46 William Hubbs
2013-05-26 2:06 William Hubbs
2013-05-26 1:15 William Hubbs
2013-05-05 19:29 William Hubbs
2013-04-03 16:34 William Hubbs
2013-03-11 6:11 William Hubbs
2013-02-24 3:38 William Hubbs
2013-02-19 22:53 William Hubbs
2013-02-17 2:49 William Hubbs
2013-02-16 7:30 William Hubbs
2013-01-17 3:14 Mike Frysinger
2013-01-15 18:36 William Hubbs
2013-01-15 18:21 William Hubbs
2012-12-22 15:47 William Hubbs
2012-12-22 14:40 William Hubbs
2012-12-19 17:43 William Hubbs
2012-12-07 15:48 William Hubbs
2012-12-06 22:51 William Hubbs
2012-11-26 3:45 William Hubbs
2012-11-06 22:41 William Hubbs
2012-11-05 21:25 Robin H. Johnson
2012-10-22 0:53 William Hubbs
2012-10-22 0:53 William Hubbs
2012-10-21 19:51 William Hubbs
2012-10-17 23:19 William Hubbs
2012-09-26 22:12 Robin H. Johnson
2012-08-16 18:45 Robin H. Johnson
2012-07-02 18:27 William Hubbs
2012-05-16 22:00 Christian Ruppert
2012-05-02 19:50 William Hubbs
2012-04-26 17:59 William Hubbs
2012-04-26 17:21 William Hubbs
2012-04-26 17:12 William Hubbs
2012-04-26 16:28 William Hubbs
2012-03-12 19:05 Robin H. Johnson
2012-03-12 8:38 Robin H. Johnson
2012-02-09 9:56 Robin H. Johnson
2012-01-28 18:26 Christian Ruppert
2012-01-27 4:18 William Hubbs
2012-01-17 18:09 William Hubbs
2011-11-18 14:39 William Hubbs
2011-11-18 6:06 William Hubbs
2011-11-02 13:42 William Hubbs
2011-09-18 20:07 Mike Frysinger
2011-09-13 3:20 William Hubbs
2011-09-12 15:48 Christian Ruppert
2011-09-12 15:48 Christian Ruppert
2011-09-12 15:48 Christian Ruppert
2011-09-07 20:14 William Hubbs
2011-09-07 3:21 William Hubbs
2011-07-26 17:29 William Hubbs
2011-07-06 14:55 William Hubbs
2011-07-03 4:34 William Hubbs
2011-06-27 17:11 William Hubbs
2011-06-27 16:56 William Hubbs
2011-06-04 0:43 Mike Frysinger
2011-05-16 22:49 Mike Frysinger
2011-05-11 19:55 William Hubbs
2011-04-19 16:01 William Hubbs
2011-04-18 22:39 William Hubbs
2011-03-25 0:18 William Hubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox