Deleted Added
full compact
rc.subr (242183) rc.subr (242184)
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
2# $FreeBSD: head/etc/rc.subr 242183 2012-10-27 17:43:30Z crees $
2# $FreeBSD: head/etc/rc.subr 242184 2012-10-27 19:09:09Z hrs $
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 446 unchanged lines hidden (view full) ---

457#
458# ${name}_chdir n Directory to cd to before running ${command}
459# (if not using ${name}_chroot).
460#
461# ${name}_flags n Arguments to call ${command} with.
462# NOTE: $flags from the parent environment
463# can be used to override this.
464#
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 446 unchanged lines hidden (view full) ---

457#
458# ${name}_chdir n Directory to cd to before running ${command}
459# (if not using ${name}_chroot).
460#
461# ${name}_flags n Arguments to call ${command} with.
462# NOTE: $flags from the parent environment
463# can be used to override this.
464#
465# ${name}_fib n Routing table number to run ${command} with.
466#
465# ${name}_nice n Nice level to run ${command} at.
466#
467# ${name}_user n User to run ${command} as, using su(1) if not
468# using ${name}_chroot.
469# Requires /usr to be mounted.
470#
471# ${name}_group n Group to run chrooted ${command} as.
472# Requires /usr to be mounted.

--- 162 unchanged lines hidden (view full) ---

635
636 if [ -n "$flags" ]; then # allow override from environment
637 rc_flags=$flags
638 else
639 eval rc_flags=\$${name}_flags
640 fi
641 eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
642 _nice=\$${name}_nice _user=\$${name}_user \
467# ${name}_nice n Nice level to run ${command} at.
468#
469# ${name}_user n User to run ${command} as, using su(1) if not
470# using ${name}_chroot.
471# Requires /usr to be mounted.
472#
473# ${name}_group n Group to run chrooted ${command} as.
474# Requires /usr to be mounted.

--- 162 unchanged lines hidden (view full) ---

637
638 if [ -n "$flags" ]; then # allow override from environment
639 rc_flags=$flags
640 else
641 eval rc_flags=\$${name}_flags
642 fi
643 eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
644 _nice=\$${name}_nice _user=\$${name}_user \
643 _group=\$${name}_group _groups=\$${name}_groups
645 _group=\$${name}_group _groups=\$${name}_groups \
646 _fib=\$${name}_fib
644
645 if [ -n "$_user" ]; then # unset $_user if running as that user
646 if [ "$_user" = "$(eval $IDCMD)" ]; then
647 unset _user
648 fi
649 fi
650
651 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary

--- 64 unchanged lines hidden (view full) ---

716 fi
717
718 # setup the full command to run
719 #
720 check_startmsgs && echo "Starting ${name}."
721 if [ -n "$_chroot" ]; then
722 _doit="\
723${_nice:+nice -n $_nice }\
647
648 if [ -n "$_user" ]; then # unset $_user if running as that user
649 if [ "$_user" = "$(eval $IDCMD)" ]; then
650 unset _user
651 fi
652 fi
653
654 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary

--- 64 unchanged lines hidden (view full) ---

719 fi
720
721 # setup the full command to run
722 #
723 check_startmsgs && echo "Starting ${name}."
724 if [ -n "$_chroot" ]; then
725 _doit="\
726${_nice:+nice -n $_nice }\
727${_fib:+setfib -F $_fib }\
724chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
725$_chroot $command $rc_flags $command_args"
726 else
727 _doit="\
728${_chdir:+cd $_chdir && }\
728chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
729$_chroot $command $rc_flags $command_args"
730 else
731 _doit="\
732${_chdir:+cd $_chdir && }\
733${_fib:+setfib -F $_fib }\
729$command $rc_flags $command_args"
730 if [ -n "$_user" ]; then
731 _doit="su -m $_user -c 'sh -c \"$_doit\"'"
732 fi
733 if [ -n "$_nice" ]; then
734 if [ -z "$_user" ]; then
735 _doit="sh -c \"$_doit\""
736 fi

--- 1007 unchanged lines hidden ---
734$command $rc_flags $command_args"
735 if [ -n "$_user" ]; then
736 _doit="su -m $_user -c 'sh -c \"$_doit\"'"
737 fi
738 if [ -n "$_nice" ]; then
739 if [ -z "$_user" ]; then
740 _doit="sh -c \"$_doit\""
741 fi

--- 1007 unchanged lines hidden ---