summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-05-04 14:54:19 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-05-04 14:54:19 -0300
commit0363775a534e231ae1b906079ddf980a08a8de67 (patch)
tree931a85ee516ed8b61604f4533332d7dff7ec46d5 /rc
parent5b36b462c671956e2b40e8631b59d96d044df513 (diff)
parente98a352e9568ec31b33af8671987d026f1f73647 (diff)
Merge branch 'master' of https://projects.archlinux.org/git/initscripts into parabola
Diffstat (limited to 'rc')
-rwxr-xr-xrc10
1 files changed, 8 insertions, 2 deletions
diff --git a/rc b/rc
index 1e64119..743d86b 100755
--- a/rc
+++ b/rc
@@ -43,9 +43,15 @@ case $1 in
*)
action=$1
shift
+ # set same environment variables as init
+ runlevel=$(/sbin/runlevel)
+ ENV="PATH='/bin:/usr/bin:/sbin:/usr/sbin'"
+ ENV+=" PREVLEVEL='${runlevel:0:1}'"
+ ENV+=" RUNLEVEL='${runlevel:2:1}'"
+ ENV+=" CONSOLE='${CONSOLE:-/dev/console}'"
for i; do
- [[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
- (( ret += $? ))
+ [[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action"
+ (( ret += !! $? )) # clamp exit value to 0/1
done
esac