Compare commits
	
		
			33 Commits
		
	
	
		
			funtoo-ope
			...
			openrc-0.9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 9be1a2a67b | ||
|   | 6d5b452ef5 | ||
|   | 7a6dbedf38 | ||
|   | 70c159d47c | ||
|   | b71f3bd2fd | ||
|   | c5b14edda8 | ||
|   | 4ee62c7903 | ||
|   | a029dee59b | ||
|   | 2330978300 | ||
|   | 0c8bea2152 | ||
|   | 3688c85163 | ||
|   | 370e5c775a | ||
|   | df1f02ac84 | ||
|   | 863ef36011 | ||
|   | 05c2d68192 | ||
|   | 07694255a4 | ||
|   | 6fa6f9523f | ||
|   | e3b02abd7a | ||
|   | 5541e5ba24 | ||
|   | a74382d9cb | ||
|   | fdaf1c65cd | ||
|   | ef22868f36 | ||
|   | 0c7032840b | ||
|   | fe6cd23287 | ||
|   | 05e3251467 | ||
|   | 9a068c2500 | ||
|   | e8e86b96dc | ||
|   | 48dcc55b65 | ||
|   | 44dc7db4f8 | ||
|   | 003d4ba15b | ||
|   | 49f1a8702b | ||
|   | be990b308a | ||
|   | 9076baa573 | 
| @@ -1,3 +1,3 @@ | |||||||
| NAME=		openrc | NAME=		openrc | ||||||
| VERSION=	0.8.3 | VERSION=	0.9.2 | ||||||
| PKG=		${NAME}-${VERSION} | PKG=		${NAME}-${VERSION} | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								STYLE
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								STYLE
									
									
									
									
									
								
							| @@ -32,3 +32,54 @@ void foo(int c) | |||||||
|  |  | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ################## | ||||||
|  | # COMMIT MESSAGES # | ||||||
|  | ################## | ||||||
|  |  | ||||||
|  | The following is an example of a correctly formatted git commit message | ||||||
|  | for this repository. Most of this information came from this blog post | ||||||
|  | [1], so I would like to thank the author. | ||||||
|  |  | ||||||
|  | ### cut here ### | ||||||
|  | Capitalized, short (50 chars or less) summary | ||||||
|  |  | ||||||
|  | More detailed explanatory text, if necessary.  Wrap it to about 72 | ||||||
|  | characters or so.  In some contexts, the first line is treated as the | ||||||
|  | subject of an email and the rest of the text as the body.  The blank | ||||||
|  | line separating the summary from the body is critical (unless you omit | ||||||
|  | the body entirely); tools like rebase can get confused if you run the | ||||||
|  | two together. | ||||||
|  |  | ||||||
|  | Write your commit message in the present tense: "Fix bug" and not "Fixed | ||||||
|  | bug."  This convention matches up with commit messages generated by | ||||||
|  | commands like git merge and git revert. | ||||||
|  |  | ||||||
|  | Further paragraphs come after blank lines. | ||||||
|  |  | ||||||
|  | - Bullet points are okay, too | ||||||
|  |  | ||||||
|  | - Typically a hyphen or asterisk is used for the bullet, preceded by a | ||||||
|  |   single space, with blank lines in between, but conventions vary here | ||||||
|  |  | ||||||
|  | - Use a hanging indent | ||||||
|  |  | ||||||
|  | Reported-by: User Name <email> | ||||||
|  | X-[Distro]-Bug: BugID | ||||||
|  | X-[Distro]-Bug-URL: URL for the bug (on the distribution's web site typically) | ||||||
|  | ### cut here ### | ||||||
|  |  | ||||||
|  | If you did not write the code and the patch does not include authorship | ||||||
|  | information in a format git can use, please use the --author option of the | ||||||
|  | git commit command to make the authorship correct. | ||||||
|  |  | ||||||
|  | The Reported-by tag is required if the person who reported the bug is | ||||||
|  | different from the author and committer. | ||||||
|  |  | ||||||
|  |   The X-[Distro]-Bug/Bug-URL tags are required if this commit is related | ||||||
|  |   to a bug reported to us by a specific distribution   of linux or a | ||||||
|  |   *BSD. Also, [Distro] should be replaced with the name of the | ||||||
|  |   distribution, e.g. X-Gentoo-Bug. | ||||||
|  |  | ||||||
|  | [1] http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,10 @@ | |||||||
| # You can define a list modules for a specific kernel version, | # You can define a list modules for a specific kernel version, | ||||||
| # a released kernel version, a main kernel version or just a list. | # a released kernel version, a main kernel version or just a list. | ||||||
|  | # The most specific versioned variable will take precedence. | ||||||
| #modules_2_6_23_gentoo_r5="ieee1394 ohci1394" | #modules_2_6_23_gentoo_r5="ieee1394 ohci1394" | ||||||
| #modules_2_6_23="tun ieee1394" | #modules_2_6_23="tun ieee1394" | ||||||
| #modules_2_6="tun" | #modules_2_6="tun" | ||||||
|  | #modules_2="ipv6" | ||||||
| #modules="ohci1394" | #modules="ohci1394" | ||||||
|  |  | ||||||
| # You can give modules a different name when they load - the new name | # You can give modules a different name when they load - the new name | ||||||
| @@ -10,10 +12,12 @@ | |||||||
| #modules="dummy:dummy1" | #modules="dummy:dummy1" | ||||||
|  |  | ||||||
| # Give the modules some arguments if needed, per version if necessary. | # Give the modules some arguments if needed, per version if necessary. | ||||||
|  | # Again, the most specific versioned variable will take precedence. | ||||||
| #module_ieee1394_args="debug" | #module_ieee1394_args="debug" | ||||||
| #module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394" | #module_ieee1394_args_2_6_23_gentoo_r5="debug2" | ||||||
| #module_ieee1394_args_2_6_23="tun ieee1394" | #module_ieee1394_args_2_6_23="debug3" | ||||||
| #module_ieee1394_args_2_6="tun" | #module_ieee1394_args_2_6="debug4" | ||||||
|  | #module_ieee1394_args_2="debug5" | ||||||
|  |  | ||||||
| # You should consult your kernel documentation and configuration | # You should consult your kernel documentation and configuration | ||||||
| # for a list of modules and their options. | # for a list of modules and their options. | ||||||
|   | |||||||
| @@ -47,6 +47,10 @@ | |||||||
| # logging can take place and as such cannot log the sysinit runlevel. | # logging can take place and as such cannot log the sysinit runlevel. | ||||||
| #rc_logger="YES" | #rc_logger="YES" | ||||||
|  |  | ||||||
|  | # Through rc_log_path you can specify a custom log file. | ||||||
|  | # The default value is: /var/log/rc.log | ||||||
|  | #rc_log_path="/var/log/rc.log" | ||||||
|  |  | ||||||
| # By default we filter the environment for our running scripts. To allow other | # By default we filter the environment for our running scripts. To allow other | ||||||
| # variables through, add them here. Use a * to allow all variables through. | # variables through, add them here. Use a * to allow all variables through. | ||||||
| #rc_env_allow="VAR1 VAR2" | #rc_env_allow="VAR1 VAR2" | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ start() | |||||||
| { | { | ||||||
| 	# Mount local filesystems in /etc/fstab. | 	# Mount local filesystems in /etc/fstab. | ||||||
| 	local types="noproc" x= no_netdev= | 	local types="noproc" x= no_netdev= | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		types="${types},${x}" | 		types="${types},${x}" | ||||||
| 	done | 	done | ||||||
|  |  | ||||||
| @@ -37,16 +37,10 @@ stop() | |||||||
| 	local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}" | 	local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}" | ||||||
| 	no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec" | 	no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec" | ||||||
| 	# RC_NO_UMOUNTS is an env var that can be set by plugins | 	# RC_NO_UMOUNTS is an env var that can be set by plugins | ||||||
| 	local OIFS=$IFS SIFS=${IFS-y} | 	local IFS="$IFS:" | ||||||
| 	IFS=$IFS: |  | ||||||
| 	for x in $no_umounts $RC_NO_UMOUNTS; do | 	for x in $no_umounts $RC_NO_UMOUNTS; do | ||||||
| 		no_umounts_r="$no_umounts_r|$x" | 		no_umounts_r="$no_umounts_r|$x" | ||||||
| 	done | 	done | ||||||
| 	if [ "$SIFS" = y ]; then |  | ||||||
| 		IFS=$OIFS |  | ||||||
| 	else |  | ||||||
| 		unset IFS |  | ||||||
| 	fi |  | ||||||
|  |  | ||||||
| 	if [ "$RC_UNAME" = Linux ]; then | 	if [ "$RC_UNAME" = Linux ]; then | ||||||
| 		no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*" | 		no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*" | ||||||
| @@ -70,7 +64,7 @@ stop() | |||||||
| 	einfo "Unmounting filesystems" | 	einfo "Unmounting filesystems" | ||||||
| 	eindent | 	eindent | ||||||
| 	local fs= | 	local fs= | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		fs="$fs${fs:+|}$x" | 		fs="$fs${fs:+|}$x" | ||||||
| 	done | 	done | ||||||
| 	[ -n "$fs" ] && fs="^($fs)$" | 	[ -n "$fs" ] && fs="^($fs)$" | ||||||
|   | |||||||
| @@ -16,18 +16,21 @@ start() | |||||||
| 	# support compiled in ... | 	# support compiled in ... | ||||||
| 	[ ! -f /proc/modules ] && return 0 | 	[ ! -f /proc/modules ] && return 0 | ||||||
|  |  | ||||||
| 	local KV=$(uname -r) | 	local KV x y kv_variant_list | ||||||
| 	local KV_MAJOR=${KV%%.*} | 	KV=$(uname -r) | ||||||
| 	local x=${KV#*.} | 	# full $KV | ||||||
| 	local KV_MINOR=${x%%.*} | 	kv_variant_list="${KV}" | ||||||
| 	x=${KV#*.*.} | 	# remove any KV_EXTRA options to just get the full version | ||||||
| 	local KV_MICRO=${x%%-*} | 	x=${KV%%-*} | ||||||
|  | 	# now slowly strip them | ||||||
|  | 	while [ -n "$x" ] && [ "$x" != "$y" ]; do | ||||||
|  | 		kv_variant_list="${kv_variant_list} $x" | ||||||
|  | 		y=$x | ||||||
|  | 		x=${x%.*} | ||||||
|  | 	done | ||||||
|  |  | ||||||
| 	local list= x= xx= y= args= mpargs= cnt=0 a= | 	local list= x= xx= y= args= mpargs= cnt=0 a= | ||||||
| 	for x in "$KV" \ | 	for x in $kv_variant_list ; do | ||||||
| 		$KV_MAJOR.$KV_MINOR.$KV_MICRO \ |  | ||||||
| 		$KV_MAJOR.$KV_MINOR \ |  | ||||||
| 	; do |  | ||||||
| 		eval list=\$modules_$(shell_var "$x") | 		eval list=\$modules_$(shell_var "$x") | ||||||
| 		[ -n "$list" ] && break | 		[ -n "$list" ] && break | ||||||
| 	done | 	done | ||||||
| @@ -45,10 +48,7 @@ start() | |||||||
| 		fi | 		fi | ||||||
| 		aa=$(shell_var "$a") | 		aa=$(shell_var "$a") | ||||||
| 		xx=$(shell_var "$x") | 		xx=$(shell_var "$x") | ||||||
| 		for y in "$KV" \ | 		for y in $kv_variant_list ; do | ||||||
| 			$KV_MAJOR.$KV_MINOR.$KV_MICRO \ |  | ||||||
| 			$KV_MAJOR.$KV_MINOR \ |  | ||||||
| 		; do |  | ||||||
| 			eval args=\$module_${aa}_args_$(shell_var "$y") | 			eval args=\$module_${aa}_args_$(shell_var "$y") | ||||||
| 			[ -n "${args}" ] && break | 			[ -n "${args}" ] && break | ||||||
| 			eval args=\$module_${xx}_args_$(shell_var "$y") | 			eval args=\$module_${xx}_args_$(shell_var "$y") | ||||||
|   | |||||||
| @@ -22,19 +22,13 @@ start() | |||||||
| 	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs= | 	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs= | ||||||
| 	m="$m|/bin|/sbin|/lib|/libexec" | 	m="$m|/bin|/sbin|/lib|/libexec" | ||||||
| 	# RC_NO_UMOUNTS is an env var that can be set by plugins | 	# RC_NO_UMOUNTS is an env var that can be set by plugins | ||||||
| 	local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS | 	local IFS="$IFS:" | ||||||
| 	IFS=$IFS: |  | ||||||
| 	for x in $no_umounts $RC_NO_UMOUNTS; do | 	for x in $no_umounts $RC_NO_UMOUNTS; do | ||||||
| 		m="$m|$x" | 		m="$m|$x" | ||||||
| 	done | 	done | ||||||
| 	if [ "$SIFS" = y ]; then |  | ||||||
| 		IFS=$OIFS |  | ||||||
| 	else |  | ||||||
| 		unset IFS |  | ||||||
| 	fi |  | ||||||
| 	m="^($m)$" | 	m="^($m)$" | ||||||
| 	fs= | 	fs= | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		fs="$fs${fs:+|}$x" | 		fs="$fs${fs:+|}$x" | ||||||
| 	done | 	done | ||||||
| 	[ -n "$fs" ] && fs="^($fs)$" | 	[ -n "$fs" ] && fs="^($fs)$" | ||||||
|   | |||||||
| @@ -12,9 +12,9 @@ depend() | |||||||
|  |  | ||||||
| start() | start() | ||||||
| { | { | ||||||
| 	# /etc/mtab could be a symlink to /proc/mounts | 	if [ -L /etc/mtab ] | ||||||
| 	if [ ! -w /etc/mtab -a -L /etc/mtab ]; then | 	then | ||||||
| 		eeinfo "Skipping mtab update (non writeable symlink)" | 		einfo "Skipping mtab update (mtab is a symbolic link)" | ||||||
| 		return 0 | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -48,6 +48,9 @@ _get_array() | |||||||
| 	if [ -n "${BASH}" ]; then | 	if [ -n "${BASH}" ]; then | ||||||
| 		case "$(declare -p "$1" 2>/dev/null)" in | 		case "$(declare -p "$1" 2>/dev/null)" in | ||||||
| 			"declare -a "*) | 			"declare -a "*) | ||||||
|  | 				ewarn "You are using a bash array for $1." | ||||||
|  | 				ewarn "This feature will be removed in the future." | ||||||
|  | 				ewarn "Please see net.example for the correct format for $1." | ||||||
| 				eval "set -- \"\${$1[@]}\"" | 				eval "set -- \"\${$1[@]}\"" | ||||||
| 				for _a; do | 				for _a; do | ||||||
| 					printf "%s\n" "${_a}" | 					printf "%s\n" "${_a}" | ||||||
| @@ -69,6 +72,9 @@ _flatten_array() | |||||||
| 	if [ -n "${BASH}" ]; then | 	if [ -n "${BASH}" ]; then | ||||||
| 		case "$(declare -p "$1" 2>/dev/null)" in | 		case "$(declare -p "$1" 2>/dev/null)" in | ||||||
| 			"declare -a "*) | 			"declare -a "*) | ||||||
|  | 				ewarn "You are using a bash array for $1." | ||||||
|  | 				ewarn "This feature will be removed in the future." | ||||||
|  | 				ewarn "Please see net.example for the correct format for $1." | ||||||
| 				eval "set -- \"\${$1[@]}\"" | 				eval "set -- \"\${$1[@]}\"" | ||||||
| 				for x; do | 				for x; do | ||||||
| 					printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")" | 					printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")" | ||||||
| @@ -539,7 +545,9 @@ start() | |||||||
| 		[ -z "${config}" ] && break | 		[ -z "${config}" ] && break | ||||||
|  |  | ||||||
| 		set -- ${config} | 		set -- ${config} | ||||||
| 		ebegin "$1" | 		if [ "$1" != "null" -a "$1" != "noop" ]; then | ||||||
|  | 			ebegin "$1" | ||||||
|  | 		fi | ||||||
| 		eindent | 		eindent | ||||||
| 		case "$1" in | 		case "$1" in | ||||||
| 			noop) | 			noop) | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ start() | |||||||
| 	[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind" | 	[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind" | ||||||
|  |  | ||||||
| 	local x= fs= rc= | 	local x= fs= rc= | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		case "$x" in | 		case "$x" in | ||||||
| 			nfs|nfs4) | 			nfs|nfs4) | ||||||
| 			# If the nfsmount script took care of the nfs | 			# If the nfsmount script took care of the nfs | ||||||
| @@ -81,7 +81,7 @@ stop() | |||||||
| 	ebegin "Unmounting network filesystems" | 	ebegin "Unmounting network filesystems" | ||||||
| 	. "$RC_LIBEXECDIR"/sh/rc-mount.sh | 	. "$RC_LIBEXECDIR"/sh/rc-mount.sh | ||||||
|  |  | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		fs="$fs${fs:+,}$x" | 		fs="$fs${fs:+,}$x" | ||||||
| 	done | 	done | ||||||
| 	if [ -n "$fs" ]; then | 	if [ -n "$fs" ]; then | ||||||
| @@ -90,7 +90,7 @@ stop() | |||||||
|  |  | ||||||
| 	eindent | 	eindent | ||||||
| 	fs= | 	fs= | ||||||
| 	for x in $net_fs_list; do | 	for x in $net_fs_list $extra_net_fs_list; do | ||||||
| 		fs="$fs${fs:+|}$x" | 		fs="$fs${fs:+|}$x" | ||||||
| 	done | 	done | ||||||
| 	[ -n "$fs" ] && fs="^($fs)$" | 	[ -n "$fs" ] && fs="^($fs)$" | ||||||
|   | |||||||
| @@ -16,7 +16,9 @@ depend() | |||||||
| start() | start() | ||||||
| { | { | ||||||
| 	ebegin "Setting the local clock based on last shutdown time" | 	ebegin "Setting the local clock based on last shutdown time" | ||||||
| 	swclock --warn | 	if ! swclock 2> /dev/null; then | ||||||
|  | 	swclock --warn @PREFIX@/sbin/runscript | ||||||
|  | 	fi | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -105,8 +105,7 @@ and | |||||||
| respectively, but only work when | respectively, but only work when | ||||||
| .Va EINFO_VERBOSE | .Va EINFO_VERBOSE | ||||||
| is true. You can also make the | is true. You can also make the | ||||||
| .Fn einfo , | .Fn einfo | ||||||
| .Fn ewarn , |  | ||||||
| and | and | ||||||
| .Fn ebegin | .Fn ebegin | ||||||
| functions silent by setting | functions silent by setting | ||||||
|   | |||||||
| @@ -462,12 +462,6 @@ show() | |||||||
|  |  | ||||||
| .Ed | .Ed | ||||||
| .Sh BUGS | .Sh BUGS | ||||||
| Because of the way we load our configuration files and the need to handle |  | ||||||
| more than one service directory, you can only use symlinks in service |  | ||||||
| directories to other services in the same directory. |  | ||||||
| You cannot symlink to a service in a different directory even if it is |  | ||||||
| another service directory. |  | ||||||
| .Pp |  | ||||||
| is_older_than should return 0 on success. | is_older_than should return 0 on success. | ||||||
| Instead we return 1 to be compliant with Gentoo baselayout. | Instead we return 1 to be compliant with Gentoo baselayout. | ||||||
| Users are encouraged to use the is_newer_than function which returns correctly. | Users are encouraged to use the is_newer_than function which returns correctly. | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ ethtool_pre_start() { | |||||||
|  |  | ||||||
| 		# Skip everything if no arguments | 		# Skip everything if no arguments | ||||||
| 		[ -z "${args}" ] && continue | 		[ -z "${args}" ] && continue | ||||||
| 		 |  | ||||||
| 		# Split on \n | 		# Split on \n | ||||||
| 		local IFS="$__IFS" | 		local IFS="$__IFS" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -111,38 +111,32 @@ _add_address() | |||||||
| 		return 0 | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	# Convert an ifconfig line to iproute2 | 	local address netmask broadcast peer anycast label scope | ||||||
| 	if [ "$2" = "netmask" ]; then | 	local valid_lft preferred_lft home nodad | ||||||
| 		local one="$1" three="$3" | 	address="$1" ; shift | ||||||
| 		shift; shift; shift | 	while [ -n "$*" ]; do | ||||||
| 		set -- "${one}/$(_netmask2cidr "${three}")" "$@" | 		case "$1" in | ||||||
| 	fi | 			netmask) | ||||||
|  | 				netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;; | ||||||
| 	# tunnel keyword is 'peer' in iproute2, but 'pointopoint' in ifconfig. | 			broadcast|brd) | ||||||
| 	if [ "$2" = "pointopoint" ]; then | 				broadcast="broadcast $2" ; shift ; shift ;; | ||||||
| 		local one="$1" | 			pointopoint|pointtopoint|peer) | ||||||
| 		shift; shift | 				peer="peer $2" ; shift ; shift ;; | ||||||
| 		set -- "${one}" "peer" "$@" | 			anycast|label|scope|valid_lft|preferred_lft) | ||||||
| 	fi | 				eval "$1=$2" ; shift ; shift ;; | ||||||
|  | 			home|nodad) | ||||||
|  | 				eval "$1=$1" ; shift ;; | ||||||
|  | 		esac | ||||||
|  | 	done | ||||||
|  |  | ||||||
| 	# Always scope lo addresses as host unless specified otherwise | 	# Always scope lo addresses as host unless specified otherwise | ||||||
| 	if [ "${IFACE}" = "lo" ]; then | 	if [ "${IFACE}" = "lo" ]; then | ||||||
| 		set -- "$@" "scope" "host" | 		[ -z "$scope" ] && scope="scope host" | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	# IPv4 specifics | 	set -- "${address}${netmask}" $peer $broadcast $anycast $label $scope dev "${IFACE}" $valid_lft $preferred_lft $home $nodad | ||||||
| 	case "$1" in | 	veinfo ip addr add "$@" | ||||||
| 		*.*.*.*) | 	ip addr add "$@" | ||||||
| 			case "$@" in |  | ||||||
| 				*" brd "*);; |  | ||||||
| 				*" broadcast "*);; |  | ||||||
| 				*) set -- "$@" brd +;; |  | ||||||
| 			esac |  | ||||||
| 			;; |  | ||||||
| 	esac |  | ||||||
|  |  | ||||||
| 	veinfo ip addr add "$@" dev "${IFACE}" |  | ||||||
| 	ip addr add "$@" dev "${IFACE}" |  | ||||||
| } | } | ||||||
|  |  | ||||||
| _add_route() | _add_route() | ||||||
|   | |||||||
| @@ -38,7 +38,8 @@ yesno() | |||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| rc_runlevel() { | rc_runlevel() | ||||||
|  | { | ||||||
|     rc-status --runlevel |     rc-status --runlevel | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ stop_addon() | |||||||
| } | } | ||||||
|  |  | ||||||
| net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre | net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre | ||||||
| ncpfs nfs nfs4 ocfs2 shfs smbfs $extra_net_fs_list" | ncpfs nfs nfs4 ocfs2 shfs smbfs" | ||||||
| is_net_fs() | is_net_fs() | ||||||
| { | { | ||||||
| 	[ -z "$1" ] && return 1 | 	[ -z "$1" ] && return 1 | ||||||
| @@ -50,7 +50,7 @@ is_net_fs() | |||||||
|  |  | ||||||
| 	# Fall back on fs types | 	# Fall back on fs types | ||||||
| 	local t=$(mountinfo --fstype "$1") | 	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 | 		[ "$x" = "$t" ] && return 0 | ||||||
| 	done | 	done | ||||||
| 	return 1 | 	return 1 | ||||||
|   | |||||||
| @@ -16,6 +16,23 @@ sourcex() | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
|  | loadconfig() | ||||||
|  | { | ||||||
|  | 	# If we're net.eth0 or openvpn.work then load net or openvpn config | ||||||
|  | 	_c=${RC_SVCNAME%%.*} | ||||||
|  | 	if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then | ||||||
|  | 		if ! sourcex -e "$1/$_c.$RC_RUNLEVEL"; then | ||||||
|  | 			sourcex -e "$1/$_c" | ||||||
|  | 		fi | ||||||
|  | 	fi | ||||||
|  | 	unset _c | ||||||
|  |  | ||||||
|  | 	# Overlay with our specific config | ||||||
|  | 	if ! sourcex -e "$1/$RC_SVCNAME.$RC_RUNLEVEL"; then | ||||||
|  | 		sourcex -e "$1/$RC_SVCNAME" | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  |  | ||||||
| if [ ! -e ${RC_SVCDIR}/softlevel ]; then | if [ ! -e ${RC_SVCDIR}/softlevel ]; then | ||||||
| 	eerror "You are attempting to run an openrc service on a" | 	eerror "You are attempting to run an openrc service on a" | ||||||
| 	eerror "system which openrc did not boot." | 	eerror "system which openrc did not boot." | ||||||
| @@ -165,21 +182,9 @@ status() | |||||||
|  |  | ||||||
| yesno $RC_DEBUG && set -x | yesno $RC_DEBUG && set -x | ||||||
|  |  | ||||||
| _conf_d=${RC_SERVICE%/*}/../conf.d | if ! loadconfig "${RC_SERVICE%/*}/../conf.d"; then | ||||||
| # If we're net.eth0 or openvpn.work then load net or openvpn config | 		loadconfig "@SYSCONFDIR@/conf.d" | ||||||
| _c=${RC_SVCNAME%%.*} |  | ||||||
| if [ -n "$_c" -a "$_c" != "$RC_SVCNAME" ]; then |  | ||||||
| 	if ! sourcex -e "$_conf_d/$_c.$RC_RUNLEVEL"; then |  | ||||||
| 		sourcex -e "$_conf_d/$_c" |  | ||||||
| 	fi |  | ||||||
| fi | fi | ||||||
| unset _c |  | ||||||
|  |  | ||||||
| # Overlay with our specific config |  | ||||||
| if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then |  | ||||||
| 	sourcex -e "$_conf_d/$RC_SVCNAME" |  | ||||||
| fi |  | ||||||
| unset _conf_d |  | ||||||
|  |  | ||||||
| # Load any system overrides | # Load any system overrides | ||||||
| sourcex -e "@SYSCONFDIR@/rc.conf" | sourcex -e "@SYSCONFDIR@/rc.conf" | ||||||
| @@ -206,6 +211,12 @@ for _f in $required_files; do | |||||||
| done | done | ||||||
| unset _f | 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 | while [ -n "$1" ]; do | ||||||
| 	# Sepcial case depend | 	# Sepcial case depend | ||||||
| 	if [ "$1" = depend ]; then | 	if [ "$1" = depend ]; then | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ update_ntp() | |||||||
| { | { | ||||||
| 	peer_var "${PEER_NTP}" && return | 	peer_var "${PEER_NTP}" && return | ||||||
| 	[ -z "${ntpsrv}" ] && return | 	[ -z "${ntpsrv}" ] && return | ||||||
| 	 |  | ||||||
| 	conf="# Generated by udhcpc for interface ${interface}\n" | 	conf="# Generated by udhcpc for interface ${interface}\n" | ||||||
| 	conf="${conf}restrict default noquery notrust nomodify\n" | 	conf="${conf}restrict default noquery notrust nomodify\n" | ||||||
| 	conf="${conf}restrict 127.0.0.1\n" | 	conf="${conf}restrict 127.0.0.1\n" | ||||||
| @@ -64,7 +64,7 @@ update_interface() | |||||||
| update_routes() | update_routes() | ||||||
| { | { | ||||||
| 	peer_var "${PEER_ROUTERS}" && return | 	peer_var "${PEER_ROUTERS}" && return | ||||||
| 	 |  | ||||||
| 	if [ -n "${router}" ] ; then | 	if [ -n "${router}" ] ; then | ||||||
| 		metric= | 		metric= | ||||||
| 		[ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}" | 		[ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}" | ||||||
|   | |||||||
| @@ -725,7 +725,7 @@ ewarn(const char *EINFO_RESTRICT fmt, ...) | |||||||
| 	int retval; | 	int retval; | ||||||
| 	va_list ap; | 	va_list ap; | ||||||
|  |  | ||||||
| 	if (!fmt || is_quiet()) | 	if (!fmt) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	va_start(ap, fmt); | 	va_start(ap, fmt); | ||||||
| 	elogv(LOG_WARNING, fmt, ap); | 	elogv(LOG_WARNING, fmt, ap); | ||||||
|   | |||||||
| @@ -54,6 +54,54 @@ rc_yesno(const char *value) | |||||||
| } | } | ||||||
| librc_hidden_def(rc_yesno) | librc_hidden_def(rc_yesno) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Read the entire @file into the buffer and set @len to the | ||||||
|  |  * size of the buffer when finished. For C strings, this will | ||||||
|  |  * be strlen(buffer) + 1. | ||||||
|  |  * Don't forget to free the buffer afterwards! | ||||||
|  |  */ | ||||||
|  | bool | ||||||
|  | rc_getfile(const char *file, char **buffer, size_t *len) | ||||||
|  | { | ||||||
|  | 	bool ret = false; | ||||||
|  | 	FILE *fp; | ||||||
|  | 	int fd; | ||||||
|  | 	struct stat st; | ||||||
|  | 	size_t done, left; | ||||||
|  |  | ||||||
|  | 	fp = fopen(file, "re"); | ||||||
|  | 	if (!fp) | ||||||
|  | 		return false; | ||||||
|  |  | ||||||
|  | 	/* assume fileno() never fails */ | ||||||
|  | 	fd = fileno(fp); | ||||||
|  |  | ||||||
|  | 	if (fstat(fd, &st)) | ||||||
|  | 		goto finished; | ||||||
|  |  | ||||||
|  | 	left = st.st_size; | ||||||
|  | 	*len = left + 1; /* NUL terminator */ | ||||||
|  | 	*buffer = xrealloc(*buffer, *len); | ||||||
|  | 	while (left) { | ||||||
|  | 		done = fread(*buffer, sizeof(*buffer[0]), left, fp); | ||||||
|  | 		if (done == 0 && ferror(fp)) | ||||||
|  | 			goto finished; | ||||||
|  | 		left -= done; | ||||||
|  | 	} | ||||||
|  | 	ret = true; | ||||||
|  |  | ||||||
|  |  finished: | ||||||
|  | 	if (!ret) { | ||||||
|  | 		free(*buffer); | ||||||
|  | 		*len = 0; | ||||||
|  | 	} else | ||||||
|  | 		(*buffer)[*len - 1] = '\0'; | ||||||
|  | 	fclose(fp); | ||||||
|  | 	return ret; | ||||||
|  | } | ||||||
|  | librc_hidden_def(rc_getfile) | ||||||
|  |  | ||||||
| ssize_t | ssize_t | ||||||
| rc_getline(char **line, size_t *len, FILE *fp) | rc_getline(char **line, size_t *len, FILE *fp) | ||||||
| { | { | ||||||
| @@ -173,10 +221,8 @@ rc_config_load(const char *file) | |||||||
| 		/* In shells the last item takes precedence, so we need to remove | 		/* In shells the last item takes precedence, so we need to remove | ||||||
| 		   any prior values we may already have */ | 		   any prior values we may already have */ | ||||||
| 		TAILQ_FOREACH(cline, config, entries) { | 		TAILQ_FOREACH(cline, config, entries) { | ||||||
| 			p = strchr(cline->value, '='); | 			i = strlen(entry); | ||||||
| 			if (p && strncmp(entry, cline->value, | 			if (strncmp(entry, cline->value, i) == 0 && cline->value[i] == '=') { | ||||||
| 				(size_t)(p - cline->value)) == 0) |  | ||||||
| 			{ |  | ||||||
| 				/* We have a match now - to save time we directly replace it */ | 				/* We have a match now - to save time we directly replace it */ | ||||||
| 				free(cline->value); | 				free(cline->value); | ||||||
| 				cline->value = newline; | 				cline->value = newline; | ||||||
| @@ -202,15 +248,13 @@ rc_config_value(RC_STRINGLIST *list, const char *entry) | |||||||
| { | { | ||||||
| 	RC_STRING *line; | 	RC_STRING *line; | ||||||
| 	char *p; | 	char *p; | ||||||
| 	size_t len, dif; | 	size_t len; | ||||||
|  |  | ||||||
| 	len = strlen(entry); | 	len = strlen(entry); | ||||||
| 	TAILQ_FOREACH(line, list, entries) { | 	TAILQ_FOREACH(line, list, entries) { | ||||||
| 		p = strchr(line->value, '='); | 		p = strchr(line->value, '='); | ||||||
| 		if (p != NULL) { | 		if (p != NULL) { | ||||||
| 			dif = (p - line->value); | 			if (strncmp(entry, line->value, len) == 0 && line->value[len] == '=') | ||||||
| 			if (dif == len && |  | ||||||
| 			    strncmp(entry, line->value, dif) == 0) |  | ||||||
| 				return ++p; | 				return ++p; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -767,19 +767,15 @@ librc_hidden_def(rc_service_state) | |||||||
| char * | char * | ||||||
| rc_service_value_get(const char *service, const char *option) | rc_service_value_get(const char *service, const char *option) | ||||||
| { | { | ||||||
| 	FILE *fp; | 	char *buffer = NULL; | ||||||
| 	char *line = NULL; |  | ||||||
| 	size_t len = 0; | 	size_t len = 0; | ||||||
| 	char file[PATH_MAX]; | 	char file[PATH_MAX]; | ||||||
|  |  | ||||||
| 	snprintf(file, sizeof(file), RC_SVCDIR "/options/%s/%s", | 	snprintf(file, sizeof(file), RC_SVCDIR "/options/%s/%s", | ||||||
| 	    service, option); | 	    service, option); | ||||||
| 	if ((fp = fopen(file, "r"))) { | 	rc_getfile(file, &buffer, &len); | ||||||
| 		rc_getline(&line, &len, fp); |  | ||||||
| 		fclose(fp); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return line; | 	return buffer; | ||||||
| } | } | ||||||
| librc_hidden_def(rc_service_value_get) | librc_hidden_def(rc_service_value_get) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -84,6 +84,7 @@ librc_hidden_proto(rc_deptree_order) | |||||||
| librc_hidden_proto(rc_deptree_update) | librc_hidden_proto(rc_deptree_update) | ||||||
| librc_hidden_proto(rc_deptree_update_needed) | librc_hidden_proto(rc_deptree_update_needed) | ||||||
| librc_hidden_proto(rc_find_pids) | librc_hidden_proto(rc_find_pids) | ||||||
|  | librc_hidden_proto(rc_getfile) | ||||||
| librc_hidden_proto(rc_getline) | librc_hidden_proto(rc_getline) | ||||||
| librc_hidden_proto(rc_newer_than) | librc_hidden_proto(rc_newer_than) | ||||||
| librc_hidden_proto(rc_older_than) | librc_hidden_proto(rc_older_than) | ||||||
|   | |||||||
| @@ -544,6 +544,9 @@ typedef LIST_HEAD(rc_pidlist, rc_pid) RC_PIDLIST; | |||||||
|  * @return NULL terminated list of pids */ |  * @return NULL terminated list of pids */ | ||||||
| RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t); | RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t); | ||||||
|  |  | ||||||
|  | /* Basically the same as rc_getline() below, it just returns multiple lines */ | ||||||
|  | bool rc_getfile(const char *, char **, size_t *); | ||||||
|  |  | ||||||
| /* getline is a handy glibc function that not all libcs have, so | /* getline is a handy glibc function that not all libcs have, so | ||||||
|  * we have our own */ |  * we have our own */ | ||||||
| ssize_t rc_getline(char **, size_t *, FILE *); | ssize_t rc_getline(char **, size_t *, FILE *); | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ global: | |||||||
| 	rc_deptree_update_needed; | 	rc_deptree_update_needed; | ||||||
| 	rc_environ_fd; | 	rc_environ_fd; | ||||||
| 	rc_find_pids; | 	rc_find_pids; | ||||||
|  | 	rc_getfile; | ||||||
| 	rc_getline; | 	rc_getline; | ||||||
| 	rc_newer_than; | 	rc_newer_than; | ||||||
| 	rc_older_than; | 	rc_older_than; | ||||||
|   | |||||||
| @@ -57,10 +57,8 @@ | |||||||
| #include "rc.h" | #include "rc.h" | ||||||
| #include "rc-misc.h" | #include "rc-misc.h" | ||||||
|  |  | ||||||
| #define LOGFILE RC_SVCDIR "/rc.log" | #define TMPLOG RC_SVCDIR "/rc.log" | ||||||
| #define PERMLOG "/var/log/rc.log" | #define DEFAULTLOG "/var/log/rc.log" | ||||||
| #define MOVELOG	"cat " LOGFILE " 2>/dev/null >>" PERMLOG " && "		      \ |  | ||||||
| 	"rm -f " LOGFILE |  | ||||||
|  |  | ||||||
| static int signal_pipe[2] = { -1, -1 }; | static int signal_pipe[2] = { -1, -1 }; | ||||||
| static int fd_stdout = -1; | static int fd_stdout = -1; | ||||||
| @@ -149,12 +147,15 @@ rc_logger_open(const char *level) | |||||||
| 	int slave_tty; | 	int slave_tty; | ||||||
| 	struct termios tt; | 	struct termios tt; | ||||||
| 	struct winsize ws; | 	struct winsize ws; | ||||||
| 	char *buffer; | 	char buffer[BUFSIZ]; | ||||||
| 	struct pollfd fd[2]; | 	struct pollfd fd[2]; | ||||||
| 	int s = 0; | 	int s = 0; | ||||||
| 	size_t bytes; | 	size_t bytes; | ||||||
| 	int i; | 	int i; | ||||||
| 	FILE *log = NULL; | 	FILE *log = NULL; | ||||||
|  | 	FILE *plog = NULL; | ||||||
|  | 	const char *logfile; | ||||||
|  | 	int log_error = 0; | ||||||
|  |  | ||||||
| 	if (!rc_conf_yesno("rc_logger")) | 	if (!rc_conf_yesno("rc_logger")) | ||||||
| 		return; | 		return; | ||||||
| @@ -192,7 +193,7 @@ rc_logger_open(const char *level) | |||||||
| 		signal_pipe[1] = -1; | 		signal_pipe[1] = -1; | ||||||
|  |  | ||||||
| 		runlevel = level; | 		runlevel = level; | ||||||
| 		if ((log = fopen(LOGFILE, "a"))) | 		if ((log = fopen(TMPLOG, "ae"))) | ||||||
| 			write_time(log, "started"); | 			write_time(log, "started"); | ||||||
| 		else { | 		else { | ||||||
| 			free(logbuf); | 			free(logbuf); | ||||||
| @@ -201,7 +202,6 @@ rc_logger_open(const char *level) | |||||||
| 			logbuf_len = 0; | 			logbuf_len = 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		buffer = xmalloc(sizeof (char) * BUFSIZ); |  | ||||||
| 		fd[0].fd = signal_pipe[0]; | 		fd[0].fd = signal_pipe[0]; | ||||||
| 		fd[0].events = fd[1].events = POLLIN; | 		fd[0].events = fd[1].events = POLLIN; | ||||||
| 		fd[0].revents = fd[1].revents = 0; | 		fd[0].revents = fd[1].revents = 0; | ||||||
| @@ -242,9 +242,8 @@ rc_logger_open(const char *level) | |||||||
| 			if (fd[0].revents & (POLLIN | POLLHUP)) | 			if (fd[0].revents & (POLLIN | POLLHUP)) | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 		free(buffer); |  | ||||||
| 		if (logbuf) { | 		if (logbuf) { | ||||||
| 			if ((log = fopen(LOGFILE, "a"))) { | 			if ((log = fopen(TMPLOG, "ae"))) { | ||||||
| 				write_time(log, "started"); | 				write_time(log, "started"); | ||||||
| 				write_log(fileno(log), logbuf, logbuf_len); | 				write_log(fileno(log), logbuf, logbuf_len); | ||||||
| 			} | 			} | ||||||
| @@ -255,10 +254,39 @@ rc_logger_open(const char *level) | |||||||
| 			fclose(log); | 			fclose(log); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		/* Try and cat our new logfile to a more permament location | 		/* Append the temporary log to the real log */ | ||||||
| 		   and then punt it */ | 		logfile = rc_conf_value("rc_log_path"); | ||||||
| 		if (system(MOVELOG) == -1) | 		if (logfile == NULL) | ||||||
| 			eerror("system: %s: %s", MOVELOG, strerror(errno)); | 			logfile = DEFAULTLOG; | ||||||
|  |  | ||||||
|  | 		if ((plog = fopen(logfile, "ae"))) { | ||||||
|  | 			if ((log = fopen(TMPLOG, "re"))) { | ||||||
|  | 				while ((bytes = fread(buffer, sizeof(*buffer), BUFSIZ, log)) > 0) { | ||||||
|  | 					if (fwrite(buffer, sizeof(*buffer), bytes, plog) < bytes) { | ||||||
|  | 						log_error = 1; | ||||||
|  | 						eerror("Error: write(%s) failed: %s", logfile, strerror(errno)); | ||||||
|  | 						break; | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				log_error = 1; | ||||||
|  | 				eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno)); | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			fclose(log); | ||||||
|  | 			fclose(plog); | ||||||
|  | 		} else { | ||||||
|  | 			log_error = 1; | ||||||
|  | 			eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno)); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		/* Try to keep the temporary log in case of errors */ | ||||||
|  | 		if (!log_error) { | ||||||
|  | 			if (unlink(TMPLOG) == -1) | ||||||
|  | 				eerror("Error: unlink(%s) failed: %s", TMPLOG, strerror(errno)); | ||||||
|  | 		} else if (exists(TMPLOG)) | ||||||
|  | 			eerrorx("Warning: temporary logfile left behind: %s", TMPLOG); | ||||||
|  |  | ||||||
| 		exit(0); | 		exit(0); | ||||||
| 		/* NOTREACHED */ | 		/* NOTREACHED */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1100,7 +1100,7 @@ runscript(int argc, char **argv) | |||||||
| 	bool doneone = false; | 	bool doneone = false; | ||||||
| 	int retval, opt, depoptions = RC_DEP_TRACE; | 	int retval, opt, depoptions = RC_DEP_TRACE; | ||||||
| 	RC_STRING *svc; | 	RC_STRING *svc; | ||||||
| 	char path[PATH_MAX], lnk[PATH_MAX], *dir, *save = NULL, *save2 = NULL; | 	char *save = NULL; | ||||||
| 	char pidstr[10]; | 	char pidstr[10]; | ||||||
| 	size_t l = 0, ll; | 	size_t l = 0, ll; | ||||||
| 	const char *file; | 	const char *file; | ||||||
| @@ -1120,40 +1120,7 @@ runscript(int argc, char **argv) | |||||||
|  |  | ||||||
| 	atexit(cleanup); | 	atexit(cleanup); | ||||||
|  |  | ||||||
| 	/* We need to work out the real full path to our service. | 	service = xstrdup(argv[1]); | ||||||
| 	 * This works fine, provided that we ONLY allow multiplexed services |  | ||||||
| 	 * to exist in the same directory as the master link. |  | ||||||
| 	 * Also, the master link as to be a real file in the init dir. */ |  | ||||||
| 	if (!realpath(argv[1], path)) { |  | ||||||
| 		fprintf(stderr, "realpath: %s\n", strerror(errno)); |  | ||||||
| 		exit(EXIT_FAILURE); |  | ||||||
| 	} |  | ||||||
| 	memset(lnk, 0, sizeof(lnk)); |  | ||||||
| 	if (readlink(argv[1], lnk, sizeof(lnk)-1)) { |  | ||||||
| 		dir = dirname(path); |  | ||||||
| 		if (strchr(lnk, '/')) { |  | ||||||
| 			save = xstrdup(dir); |  | ||||||
| 			save2 = xstrdup(lnk); |  | ||||||
| 			dir = dirname(save2); |  | ||||||
| 			if (strcmp(dir, save) == 0) |  | ||||||
| 				file = basename_c(argv[1]); |  | ||||||
| 			else |  | ||||||
| 				file = basename_c(lnk); |  | ||||||
| 			dir = save; |  | ||||||
| 		} else |  | ||||||
| 			file = basename_c(argv[1]); |  | ||||||
| 		ll = strlen(dir) + strlen(file) + 2; |  | ||||||
| 		service = xmalloc(ll); |  | ||||||
| 		snprintf(service, ll, "%s/%s", dir, file); |  | ||||||
| 		if (stat(service, &stbuf) != 0) { |  | ||||||
| 			free(service); |  | ||||||
| 			service = xstrdup(lnk); |  | ||||||
| 		} |  | ||||||
| 		free(save); |  | ||||||
| 		free(save2); |  | ||||||
| 	} |  | ||||||
| 	if (!service) |  | ||||||
| 		service = xstrdup(path); |  | ||||||
| 	applet = basename_c(service); | 	applet = basename_c(service); | ||||||
|  |  | ||||||
| 	if (argc < 3) | 	if (argc < 3) | ||||||
| @@ -1333,12 +1300,6 @@ runscript(int argc, char **argv) | |||||||
| 			prefix = NULL; | 			prefix = NULL; | ||||||
| 			retval = svc_exec("status", NULL); | 			retval = svc_exec("status", NULL); | ||||||
| 		} else { | 		} else { | ||||||
| 			if (strcmp(optarg, "pause") == 0) { |  | ||||||
| 				ewarn("WARNING: 'pause' is deprecated; please use '--nodeps stop'"); |  | ||||||
| 				deps = false; |  | ||||||
| 				optarg = "stop"; |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			if (strcmp(optarg, "conditionalrestart") == 0 || | 			if (strcmp(optarg, "conditionalrestart") == 0 || | ||||||
| 			    strcmp(optarg, "condrestart") == 0) | 			    strcmp(optarg, "condrestart") == 0) | ||||||
| 			{ | 			{ | ||||||
| @@ -1349,7 +1310,11 @@ runscript(int argc, char **argv) | |||||||
| 				svc_restart(); | 				svc_restart(); | ||||||
| 			} else if (strcmp(optarg, "start") == 0) { | 			} else if (strcmp(optarg, "start") == 0) { | ||||||
| 				svc_start(); | 				svc_start(); | ||||||
| 			} else if (strcmp(optarg, "stop") == 0) { | 			} else if (strcmp(optarg, "stop") == 0 || strcmp(optarg, "pause") == 0) { | ||||||
|  | 				if (strcmp(optarg, "pause") == 0) { | ||||||
|  | 					ewarn("WARNING: 'pause' is deprecated; please use '--nodeps stop'"); | ||||||
|  | 					deps = false; | ||||||
|  | 				} | ||||||
| 				if (deps && in_background) | 				if (deps && in_background) | ||||||
| 					get_started_services(); | 					get_started_services(); | ||||||
| 				svc_stop(); | 				svc_stop(); | ||||||
| @@ -1381,7 +1346,7 @@ runscript(int argc, char **argv) | |||||||
| 					    strerror(errno)); | 					    strerror(errno)); | ||||||
| 				unhotplug(); | 				unhotplug(); | ||||||
| 			} else | 			} else | ||||||
| 				svc_exec(optarg, NULL); | 				retval = svc_exec(optarg, NULL); | ||||||
|  |  | ||||||
| 			/* We should ensure this list is empty after | 			/* We should ensure this list is empty after | ||||||
| 			 * an action is done */ | 			 * an action is done */ | ||||||
|   | |||||||
| @@ -1183,8 +1183,6 @@ start_stop_daemon(int argc, char **argv) | |||||||
| 			pamr = pam_start("start-stop-daemon", | 			pamr = pam_start("start-stop-daemon", | ||||||
| 			    "nobody", &conv, &pamh); | 			    "nobody", &conv, &pamh); | ||||||
|  |  | ||||||
| 		if (pamr == PAM_SUCCESS) |  | ||||||
| 			pamr = pam_authenticate(pamh, PAM_SILENT); |  | ||||||
| 		if (pamr == PAM_SUCCESS) | 		if (pamr == PAM_SUCCESS) | ||||||
| 			pamr = pam_acct_mgmt(pamh, PAM_SILENT); | 			pamr = pam_acct_mgmt(pamh, PAM_SILENT); | ||||||
| 		if (pamr == PAM_SUCCESS) | 		if (pamr == PAM_SUCCESS) | ||||||
|   | |||||||
| @@ -24,6 +24,8 @@ rc_deptree_update_needed | |||||||
| rc_deptree_update_needed@@RC_1.0 | rc_deptree_update_needed@@RC_1.0 | ||||||
| rc_find_pids | rc_find_pids | ||||||
| rc_find_pids@@RC_1.0 | rc_find_pids@@RC_1.0 | ||||||
|  | rc_getfile | ||||||
|  | rc_getfile@@RC_1.0 | ||||||
| rc_getline | rc_getline | ||||||
| rc_getline@@RC_1.0 | rc_getline@@RC_1.0 | ||||||
| rc_newer_than | rc_newer_than | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user