Compare commits
	
		
			60 Commits
		
	
	
		
			openrc-0.9
			...
			funtoo-ope
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 52f593062a | ||
|   | 45209d7b95 | ||
|   | c9d06219c7 | ||
|   | 6e6cf26b99 | ||
|   | 58425a972c | ||
|   | b9204e97a1 | ||
|   | 2cd47b3b4d | ||
|   | f07d8154a9 | ||
|   | 173001713c | ||
|   | 875ee9529b | ||
|   | b3f70ca20b | ||
|   | de36b26d5e | ||
|   | ae7cbd910a | ||
|   | 92b274a7de | ||
|   | b3d47d5861 | ||
|   | f5ba232fb4 | ||
|   | 7e9861da0e | ||
|   | 6241f17e95 | ||
|   | 6cecc7b4a6 | ||
|   | 82d3918d7a | ||
|   | ee1a698451 | ||
|   | 2486eb4989 | ||
|   | 0813a80223 | ||
|   | 3969cb2a85 | ||
|   | b5917a817c | ||
|   | 9e196a71ad | ||
|   | ca7d67021e | ||
|   | 8c82637e76 | ||
|   | 8d63719418 | ||
|   | 3967077da3 | ||
|   | f971c4c0b5 | ||
|   | 9d0dce35c3 | ||
|   | 441272ff97 | ||
|   | fd6bbfbe07 | ||
|   | a6549a2b0f | ||
|   | 1f5072421e | ||
|   | 4943ddcb1c | ||
|   | be5de328e9 | ||
|   | 37af1693b4 | ||
|   | 9127684553 | ||
|   | 0571a7e05b | ||
|   | 300c03203d | ||
|   | f9162438bc | ||
|   | 533813dda0 | ||
|   | 6ac182c9ca | ||
|   | 09327f429f | ||
|   | 8104618d10 | ||
|   | eb11953dd2 | ||
|   | b264931034 | ||
|   | 76d3fceb58 | ||
|   | 65be94a34a | ||
|   | c75352af3d | ||
|   | b27a9003bb | ||
|   | 9fa54a8e80 | ||
|   | 7a1e4ef606 | ||
|   | 0dc9431bdb | ||
|   | 0fa164dff2 | ||
|   | 582c8e9868 | ||
|   | de6323ba51 | ||
|   | 3272261479 | 
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -25,6 +25,8 @@ include ${MK}/dist.mk | |||||||
| include ${MK}/git.mk | include ${MK}/git.mk | ||||||
|  |  | ||||||
| _installafter: | _installafter: | ||||||
|  | ifneq ($(OS),Linux) | ||||||
| 	${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/init.d | 	${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/init.d | ||||||
|  | endif | ||||||
| 	${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/tmp | 	${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/tmp | ||||||
| 	${ECHO} "${VERSION}${GITVER}" > ${DESTDIR}/${LIBEXECDIR}/version | 	${ECHO} "${VERSION}${GITVER}" > ${DESTDIR}/${LIBEXECDIR}/version | ||||||
|   | |||||||
| @@ -1,3 +1,3 @@ | |||||||
| NAME=		openrc | NAME=		openrc | ||||||
| VERSION=	0.9.9.1 | VERSION=	0.10 | ||||||
| PKG=		${NAME}-${VERSION} | PKG=		${NAME}-${VERSION} | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								TODO
									
									
									
									
									
								
							| @@ -5,3 +5,17 @@ | |||||||
| - oldnet[bridging]: Review setting of bridge configuration on dynamic interface add | - oldnet[bridging]: Review setting of bridge configuration on dynamic interface add | ||||||
|  |  | ||||||
| - Document rc-depend binary. | - Document rc-depend binary. | ||||||
|  |  | ||||||
|  | - _ifindex is not a reliable means of calculating metrics: | ||||||
|  | 	_ifindex is used for calculating metrics for new devices but has a major | ||||||
|  | 	problem: Since it's only the nth entry in /proc/net/dev | ||||||
|  | 	And devices may be removed from that file, and reordered, you won't always | ||||||
|  | 	get the same result. | ||||||
|  | 	If you do: | ||||||
|  | 	- add eth0 - _ifindex (eth0=0) | ||||||
|  | 	- add vlan1 - _ifindex (eth0=0,vlan1=1) | ||||||
|  | 	- add vlan2 - _ifindex (eth0=0,vlan1=1,vlan2=2) | ||||||
|  | 	- rem vlan1 - _ifindex (eth0=0,vlan2=1) | ||||||
|  | 	- add vlan3 - _ifindex (eth0=0,vlan2=1,vlan3=2) | ||||||
|  | 	Now your routing table has entries for both vlan2 and vlan3 with a metric of 2. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,9 +1,10 @@ | |||||||
|  | # The consolefont service is not activated by default. If you need to | ||||||
|  | # use it, you should run "rc-update add consolefont boot" as root. | ||||||
|  | # | ||||||
| # consolefont specifies the default font that you'd like Linux to use on the | # consolefont specifies the default font that you'd like Linux to use on the | ||||||
| # console.  You can find a good selection of fonts in /usr/share/consolefonts; | # console.  You can find a good selection of fonts in /usr/share/consolefonts; | ||||||
| # you shouldn't specify the trailing ".psf.gz", just the font name below. | # you shouldn't specify the trailing ".psf.gz", just the font name below. | ||||||
| # To use the default console font, comment out the CONSOLEFONT setting below. | # To use the default console font, comment out the CONSOLEFONT setting below. | ||||||
| # This setting is used by the /etc/init.d/consolefont script (NOTE: if you do |  | ||||||
| # not want to use it, run "rc-update del consolefont boot" as root). |  | ||||||
| consolefont="default8x16" | consolefont="default8x16" | ||||||
|  |  | ||||||
| # consoletranslation is the charset map file to use.  Leave commented to use | # consoletranslation is the charset map file to use.  Leave commented to use | ||||||
|   | |||||||
| @@ -4,9 +4,11 @@ | |||||||
| # you should set it to "local". | # you should set it to "local". | ||||||
| clock="UTC" | clock="UTC" | ||||||
|  |  | ||||||
| # If you want to set the system time to the current hardware clock | # If you want the hwclock script to set the system time (software clock) | ||||||
| # during bootup, then say "YES" here. You do not need this if you are | # to match the current hardware clock during bootup, leave this | ||||||
| # running a modern kernel with CONFIG_RTC_HCTOSYS set to y. | # commented out. | ||||||
|  | # However, you can set this to "NO" ifyou are running a modern kernel | ||||||
|  | # with CONFIG_RTC_HCTOSYS set to y and your hardware clock set to UTC. | ||||||
| #clock_hctosys="YES" | #clock_hctosys="YES" | ||||||
|  |  | ||||||
| # If you do not want to set the hardware clock to the current system | # If you do not want to set the hardware clock to the current system | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ | |||||||
| # In other words, you probably should DO NOTHING HERE... | # In other words, you probably should DO NOTHING HERE... | ||||||
|  |  | ||||||
| # Prefer ifconfig over iproute2 | # Prefer ifconfig over iproute2 | ||||||
| #modules="ifconfig" | #modules="!iproute2" | ||||||
|  |  | ||||||
| # You can also specify other modules for an interface | # You can also specify other modules for an interface | ||||||
| # In this case we prefer udhcpc over dhcpcd | # In this case we prefer udhcpc over dhcpcd | ||||||
| @@ -57,7 +57,7 @@ | |||||||
|  |  | ||||||
| # If you don't specify an interface then we prefer iproute2 if it's installed | # If you don't specify an interface then we prefer iproute2 if it's installed | ||||||
| # To prefer ifconfig over iproute2 | # To prefer ifconfig over iproute2 | ||||||
| #modules="ifconfig" | #modules="!iproute2" | ||||||
|  |  | ||||||
| # For a static configuration, use something like this | # For a static configuration, use something like this | ||||||
| # (They all do exactly the same thing btw) | # (They all do exactly the same thing btw) | ||||||
| @@ -616,9 +616,22 @@ | |||||||
| #slaves_bond0="eth0 eth1 eth2" | #slaves_bond0="eth0 eth1 eth2" | ||||||
| #config_bond0="null" # You may not want to assign an IP the the bond | #config_bond0="null" # You may not want to assign an IP the the bond | ||||||
|  |  | ||||||
| # You can also configure the bond here, which must be done via sysfs on 2.6 | # Please note, that you should generally NOT try to change the MAC addresses of | ||||||
| # kernels or newer. See the kernel bonding documentation for a description of | # a bond interface yourself. If you do so, the kernel and your network switches | ||||||
| # these options. | # may not work quite right. It is permissible to set the MAC addresses of bond | ||||||
|  | # slaves BEFORE the bond comes up, but not after the bond is up (it will change | ||||||
|  | # MAC addresses of the slaves on it's own). | ||||||
|  |  | ||||||
|  | # You can also configure the parameters of the bond here, which must be done | ||||||
|  | # via sysfs on 2.6 kernels or newer. The description of all the options can be | ||||||
|  | # found in the kernel: /usr/src/linux-*/Documentation/networking/bonding.txt | ||||||
|  | # You will probably want the 'mode' option at the least. | ||||||
|  | # Some possible parameters: mode fail_over_mac arp_validate arp_interval | ||||||
|  | # arp_ip_target downdelay updelay lacp_rate ad_select xmit_hash_policy | ||||||
|  | # num_grat_arp num_unsol_na miimon primary primary_reselect use_carrier | ||||||
|  | # active_slave queue_id all_slaves_active resend_igmp min_links | ||||||
|  | #mode_bond0="round-robin" | ||||||
|  | #miimon_bond0="100" | ||||||
| #arp_ip_target_bond0="+26.0.0.0" | #arp_ip_target_bond0="+26.0.0.0" | ||||||
|  |  | ||||||
| # If any of the slaves require extra configuration - for example wireless or | # If any of the slaves require extra configuration - for example wireless or | ||||||
| @@ -780,6 +793,8 @@ | |||||||
|  |  | ||||||
| #----------------------------------------------------------------------------- | #----------------------------------------------------------------------------- | ||||||
| # MAC changer | # MAC changer | ||||||
|  | # Warning: Do NOT use this on bonding interfaces! Bonding changes MACs itself. | ||||||
|  | # | ||||||
| # To set a specific MAC address | # To set a specific MAC address | ||||||
| #mac_eth0="00:11:22:33:44:55" | #mac_eth0="00:11:22:33:44:55" | ||||||
|  |  | ||||||
| @@ -1096,6 +1111,13 @@ | |||||||
| # Hypothetical network card that requires a change-eeprom toggle to enable flashing | # Hypothetical network card that requires a change-eeprom toggle to enable flashing | ||||||
| #ethtool_order_eth0="change-eeprom flash change pause coalesce ring offload nfc rxfh-indir ntuple" | #ethtool_order_eth0="change-eeprom flash change pause coalesce ring offload nfc rxfh-indir ntuple" | ||||||
|  |  | ||||||
|  | #----------------------------------------------------------------------------- | ||||||
|  | # Firewalld support | ||||||
|  | # If you are using the firewalld daemon to configure your firewall | ||||||
|  | # settings and you have specific zones you want to apply to your | ||||||
|  | # interfaces, you can do this here. | ||||||
|  | #firewalld_zone_eth0="myzone" | ||||||
|  |  | ||||||
| ############################################################################## | ############################################################################## | ||||||
| # ADVANCED CONFIGURATION | # ADVANCED CONFIGURATION | ||||||
| # | # | ||||||
|   | |||||||
| @@ -71,7 +71,12 @@ start() | |||||||
| 	done | 	done | ||||||
|  |  | ||||||
| 	if [ "$RC_UNAME" = Linux ]; then | 	if [ "$RC_UNAME" = Linux ]; then | ||||||
| 		fsck_opts="$fsck_opts -C0 -T" | 		local skiptypes x | ||||||
|  | 		for x in $net_fs_list $extra_net_fs_list; do | ||||||
|  | 			skiptypes="${skiptypes}no${x}," | ||||||
|  | 		done | ||||||
|  | 		skiptypes="${skiptypes}noopts=_netdev" | ||||||
|  | 		fsck_opts="$fsck_opts -C0 -T -t $skiptypes" | ||||||
| 		if [ -z "$fsck_passno" -a -z "$fsck_mnt" ]; then | 		if [ -z "$fsck_passno" -a -z "$fsck_mnt" ]; then | ||||||
| 			fsck_args=${fsck_args--A -p} | 			fsck_args=${fsck_args--A -p} | ||||||
| 			if echo 2>/dev/null >/.test.$$; then | 			if echo 2>/dev/null >/.test.$$; then | ||||||
|   | |||||||
| @@ -5,12 +5,38 @@ | |||||||
| description="Sets the hostname of the machine." | description="Sets the hostname of the machine." | ||||||
|  |  | ||||||
| depend() { | depend() { | ||||||
| 	keyword -lxc | 	need root | ||||||
| } | } | ||||||
|  |  | ||||||
| start() | start() | ||||||
| { | { | ||||||
| 	hostname=${hostname-${HOSTNAME-localhost}} | 	hostname=${hostname-${HOSTNAME-localhost}} | ||||||
|  | 	out=$hostname | ||||||
|  | 	short=${hostname%%.*} | ||||||
|  | 	if [ "$short" != "$hostname" ]; then | ||||||
|  | 		out="$out $short" | ||||||
|  | 	fi | ||||||
|  | 	if [ "$nisdomainname" != "" ]; then | ||||||
|  | 		ebegin "Setting NIS domain name to $nisdomainname" | ||||||
|  | 		nisdomainname $nisdomainname | ||||||
|  | 		eend $? "Failed to set the NIS domain name" | ||||||
|  | 	fi | ||||||
|  | 	if [ "$short" != "localhost" ]; then | ||||||
|  | 		out="$out localhost" | ||||||
|  | 	fi | ||||||
|  | 	if [ "$hostname" != "localhost.localdomain" ]; then | ||||||
|  | 		out="$out localhost.localdomain" | ||||||
|  | 	fi | ||||||
|  | 	[ -n "$aliases" ] && out="$out $aliases" | ||||||
|  | 	ebegin "Configuring /etc/hosts" | ||||||
|  | 	[ -e /etc/hosts ] && sed -i -e '/[[:space:]]*127.0.0.1[[:space:]]/d' -e '/[[:space:]]*::1[[:space:]]/d' /etc/hosts | ||||||
|  | 	cat <<END >> /etc/hosts | ||||||
|  | 127.0.0.1	$out | ||||||
|  | ::1		$out | ||||||
|  | END | ||||||
|  | 	chmod 0644 /etc/hosts | ||||||
|  | 	eend $? | ||||||
|  | 	[ "$RC_SYS" = "LXC" ] && return 0 | ||||||
| 	ebegin "Setting hostname to $hostname" | 	ebegin "Setting hostname to $hostname" | ||||||
| 	hostname "$hostname" | 	hostname "$hostname" | ||||||
| 	eend $? "Failed to set the hostname" | 	eend $? "Failed to set the hostname" | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ depend() | |||||||
| 	need fsck | 	need fsck | ||||||
| 	use lvm modules mtab | 	use lvm modules mtab | ||||||
| 	after lvm modules | 	after lvm modules | ||||||
| 	keyword -jail -openvz -vserver -lxc | 	keyword -jail -vserver -lxc | ||||||
| } | } | ||||||
|  |  | ||||||
| start() | start() | ||||||
| @@ -33,6 +33,7 @@ start() | |||||||
|  |  | ||||||
| stop() | stop() | ||||||
| { | { | ||||||
|  | 	yesno $RC_GOINGDOWN || return 0 | ||||||
| 	# We never unmount / or /dev or $RC_SVCDIR | 	# We never unmount / or /dev or $RC_SVCDIR | ||||||
|  |  | ||||||
| 	# Bug 381783 | 	# Bug 381783 | ||||||
| @@ -47,7 +48,7 @@ stop() | |||||||
| 	done | 	done | ||||||
|  |  | ||||||
| 	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/.*|/usr" | ||||||
| 	fi | 	fi | ||||||
| 	no_umounts_r="^($no_umounts_r)$" | 	no_umounts_r="^($no_umounts_r)$" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ start() | |||||||
| 	# Bug 381783 | 	# Bug 381783 | ||||||
| 	local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g') | 	local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g') | ||||||
|  |  | ||||||
| 	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${rc_svcdir}" x= fs= | 	local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|/run|${rc_svcdir}" x= fs= | ||||||
| 	m="$m|/bin|/sbin|/lib(32|64)?|/libexec" | 	m="$m|/bin|/sbin|/lib(32|64)?|/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 IFS="$IFS:" | 	local IFS="$IFS:" | ||||||
|   | |||||||
| @@ -19,6 +19,9 @@ depend() | |||||||
| 	local IFVAR=$(shell_var "${IFACE}") | 	local IFVAR=$(shell_var "${IFACE}") | ||||||
|  |  | ||||||
| 	need localmount | 	need localmount | ||||||
|  | 	if [ "$RC_UNAME" = Linux ]; then | ||||||
|  | 		need sysfs | ||||||
|  | 	fi | ||||||
| 	after bootmisc | 	after bootmisc | ||||||
| 	keyword -jail -vserver | 	keyword -jail -vserver | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ start() | |||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	[ "$RC_SYS" == "OPENVZ" ] && return 0 | 	[ "$RC_SYS" = "OPENVZ" ] && return 0 | ||||||
|  |  | ||||||
| 	# Check what USB fs the kernel support.  Currently | 	# Check what USB fs the kernel support.  Currently | ||||||
| 	# 2.5+ kernels, and later 2.4 kernels have 'usbfs', | 	# 2.5+ kernels, and later 2.4 kernels have 'usbfs', | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ start() | |||||||
| 	local retval=0 var= comments= conf= | 	local retval=0 var= comments= conf= | ||||||
| 	ebegin "Configuring kernel parameters" | 	ebegin "Configuring kernel parameters" | ||||||
| 	eindent | 	eindent | ||||||
| 	for conf in /etc/sysctl.d/*.conf /etc/sysctl.conf; do | 	for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do | ||||||
| 		if [ -r "$conf" ]; then | 		if [ -r "$conf" ]; then | ||||||
| 			vebegin "applying $conf" | 			vebegin "applying $conf" | ||||||
| 			while read var comments; do | 			while read var comments; do | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
| depend() | depend() | ||||||
| { | { | ||||||
| 	before bootmisc logger | 	before bootmisc logger | ||||||
| 	keyword -vserver | 	keyword -lxc -vserver | ||||||
| } | } | ||||||
|  |  | ||||||
| start() | start() | ||||||
| @@ -15,12 +15,20 @@ start() | |||||||
| 	ebegin "Configuring kernel parameters" | 	ebegin "Configuring kernel parameters" | ||||||
| 	eindent | 	eindent | ||||||
|  |  | ||||||
| 	for conf in /etc/sysctl.d/*.conf /etc/sysctl.conf; do | 	# default sysctl System V max shared memory to 1/4 of RAM: | ||||||
|  | 	mem_bytes=`awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo` | ||||||
|  | 	mem_max=`expr $mem_bytes / 4`  | ||||||
|  | 	page_size=`getconf PAGE_SIZE` | ||||||
|  | 	shmall=`expr $mem_bytes / $page_size` | ||||||
|  | 	sysctl kernel.shmmax=$mem_max > /dev/null | ||||||
|  | 	sysctl kernel.shmall=$shmall > /dev/null | ||||||
|  |  | ||||||
|  | 	for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do | ||||||
| 		if [ -r "$conf" ]; then | 		if [ -r "$conf" ]; then | ||||||
| 			vebegin "applying $conf" | 			vebegin "applying $conf" | ||||||
| 			if ! err=$(sysctl -q -p "$conf" 2>&1) ; then | 			if ! err=$(sysctl -p "$conf" 2>&1 >/dev/null) ; then | ||||||
| 				errs="${errs} ${err}" | 				errs="${errs} ${err}" | ||||||
| 				sysctl -q -e -p "${conf}" | 				sysctl -e -p "${conf}" >/dev/null | ||||||
| 			fi | 			fi | ||||||
| 			veend $? || retval=1 | 			veend $? || retval=1 | ||||||
| 		fi | 		fi | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} | |||||||
|  |  | ||||||
| depend() | depend() | ||||||
| { | { | ||||||
| 	keyword -openvz -uml -vserver -xenu | 	keyword -lxc -openvz -uml -vserver -xenu | ||||||
| 	use root | 	use root | ||||||
| 	after bootmisc | 	after bootmisc | ||||||
| } | } | ||||||
|   | |||||||
| @@ -92,7 +92,8 @@ or stopping them. | |||||||
| The following variables affect the service script: | The following variables affect the service script: | ||||||
| .Bl -tag -width "RC_DEFAULTLEVEL" | .Bl -tag -width "RC_DEFAULTLEVEL" | ||||||
| .It Ar extra_commands | .It Ar extra_commands | ||||||
| Space separated list of extra commands the service defines. | Space separated list of extra commands the service defines. These should | ||||||
|  | not depend on the service being stopped or started. | ||||||
| .It Ar extra_started_commands | .It Ar extra_started_commands | ||||||
| Space separated list of extra commands the service defines. These only work if | Space separated list of extra commands the service defines. These only work if | ||||||
| the service has already been started. | the service has already been started. | ||||||
| @@ -123,6 +124,10 @@ Display name used for the above defined command. | |||||||
| .It Ar retry | .It Ar retry | ||||||
| Retry schedule to use when stopping the daemon. It can either be a | Retry schedule to use when stopping the daemon. It can either be a | ||||||
| timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5). | timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5). | ||||||
|  | .It Ar required_dirs | ||||||
|  | A list of directories which must exist for the service to start. | ||||||
|  | .It Ar required_files | ||||||
|  | A list of files which must exist for the service to start. | ||||||
| .El | .El | ||||||
| .Sh DEPENDENCIES | .Sh DEPENDENCIES | ||||||
| You should define a | You should define a | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
| ifeq (${MKTERMCAP},ncurses) | ifeq (${MKTERMCAP},ncurses) | ||||||
|  | 	LTERMCAP:=	$(shell pkg-config ncurses --libs 2> /dev/null) | ||||||
|  | ifeq ($(LTERMCAP),) | ||||||
| LIBTERMCAP?=	-lncurses | LIBTERMCAP?=	-lncurses | ||||||
|  | else | ||||||
|  | LIBTERMCAP?= $(LTERMCAP) | ||||||
|  | endif | ||||||
| CPPFLAGS+=	-DHAVE_TERMCAP | CPPFLAGS+=	-DHAVE_TERMCAP | ||||||
| LDADD+=		${LIBTERMCAP} | LDADD+=		${LIBTERMCAP} | ||||||
| else ifeq (${MKTERMCAP},termcap) | else ifeq (${MKTERMCAP},termcap) | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ SRCS-Linux=	iwconfig.sh.in | |||||||
| INC-Linux=	adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ | INC-Linux=	adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ | ||||||
| 		ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \ | 		ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \ | ||||||
| 		ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \ | 		ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \ | ||||||
| 		vlan.sh macvlan.sh | 		vlan.sh macvlan.sh ip6rd.sh firewalld.sh | ||||||
|  |  | ||||||
| SRCS-NetBSD= | SRCS-NetBSD= | ||||||
| INC-NetBSD=	ifwatchd.sh | INC-NetBSD=	ifwatchd.sh | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								net/firewalld.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								net/firewalld.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | # Copyright (c) 2012 Doug Goldstein <cardoe@cardoe.com> | ||||||
|  | # Released under the 2-clause BSD license. | ||||||
|  |  | ||||||
|  | firewalld_depend() | ||||||
|  | { | ||||||
|  | 	after interface | ||||||
|  | 	before dhcp | ||||||
|  | 	program firewall-cmd | ||||||
|  | 	[ "$IFACE" != "lo" ] && need firewalld | ||||||
|  | } | ||||||
|  |  | ||||||
|  | _config_vars="$_config_vars firewalld_zone" | ||||||
|  |  | ||||||
|  | firewalld_post_start() | ||||||
|  | { | ||||||
|  | 	local firewalld_zone= | ||||||
|  | 	eval firewalld_zone=\$firewalld_zone_${IFVAR} | ||||||
|  |  | ||||||
|  | 	_exists || return 0 | ||||||
|  |  | ||||||
|  | 	if [ "${IFACE}" != "lo" ]; then | ||||||
|  | 		firewall-cmd --zone="${firewalld_zone}" \ | ||||||
|  | 			--change-interface="${IFACE}" > /dev/null 2>&1 | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | firewalld_pre_stop() | ||||||
|  | { | ||||||
|  | 	_exists || return 0 | ||||||
|  |  | ||||||
|  | 	if [ "${IFACE}" != "lo" ]; then | ||||||
|  | 		firewall-cmd --remove-interface="${IFACE}" > /dev/null 2>&1 | ||||||
|  | 	fi | ||||||
|  |  | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| ifconfig_depend() | ifconfig_depend() | ||||||
| { | { | ||||||
| 	program /sbin/ifconfig | 	program /sbin/ifconfig /bin/ifconfig | ||||||
| 	provide interface | 	provide interface | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -19,24 +19,24 @@ _down() | |||||||
|  |  | ||||||
| _exists() | _exists() | ||||||
| { | { | ||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | 	[ -e /sys/class/net/"$IFACE" ] | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifindex() | _ifindex() | ||||||
| { | { | ||||||
| 	local line= i=-2 | 	local index=-1 | ||||||
| 	while read line; do | 	local f v | ||||||
| 		: $(( i += 1 )) | 	if [ -e /sys/class/net/"${IFACE}"/ifindex ]; then | ||||||
| 		[ ${i} -lt 1 ] && continue | 		index=$(cat /sys/class/net/"${IFACE}"/ifindex) | ||||||
| 		case "${line}" in | 	else | ||||||
| 			"${IFACE}:"*) echo "${i}"; return 0;; | 		for f in /sys/class/net/*/ifindex ; do | ||||||
| 		esac | 			v=$(cat $f) | ||||||
| 	done < /proc/net/dev | 			[ $v -gt $index ] && index=$v | ||||||
|  | 		done | ||||||
| 	# Return the next available index | 		: $(( index += 1 )) | ||||||
| 	: $(( i += 1 )) | 	fi | ||||||
| 	echo "${i}" | 	echo "${index}" | ||||||
| 	return 1 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _is_wireless() | _is_wireless() | ||||||
|   | |||||||
| @@ -20,24 +20,24 @@ _down() | |||||||
|  |  | ||||||
| _exists() | _exists() | ||||||
| { | { | ||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | 	[ -e /sys/class/net/"$IFACE" ] | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifindex() | _ifindex() | ||||||
| { | { | ||||||
| 	local line= i=-2 | 	local index=-1 | ||||||
| 	while read line; do | 	local f v | ||||||
| 		: $(( i += 1 )) | 	if [ -e /sys/class/net/"${IFACE}"/ifindex ]; then | ||||||
| 		[ ${i} -lt 1 ] && continue | 		index=$(cat /sys/class/net/"${IFACE}"/ifindex) | ||||||
| 		case "${line}" in | 	else | ||||||
| 			"${IFACE}:"*) echo "${i}"; return 0;; | 		for f in /sys/class/net/*/ifindex ; do | ||||||
| 		esac | 			v=$(cat $f) | ||||||
| 	done < /proc/net/dev | 			[ $v -gt $index ] && index=$v | ||||||
|  | 		done | ||||||
| 	# Return the next available index | 		: $(( index += 1 )) | ||||||
| 	: $(( i += 1 )) | 	fi | ||||||
| 	echo "${i}" | 	echo "${index}" | ||||||
| 	return 1 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _is_wireless() | _is_wireless() | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ udhcpc_start() | |||||||
| 			if ${sendhost}; then | 			if ${sendhost}; then | ||||||
| 				local hname="$(hostname)" | 				local hname="$(hostname)" | ||||||
| 				if [ "${hname}" != "(none)" ] && [ "${hname}" != "localhost" ]; then | 				if [ "${hname}" != "(none)" ] && [ "${hname}" != "localhost" ]; then | ||||||
| 					args="${args} --hostname='${hname}'" | 					args="${args} -x hostname:'${hname}'" | ||||||
| 				fi | 				fi | ||||||
| 			fi | 			fi | ||||||
| 			;; | 			;; | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								sh/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								sh/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -9,3 +9,5 @@ init-early.sh | |||||||
| ifwatchd-carrier.sh | ifwatchd-carrier.sh | ||||||
| ifwatchd-nocarrier.sh | ifwatchd-nocarrier.sh | ||||||
| udhcpc-hook.sh | udhcpc-hook.sh | ||||||
|  | tmpfiles.sh | ||||||
|  | migrate-to-run.sh | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							| @@ -1,8 +1,8 @@ | |||||||
| DIR=	${LIBEXECDIR}/sh | 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 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 | 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 | INSTALLAFTER=	_installafter | ||||||
|  |  | ||||||
| @@ -12,8 +12,10 @@ include ${MK}/os.mk | |||||||
| SRCS-FreeBSD= | SRCS-FreeBSD= | ||||||
| BIN-FreeBSD= | BIN-FreeBSD= | ||||||
|  |  | ||||||
| SRCS-Linux=	cgroup-release-agent.sh.in init-early.sh.in udhcpc-hook.sh.in | SRCS-Linux=	cgroup-release-agent.sh.in init-early.sh.in migrate-to-run.sh.in \ | ||||||
| BIN-Linux=	cgroup-release-agent.sh init-early.sh udhcpc-hook.sh | 	udhcpc-hook.sh.in | ||||||
|  | BIN-Linux=	cgroup-release-agent.sh init-early.sh migrate-to-run.sh \ | ||||||
|  | 	udhcpc-hook.sh | ||||||
|  |  | ||||||
| SRCS-NetBSD=	ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in | SRCS-NetBSD=	ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in | ||||||
| BIN-NetBSD=	ifwatchd-carrier.sh ifwatchd-nocarrier.sh | BIN-NetBSD=	ifwatchd-carrier.sh ifwatchd-nocarrier.sh | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | ||||||
| # Released under the 2-clause BSD license. | # Released under the 2-clause BSD license. | ||||||
|  |  | ||||||
| . @SYSCONFDIR@/init.d/functions.sh | . @LIBEXECDIR@/sh/functions.sh | ||||||
| . @LIBEXECDIR@/sh/rc-functions.sh | . @LIBEXECDIR@/sh/rc-functions.sh | ||||||
|  |  | ||||||
| config() { | config() { | ||||||
|   | |||||||
| @@ -3,62 +3,6 @@ | |||||||
| # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | ||||||
| # Released under the 2-clause BSD license. | # Released under the 2-clause BSD license. | ||||||
|  |  | ||||||
| # This basically mounts $RC_SVCDIR as a ramdisk. |  | ||||||
| # The tricky part is finding something our kernel supports |  | ||||||
| # tmpfs and ramfs are easy, so force one or the other. |  | ||||||
| svcdir_restorecon() |  | ||||||
| { |  | ||||||
| 	local rc=0 |  | ||||||
| 	if [ -x /usr/sbin/selinuxenabled -a -c /selinux/null ] && |  | ||||||
| 	  selinuxenabled; then |  | ||||||
| 		restorecon $RC_SVCDIR |  | ||||||
| 		rc=$? |  | ||||||
| 	fi |  | ||||||
| 	return $rc |  | ||||||
| } |  | ||||||
|  |  | ||||||
| mount_svcdir() |  | ||||||
| { |  | ||||||
| 	# mount from fstab if we can |  | ||||||
| 	fstabinfo --mount "$RC_SVCDIR" && return 0 |  | ||||||
|  |  | ||||||
| 	local fs= fsopts="-o rw,noexec,nodev,nosuid" |  | ||||||
| 	local svcsize=${rc_svcsize:-1024} |  | ||||||
|  |  | ||||||
| 	# Some buggy kernels report tmpfs even when not present :( |  | ||||||
| 	if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then |  | ||||||
| 		local tmpfsopts="${fsopts},mode=755,size=${svcsize}k" |  | ||||||
| 		mount -n -t tmpfs $tmpfsopts rc-svcdir "$RC_SVCDIR" |  | ||||||
| 		if [ $? -eq 0 ]; then |  | ||||||
| 			svcdir_restorecon |  | ||||||
| 			[ $? -eq 0 ] && return 0 |  | ||||||
| 		fi |  | ||||||
| 	fi |  | ||||||
|  |  | ||||||
| 	if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then |  | ||||||
| 		fs="ramfs" |  | ||||||
| 		# ramfs has no special options |  | ||||||
| 	elif [ -e /dev/ram0 ] \ |  | ||||||
| 		&& grep -Eq "[[:space:]]+ext2$" /proc/filesystems; then |  | ||||||
| 		devdir="/dev/ram0" |  | ||||||
| 		fs="ext2" |  | ||||||
| 		dd if=/dev/zero of="$devdir" bs=1k count="$svcsize" |  | ||||||
| 		mkfs -t "$fs" -i 1024 -vm0 "$devdir" "$svcsize" |  | ||||||
| 	else |  | ||||||
| 		echo |  | ||||||
| 		eerror "OpenRC requires tmpfs, ramfs or a ramdisk + ext2" |  | ||||||
| 		eerror "compiled into the kernel" |  | ||||||
| 		echo |  | ||||||
| 		return 1 |  | ||||||
| 	fi |  | ||||||
|  |  | ||||||
| 	mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR" |  | ||||||
| 	if [ $? -eq 0 ]; then |  | ||||||
| 		svcdir_restorecon |  | ||||||
| 		[ $? -eq 0 ] && return 0 |  | ||||||
| 	fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
| . "$RC_LIBEXECDIR"/sh/functions.sh | . "$RC_LIBEXECDIR"/sh/functions.sh | ||||||
| [ -r /etc/rc.conf ] && . /etc/rc.conf | [ -r /etc/rc.conf ] && . /etc/rc.conf | ||||||
|  |  | ||||||
| @@ -75,7 +19,7 @@ if [ -e $f ]; then | |||||||
| 	if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then | 	if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then | ||||||
| 		eerror "You have cruft in /proc that should be deleted" | 		eerror "You have cruft in /proc that should be deleted" | ||||||
| 	else | 	else | ||||||
| 		einfo "/proc is already mounted, skipping" | 		einfo "/proc is already mounted" | ||||||
| 		mountproc=false | 		mountproc=false | ||||||
| 	fi | 	fi | ||||||
| fi | fi | ||||||
| @@ -91,24 +35,32 @@ if $mountproc; then | |||||||
| 	eend $? | 	eend $? | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # Mount tmpfs on /run when directory exists. |  | ||||||
| # /run is a new directory for storing volatile runtime data. | # /run is a new directory for storing volatile runtime data. | ||||||
| # Read more about /run at https://lwn.net/Articles/436012 | # Read more about /run at https://lwn.net/Articles/436012 | ||||||
| if [ -d /run ]; then | if [ ! -d /run ]; then | ||||||
| 	if mountinfo -q /run; then | 	eerror "The /run directory does not exist. Unable to continue." | ||||||
| 		einfo "/run is already mounted, skipping" | 	return 1 | ||||||
| 	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 | fi | ||||||
|  |  | ||||||
|  | if mountinfo -q /run; then | ||||||
|  | 	einfo "/run is already mounted, skipping" | ||||||
|  | else | ||||||
|  | 	ebegin "Mounting /run" | ||||||
|  | 	rc=0 | ||||||
|  | 	if ! fstabinfo --mount /run; then | ||||||
|  | 		mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run | ||||||
|  | 		rc=$? | ||||||
|  | 	fi | ||||||
|  | 	if [ $rc != 0 ]; then | ||||||
|  | 		eerror "Unable to mount tmpfs on /run." | ||||||
|  | 		eerror "Can't continue." | ||||||
|  | 		exit 1 | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | checkpath -d $RC_SVCDIR | ||||||
|  | checkpath -d -m 0775 -o root:uucp /run/lock | ||||||
|  |  | ||||||
| # Try to mount xenfs as early as possible, otherwise rc_sys() will always | # 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. | # 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 | if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then | ||||||
| @@ -119,4 +71,9 @@ if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then | |||||||
| 	eend $? | 	eend $? | ||||||
| fi | fi | ||||||
|  |  | ||||||
| . "$RC_LIBEXECDIR"/sh/init-common-post.sh | if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then | ||||||
|  | 	cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | echo sysinit >"$RC_SVCDIR"/softlevel | ||||||
|  | exit 0 | ||||||
|   | |||||||
							
								
								
									
										49
									
								
								sh/migrate-to-run.sh.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								sh/migrate-to-run.sh.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | #!@SHELL@ | ||||||
|  | # Copyright (c) 2012 William Hubbs <w.d.hubbs@gmail.com> | ||||||
|  | # Released under the 2-clause BSD license. | ||||||
|  |  | ||||||
|  | . "@LIBEXECDIR@/sh/functions.sh" | ||||||
|  |  | ||||||
|  | if ! mountinfo -q -f tmpfs "@LIBEXECDIR@/init.d"; then | ||||||
|  | 	einfo "The OpenRC dependency data has already been migrated." | ||||||
|  | 	exit 0 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | if [ ! -d "@PREFIX@/run" ]; then | ||||||
|  | 	eerror "'@PREFIX@/run' is not a directory." | ||||||
|  | 	eerror "This means the OpenRC dependency data cannot be migrated." | ||||||
|  | 	eerror "Please create the '@PREFIX@/run' directory and reboot the system." | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | if ! mountinfo -q -f tmpfs "@PREFIX@/run"; then | ||||||
|  | 	for x in "@PREFIX@/run/."* "@PREFIX@/run/"*; do | ||||||
|  | 		case "$x" in | ||||||
|  | 			"@PREFIX@/run/."|"@PREFIX@/run/..") | ||||||
|  | 				continue | ||||||
|  | 				;; | ||||||
|  | 		esac | ||||||
|  | 		if [ -e "$x" ]; then | ||||||
|  | 				eerror "Your '@PREFIX@/run' directory contains files." | ||||||
|  | 				eerror "Please reboot the system." | ||||||
|  | 				exit 1 | ||||||
|  | 		fi | ||||||
|  | 	done | ||||||
|  |  | ||||||
|  | 	mount -t tmpfs -o mode=0755,nosuid,nodev \ | ||||||
|  | 		tmpfs "@PREFIX@/run" 2> /dev/null | ||||||
|  | 	if [ $? != 0 ]; then | ||||||
|  | 		eerror "Unable to mount a tmpfs on '@PREFIX@/run'." | ||||||
|  | 		eerror "This means the OpenRC dependency data cannot be migrated." | ||||||
|  | 		eerror "Please create the '@PREFIX@/run' directory and reboot the system." | ||||||
|  | 		exit 1 | ||||||
|  | 	fi | ||||||
|  | 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" | ||||||
|  | einfo "The OpenRC dependency data was migrated successfully." | ||||||
|  | exit 0 | ||||||
| @@ -4,6 +4,22 @@ | |||||||
| # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | ||||||
| # Released under the 2-clause BSD license. | # Released under the 2-clause BSD license. | ||||||
|  |  | ||||||
|  | verify_boot() | ||||||
|  | { | ||||||
|  | 	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 | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
| sourcex() | sourcex() | ||||||
| { | { | ||||||
| 	if [ "$1" = "-e" ]; then | 	if [ "$1" = "-e" ]; then | ||||||
| @@ -16,7 +32,7 @@ sourcex() | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| sourcex "@SYSCONFDIR@/init.d/functions.sh" | sourcex "@LIBEXECDIR@/sh/functions.sh" | ||||||
| sourcex "@LIBEXECDIR@/sh/rc-functions.sh" | sourcex "@LIBEXECDIR@/sh/rc-functions.sh" | ||||||
|  |  | ||||||
| # Support LiveCD foo | # Support LiveCD foo | ||||||
| @@ -24,18 +40,6 @@ if sourcex -e "/sbin/livecd-functions.sh"; then | |||||||
| 	livecd_read_commandline | 	livecd_read_commandline | ||||||
| fi | 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 |  | ||||||
|  |  | ||||||
| if [ -z "$1" -o -z "$2" ]; then | if [ -z "$1" -o -z "$2" ]; then | ||||||
| 	eerror "$RC_SVCNAME: not enough arguments" | 	eerror "$RC_SVCNAME: not enough arguments" | ||||||
| 	exit 1 | 	exit 1 | ||||||
| @@ -229,7 +233,12 @@ while [ -n "$1" ]; do | |||||||
| 	# Special case depend | 	# Special case depend | ||||||
| 	if [ "$1" = depend ]; then | 	if [ "$1" = depend ]; then | ||||||
| 		shift | 		shift | ||||||
|  |  | ||||||
|  | 		# Enter the dir of the init script to fix the globbing | ||||||
|  | 		# bug 412677 | ||||||
|  | 		cd ${RC_SERVICE%/*} | ||||||
| 		_depend | 		_depend | ||||||
|  | 		cd / | ||||||
| 		continue | 		continue | ||||||
| 	fi | 	fi | ||||||
| 	# See if we have the required function and run it | 	# See if we have the required function and run it | ||||||
| @@ -256,7 +265,7 @@ while [ -n "$1" ]; do | |||||||
| 				# we can run this command | 				# we can run this command | ||||||
| 				for _cmd in $extra_started_commands; do | 				for _cmd in $extra_started_commands; do | ||||||
| 					if [ "$_cmd" = "$1" ]; then | 					if [ "$_cmd" = "$1" ]; then | ||||||
| 						if ! service_started; then | 						if verify_boot && ! service_started; then | ||||||
| 							eerror "$RC_SVCNAME: cannot \`$1' as it has not been started" | 							eerror "$RC_SVCNAME: cannot \`$1' as it has not been started" | ||||||
| 							exit 1 | 							exit 1 | ||||||
| 						fi | 						fi | ||||||
| @@ -266,13 +275,16 @@ while [ -n "$1" ]; do | |||||||
| 				# we can run this command | 				# we can run this command | ||||||
| 				for _cmd in $extra_stopped_commands; do | 				for _cmd in $extra_stopped_commands; do | ||||||
| 					if [ "$_cmd" = "$1" ]; then | 					if [ "$_cmd" = "$1" ]; then | ||||||
| 						if ! service_stopped; then | 						if verify_boot && ! service_stopped; then | ||||||
| 							eerror "$RC_SVCNAME: cannot \`$1' as it has not been stopped" | 							eerror "$RC_SVCNAME: cannot \`$1' as it has not been stopped" | ||||||
| 							exit 1 | 							exit 1 | ||||||
| 						fi | 						fi | ||||||
| 					fi | 					fi | ||||||
| 				done | 				done | ||||||
| 				unset _cmd | 				unset _cmd | ||||||
|  | 				case $1 in | ||||||
|  | 						start|stop|status) verify_boot;; | ||||||
|  | 				esac | ||||||
| 				if [ "$(command -v "$1_pre")" = "$1_pre" ] | 				if [ "$(command -v "$1_pre")" = "$1_pre" ] | ||||||
| 				then | 				then | ||||||
| 					"$1"_pre || exit $? | 					"$1"_pre || exit $? | ||||||
|   | |||||||
							
								
								
									
										288
									
								
								sh/tmpfiles.sh.in
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										288
									
								
								sh/tmpfiles.sh.in
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,288 @@ | |||||||
|  | #!/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 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" | ||||||
|  | 		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= | ||||||
|  | # 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 | ||||||
|  | # 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] [--clean] [--verbose] [--dry-run]\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! | ||||||
|  |  | ||||||
|  | 	# 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 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 | ||||||
|  |  | ||||||
|  | 		# 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: | ||||||
							
								
								
									
										139
									
								
								src/includes/helpers.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								src/includes/helpers.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,139 @@ | |||||||
|  | /* | ||||||
|  |   helpers.h | ||||||
|  |   This is private to us and not for user consumption | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | ||||||
|  |  * | ||||||
|  |  * Redistribution and use in source and binary forms, with or without | ||||||
|  |  * modification, are permitted provided that the following conditions | ||||||
|  |  * are met: | ||||||
|  |  * 1. Redistributions of source code must retain the above copyright | ||||||
|  |  *    notice, this list of conditions and the following disclaimer. | ||||||
|  |  * 2. Redistributions in binary form must reproduce the above copyright | ||||||
|  |  *    notice, this list of conditions and the following disclaimer in the | ||||||
|  |  *    documentation and/or other materials provided with the distribution. | ||||||
|  |  * | ||||||
|  |  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||||
|  |  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||||
|  |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||||
|  |  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||||||
|  |  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||||
|  |  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||||
|  |  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||||
|  |  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||||
|  |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||||
|  |  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||||
|  |  * SUCH DAMAGE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef __HELPERS_H__ | ||||||
|  | #define __HELPERS_H__ | ||||||
|  |  | ||||||
|  | #define ERRX fprintf (stderr, "out of memory\n"); exit (1) | ||||||
|  |  | ||||||
|  | #define UNCONST(a)		((void *)(unsigned long)(const void *)(a)) | ||||||
|  |  | ||||||
|  | #ifdef lint | ||||||
|  | # define _unused | ||||||
|  | #endif | ||||||
|  | #if __GNUC__ > 2 || defined(__INTEL_COMPILER) | ||||||
|  | # define _dead __attribute__((__noreturn__)) | ||||||
|  | # define _unused __attribute__((__unused__)) | ||||||
|  | #else | ||||||
|  | # define _dead | ||||||
|  | # define _unused | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) | ||||||
|  |  | ||||||
|  | /* Some libc implemntations don't have these */ | ||||||
|  | #ifndef TAILQ_CONCAT | ||||||
|  | #define TAILQ_CONCAT(head1, head2, field) do {				      \ | ||||||
|  | 		if (!TAILQ_EMPTY(head2)) {				      \ | ||||||
|  | 			*(head1)->tqh_last = (head2)->tqh_first;	      \ | ||||||
|  | 			(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ | ||||||
|  | 			(head1)->tqh_last = (head2)->tqh_last;		      \ | ||||||
|  | 			TAILQ_INIT((head2));				      \ | ||||||
|  | 		}							      \ | ||||||
|  | 	} while (0) | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef TAILQ_FOREACH_SAFE | ||||||
|  | #define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			      \ | ||||||
|  | 	for ((var) = TAILQ_FIRST((head));				      \ | ||||||
|  | 	     (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		      \ | ||||||
|  | 	     (var) = (tvar)) | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef __GLIBC__ | ||||||
|  | #  if ! defined (__UCLIBC__) && ! defined (__dietlibc__) | ||||||
|  | #    define strlcpy(dst, src, size) snprintf(dst, size, "%s", src) | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef timespecsub | ||||||
|  | #define	timespecsub(tsp, usp, vsp)					      \ | ||||||
|  | 	do {								      \ | ||||||
|  | 		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		      \ | ||||||
|  | 		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	      \ | ||||||
|  | 		if ((vsp)->tv_nsec < 0) {				      \ | ||||||
|  | 			(vsp)->tv_sec--;				      \ | ||||||
|  | 			(vsp)->tv_nsec += 1000000000L;			      \ | ||||||
|  | 		}							      \ | ||||||
|  | 	} while (/* CONSTCOND */ 0) | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | _unused static void *xmalloc (size_t size) | ||||||
|  | { | ||||||
|  | 	void *value = malloc(size); | ||||||
|  |  | ||||||
|  | 	if (value) | ||||||
|  | 		return (value); | ||||||
|  |  | ||||||
|  | 	ERRX; | ||||||
|  | 	/* NOTREACHED */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | _unused static void *xrealloc(void *ptr, size_t size) | ||||||
|  | { | ||||||
|  | 	void *value = realloc(ptr, size); | ||||||
|  |  | ||||||
|  | 	if (value) | ||||||
|  | 		return (value); | ||||||
|  |  | ||||||
|  | 	ERRX; | ||||||
|  | 	/* NOTREACHED */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | _unused static char *xstrdup(const char *str) | ||||||
|  | { | ||||||
|  | 	char *value; | ||||||
|  |  | ||||||
|  | 	if (! str) | ||||||
|  | 		return (NULL); | ||||||
|  |  | ||||||
|  | 	value = strdup(str); | ||||||
|  |  | ||||||
|  | 	if (value) | ||||||
|  | 		return (value); | ||||||
|  |  | ||||||
|  | 	ERRX; | ||||||
|  | 	/* NOTREACHED */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #undef ERRX | ||||||
|  |  | ||||||
|  | /* basename_c never modifies the argument. As such, if there is a trailing | ||||||
|  |  * slash then an empty string is returned. */ | ||||||
|  | _unused static const char *basename_c(const char *path) | ||||||
|  | { | ||||||
|  | 	const char *slash = strrchr(path, '/'); | ||||||
|  |  | ||||||
|  | 	if (slash) | ||||||
|  | 		return (++slash); | ||||||
|  | 	return (path); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -38,6 +38,8 @@ | |||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
|  |  | ||||||
|  | #include "helpers.h" | ||||||
|  |  | ||||||
| #define RC_LEVEL_BOOT           "boot" | #define RC_LEVEL_BOOT           "boot" | ||||||
| #define RC_LEVEL_DEFAULT        "default" | #define RC_LEVEL_DEFAULT        "default" | ||||||
|  |  | ||||||
| @@ -52,98 +54,6 @@ | |||||||
| #define RC_SVCDIR_STARTED       RC_SVCDIR "/started" | #define RC_SVCDIR_STARTED       RC_SVCDIR "/started" | ||||||
| #define RC_SVCDIR_COLDPLUGGED	RC_SVCDIR "/coldplugged" | #define RC_SVCDIR_COLDPLUGGED	RC_SVCDIR "/coldplugged" | ||||||
|  |  | ||||||
| #define ERRX fprintf (stderr, "out of memory\n"); exit (1) |  | ||||||
|  |  | ||||||
| #define UNCONST(a)		((void *)(unsigned long)(const void *)(a)) |  | ||||||
|  |  | ||||||
| #ifdef lint |  | ||||||
| # define _unused |  | ||||||
| #endif |  | ||||||
| #if __GNUC__ > 2 || defined(__INTEL_COMPILER) |  | ||||||
| # define _dead __attribute__((__noreturn__)) |  | ||||||
| # define _unused __attribute__((__unused__)) |  | ||||||
| #else |  | ||||||
| # define _dead |  | ||||||
| # define _unused |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* Some libc implemntations don't have these */ |  | ||||||
| #ifndef TAILQ_CONCAT |  | ||||||
| #define TAILQ_CONCAT(head1, head2, field) do {				      \ |  | ||||||
| 		if (!TAILQ_EMPTY(head2)) {				      \ |  | ||||||
| 			*(head1)->tqh_last = (head2)->tqh_first;	      \ |  | ||||||
| 			(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ |  | ||||||
| 			(head1)->tqh_last = (head2)->tqh_last;		      \ |  | ||||||
| 			TAILQ_INIT((head2));				      \ |  | ||||||
| 		}							      \ |  | ||||||
| 	} while (0) |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifndef TAILQ_FOREACH_SAFE |  | ||||||
| #define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			      \ |  | ||||||
| 	for ((var) = TAILQ_FIRST((head));				      \ |  | ||||||
| 	     (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		      \ |  | ||||||
| 	     (var) = (tvar)) |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifdef __GLIBC__ |  | ||||||
| #  if ! defined (__UCLIBC__) && ! defined (__dietlibc__) |  | ||||||
| #    define strlcpy(dst, src, size) snprintf(dst, size, "%s", src) |  | ||||||
| #  endif |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #ifndef timespecsub |  | ||||||
| #define	timespecsub(tsp, usp, vsp)					      \ |  | ||||||
| 	do {								      \ |  | ||||||
| 		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		      \ |  | ||||||
| 		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	      \ |  | ||||||
| 		if ((vsp)->tv_nsec < 0) {				      \ |  | ||||||
| 			(vsp)->tv_sec--;				      \ |  | ||||||
| 			(vsp)->tv_nsec += 1000000000L;			      \ |  | ||||||
| 		}							      \ |  | ||||||
| 	} while (/* CONSTCOND */ 0) |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| _unused static void *xmalloc (size_t size) |  | ||||||
| { |  | ||||||
| 	void *value = malloc(size); |  | ||||||
|  |  | ||||||
| 	if (value) |  | ||||||
| 		return (value); |  | ||||||
|  |  | ||||||
| 	ERRX; |  | ||||||
| 	/* NOTREACHED */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| _unused static void *xrealloc(void *ptr, size_t size) |  | ||||||
| { |  | ||||||
| 	void *value = realloc(ptr, size); |  | ||||||
|  |  | ||||||
| 	if (value) |  | ||||||
| 		return (value); |  | ||||||
|  |  | ||||||
| 	ERRX; |  | ||||||
| 	/* NOTREACHED */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| _unused static char *xstrdup(const char *str) |  | ||||||
| { |  | ||||||
| 	char *value; |  | ||||||
|  |  | ||||||
| 	if (! str) |  | ||||||
| 		return (NULL); |  | ||||||
|  |  | ||||||
| 	value = strdup(str); |  | ||||||
|  |  | ||||||
| 	if (value) |  | ||||||
| 		return (value); |  | ||||||
|  |  | ||||||
| 	ERRX; |  | ||||||
| 	/* NOTREACHED */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #undef ERRX |  | ||||||
|  |  | ||||||
| _unused static bool exists(const char *pathname) | _unused static bool exists(const char *pathname) | ||||||
| { | { | ||||||
| 	struct stat buf; | 	struct stat buf; | ||||||
| @@ -176,16 +86,5 @@ int is_writable(const char *); | |||||||
| #define service_start(service) exec_service(service, "start"); | #define service_start(service) exec_service(service, "start"); | ||||||
| #define service_stop(service)  exec_service(service, "stop"); | #define service_stop(service)  exec_service(service, "stop"); | ||||||
|  |  | ||||||
| /* basename_c never modifies the argument. As such, if there is a trailing |  | ||||||
|  * slash then an empty string is returned. */ |  | ||||||
| _unused static const char *basename_c(const char *path) |  | ||||||
| { |  | ||||||
| 	const char *slash = strrchr(path, '/'); |  | ||||||
|  |  | ||||||
| 	if (slash) |  | ||||||
| 		return (++slash); |  | ||||||
| 	return (path); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int parse_mode(mode_t *, char *); | int parse_mode(mode_t *, char *); | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -51,6 +51,7 @@ const char libeinfo_copyright[] = "Copyright (c) 2007-2008 Roy Marples"; | |||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
|  |  | ||||||
| #include "einfo.h" | #include "einfo.h" | ||||||
|  | #include "helpers.h" | ||||||
| #include "hidden-visibility.h" | #include "hidden-visibility.h" | ||||||
|  |  | ||||||
| hidden_proto(ecolor) | hidden_proto(ecolor) | ||||||
| @@ -134,7 +135,7 @@ static const struct ecolor ecolors[] = { | |||||||
| 	{ ECOLOR_BRACKET, BRACKET, "bracket" }, | 	{ ECOLOR_BRACKET, BRACKET, "bracket" }, | ||||||
| 	{ ECOLOR_NORMAL,  0,       NULL      }, | 	{ ECOLOR_NORMAL,  0,       NULL      }, | ||||||
| }; | }; | ||||||
| static const char *ecolors_str[sizeof(ecolors)/sizeof(ecolors[0])]; | static const char *ecolors_str[ARRAY_SIZE(ecolors)]; | ||||||
|  |  | ||||||
| static char *flush = NULL; | static char *flush = NULL; | ||||||
| static char *up = NULL; | static char *up = NULL; | ||||||
| @@ -225,27 +226,6 @@ strlcat(char *dst, const char *src, size_t size) | |||||||
|  |  | ||||||
| 	return dst_n + (s - src); | 	return dst_n + (s - src); | ||||||
| } | } | ||||||
|  |  | ||||||
| static size_t |  | ||||||
| strlcpy(char *dst, const char *src, size_t size) |  | ||||||
| { |  | ||||||
| 	const char *s = src; |  | ||||||
| 	size_t n = size; |  | ||||||
|  |  | ||||||
| 	if (n && --n) |  | ||||||
| 		do { |  | ||||||
| 			if (!(*dst++ = *src++)) |  | ||||||
| 				break; |  | ||||||
| 		} while (--n); |  | ||||||
|  |  | ||||||
| 	if (!n) { |  | ||||||
| 		if (size) |  | ||||||
| 			*dst = '\0'; |  | ||||||
| 		while (*src++); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return src - s - 1; |  | ||||||
| } |  | ||||||
| #  endif | #  endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -462,7 +442,7 @@ colour_terminal(FILE * EINFO_RESTRICT f) | |||||||
|  |  | ||||||
| 	/* Now setup our colours */ | 	/* Now setup our colours */ | ||||||
| 	p = ebuffer; | 	p = ebuffer; | ||||||
| 	for (i = 0; i < sizeof(ecolors) / sizeof(ecolors[0]); i++) { | 	for (i = 0; i < ARRAY_SIZE(ecolors); ++i) { | ||||||
| 		tmp[0] = '\0'; | 		tmp[0] = '\0'; | ||||||
| 		if (ecolors[i].name) { | 		if (ecolors[i].name) { | ||||||
| 			bold = _md; | 			bold = _md; | ||||||
| @@ -598,7 +578,7 @@ _ecolor(FILE * EINFO_RESTRICT f, ECOLOR color) | |||||||
| 	if (!colour_terminal(f)) | 	if (!colour_terminal(f)) | ||||||
| 		return ""; | 		return ""; | ||||||
|  |  | ||||||
| 	for (i = 0; i < sizeof(ecolors) / sizeof(ecolors[0]); i++) | 	for (i = 0; i < ARRAY_SIZE(ecolors); ++i) | ||||||
| 		if (ecolors[i].color == color) | 		if (ecolors[i].color == color) | ||||||
| 			return ecolors_str[i]; | 			return ecolors_str[i]; | ||||||
| 	return ""; | 	return ""; | ||||||
|   | |||||||
| @@ -687,27 +687,27 @@ rc_deptree_update_needed(time_t *newest, char *file) | |||||||
| 	if (!existss(RC_DEPTREE_CACHE)) | 	if (!existss(RC_DEPTREE_CACHE)) | ||||||
| 		return true; | 		return true; | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_INITDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_INITDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONFDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONFDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| #ifdef RC_PKG_INITDIR | #ifdef RC_PKG_INITDIR | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_INITDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_INITDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| #endif | #endif | ||||||
| #ifdef RC_PKG_CONFDIR | #ifdef RC_PKG_CONFDIR | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_CONFDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_CONFDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| #endif | #endif | ||||||
| #ifdef RC_LOCAL_INITDIR | #ifdef RC_LOCAL_INITDIR | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_INITDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_INITDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| #endif | #endif | ||||||
| #ifdef RC_LOCAL_CONFDIR | #ifdef RC_LOCAL_CONFDIR | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_CONFDIR, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_CONFDIR, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
| #endif | #endif | ||||||
| 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONF, newest, file)) | 	if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONF, newest, file)) | ||||||
| 		newer = true; | 		return true; | ||||||
|  |  | ||||||
| 	/* Some init scripts dependencies change depending on config files | 	/* Some init scripts dependencies change depending on config files | ||||||
| 	 * outside of baselayout, like syslog-ng, so we check those too. */ | 	 * outside of baselayout, like syslog-ng, so we check those too. */ | ||||||
| @@ -715,8 +715,7 @@ rc_deptree_update_needed(time_t *newest, char *file) | |||||||
| 	TAILQ_FOREACH(s, config, entries) { | 	TAILQ_FOREACH(s, config, entries) { | ||||||
| 		if (!rc_newer_than(RC_DEPTREE_CACHE, s->value, newest, file)) { | 		if (!rc_newer_than(RC_DEPTREE_CACHE, s->value, newest, file)) { | ||||||
| 			newer = true; | 			newer = true; | ||||||
| 			if (newest == NULL) | 			break; | ||||||
| 				break; |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	rc_stringlist_free(config); | 	rc_stringlist_free(config); | ||||||
|   | |||||||
| @@ -29,7 +29,6 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "librc.h" | #include "librc.h" | ||||||
| #include "einfo.h" |  | ||||||
|  |  | ||||||
| bool | bool | ||||||
| rc_yesno(const char *value) | rc_yesno(const char *value) | ||||||
| @@ -128,10 +127,10 @@ rc_getline(char **line, size_t *len, FILE *fp) | |||||||
| } | } | ||||||
| librc_hidden_def(rc_getline) | librc_hidden_def(rc_getline) | ||||||
|  |  | ||||||
| #ifdef __linux__ |  | ||||||
| char * | char * | ||||||
| rc_proc_getent(const char *ent) | rc_proc_getent(const char *ent) | ||||||
| { | { | ||||||
|  | #ifdef __linux__ | ||||||
| 	FILE *fp; | 	FILE *fp; | ||||||
| 	char *proc, *p, *value = NULL; | 	char *proc, *p, *value = NULL; | ||||||
| 	size_t i, len; | 	size_t i, len; | ||||||
| @@ -139,15 +138,13 @@ rc_proc_getent(const char *ent) | |||||||
| 	if (!exists("/proc/cmdline")) | 	if (!exists("/proc/cmdline")) | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  |  | ||||||
| 	if (!(fp = fopen("/proc/cmdline", "r"))) { | 	if (!(fp = fopen("/proc/cmdline", "r"))) | ||||||
| 		eerror("failed to open `/proc/cmdline': %s", strerror(errno)); |  | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	proc = NULL; | 	proc = NULL; | ||||||
| 	i = 0; | 	i = 0; | ||||||
| 	if (rc_getline(&proc, &i, fp) == -1 || proc == NULL) | 	if (rc_getline(&proc, &i, fp) == -1 || proc == NULL) | ||||||
| 		eerror("rc_getline: %s", strerror(errno)); | 		return NULL; | ||||||
|  |  | ||||||
| 	if (proc != NULL) { | 	if (proc != NULL) { | ||||||
| 		len = strlen(ent); | 		len = strlen(ent); | ||||||
| @@ -171,9 +168,11 @@ rc_proc_getent(const char *ent) | |||||||
| 	free(proc); | 	free(proc); | ||||||
|  |  | ||||||
| 	return value; | 	return value; | ||||||
|  | #else | ||||||
|  | 	return NULL; | ||||||
|  | #endif | ||||||
| } | } | ||||||
| librc_hidden_def(rc_proc_getent) | librc_hidden_def(rc_proc_getent) | ||||||
| #endif |  | ||||||
|  |  | ||||||
| RC_STRINGLIST * | RC_STRINGLIST * | ||||||
| rc_config_list(const char *file) | rc_config_list(const char *file) | ||||||
| @@ -392,13 +391,10 @@ rc_conf_value(const char *setting) | |||||||
| 		atexit(_free_rc_conf); | 		atexit(_free_rc_conf); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 		/* Support old configs, but complain about it. */ | 		/* Support old configs. */ | ||||||
| 		if (exists(RC_CONF_OLD)) { | 		if (exists(RC_CONF_OLD)) { | ||||||
| 			old = rc_config_load(RC_CONF_OLD); | 			old = rc_config_load(RC_CONF_OLD); | ||||||
| 			TAILQ_CONCAT(rc_conf, old, entries); | 			TAILQ_CONCAT(rc_conf, old, entries); | ||||||
| 			ewarn("Your system still has %s", RC_CONF_OLD); |  | ||||||
| 			ewarn("Please migrate to the appropriate settings in %s", RC_CONF); |  | ||||||
| 			ewarn("and delete %s.", RC_CONF_OLD); |  | ||||||
| #ifdef DEBUG_MEMORY | #ifdef DEBUG_MEMORY | ||||||
| 			free(old); | 			free(old); | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -36,7 +36,11 @@ __BEGIN_DECLS | |||||||
| #define RC_SYSCONFDIR		"@SYSCONFDIR@" | #define RC_SYSCONFDIR		"@SYSCONFDIR@" | ||||||
| #define RC_LIBDIR               "@PREFIX@/@LIB@/rc" | #define RC_LIBDIR               "@PREFIX@/@LIB@/rc" | ||||||
| #define RC_LIBEXECDIR           "@LIBEXECDIR@" | #define RC_LIBEXECDIR           "@LIBEXECDIR@" | ||||||
|  | #ifdef __linux__ | ||||||
|  | #define RC_SVCDIR               "@PREFIX@/run/openrc" | ||||||
|  | #else | ||||||
| #define RC_SVCDIR               RC_LIBEXECDIR "/init.d" | #define RC_SVCDIR               RC_LIBEXECDIR "/init.d" | ||||||
|  | #endif | ||||||
| #define RC_RUNLEVELDIR          RC_SYSCONFDIR "/runlevels" | #define RC_RUNLEVELDIR          RC_SYSCONFDIR "/runlevels" | ||||||
| #define RC_INITDIR              RC_SYSCONFDIR "/init.d" | #define RC_INITDIR              RC_SYSCONFDIR "/init.d" | ||||||
| #define RC_CONFDIR              RC_SYSCONFDIR "/conf.d" | #define RC_CONFDIR              RC_SYSCONFDIR "/conf.d" | ||||||
| @@ -360,12 +364,10 @@ bool rc_newer_than(const char *, const char *, time_t *, char *); | |||||||
|  * @return true if source is older than target, otherwise false */ |  * @return true if source is older than target, otherwise false */ | ||||||
| bool rc_older_than(const char *, const char *, time_t *, char *); | bool rc_older_than(const char *, const char *, time_t *, char *); | ||||||
|  |  | ||||||
| #ifdef __linux__ |  | ||||||
| /*! Read variables/values from /proc/cmdline | /*! Read variables/values from /proc/cmdline | ||||||
|  * @param value |  * @param value | ||||||
|  * @return pointer to the value, otherwise NULL */ |  * @return pointer to the value, otherwise NULL */ | ||||||
| char *rc_proc_getent(const char *); | char *rc_proc_getent(const char *); | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /*! Update the cached dependency tree if it's older than any init script, | /*! Update the cached dependency tree if it's older than any init script, | ||||||
|  * its configuration file or an external configuration file the init script |  * its configuration file or an external configuration file the init script | ||||||
|   | |||||||
| @@ -253,13 +253,38 @@ do_e(int argc, char **argv) | |||||||
| 	return retval; | 	return retval; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static const struct { | ||||||
|  | 	const char * const name; | ||||||
|  | 	RC_SERVICE bit; | ||||||
|  | } service_bits[] = { | ||||||
|  | 	{ "service_started",     RC_SERVICE_STARTED,     }, | ||||||
|  | 	{ "service_stopped",     RC_SERVICE_STOPPED,     }, | ||||||
|  | 	{ "service_inactive",    RC_SERVICE_INACTIVE,    }, | ||||||
|  | 	{ "service_starting",    RC_SERVICE_STARTING,    }, | ||||||
|  | 	{ "service_stopping",    RC_SERVICE_STOPPING,    }, | ||||||
|  | 	{ "service_hotplugged",  RC_SERVICE_HOTPLUGGED,  }, | ||||||
|  | 	{ "service_wasinactive", RC_SERVICE_WASINACTIVE, }, | ||||||
|  | 	{ "service_failed",      RC_SERVICE_FAILED,      }, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static RC_SERVICE | ||||||
|  | lookup_service_state(const char *service) | ||||||
|  | { | ||||||
|  | 	size_t i; | ||||||
|  | 	for (i = 0; i < ARRAY_SIZE(service_bits); ++i) | ||||||
|  | 		if (!strcmp(service, service_bits[i].name)) | ||||||
|  | 			return service_bits[i].bit; | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| static int | static int | ||||||
| do_service(int argc, char **argv) | do_service(int argc, char **argv) | ||||||
| { | { | ||||||
| 	bool ok = false; | 	bool ok = false; | ||||||
| 	char *service; | 	char *service; | ||||||
| 	char *exec; | 	char *exec; | ||||||
| 	int idx = 0; | 	int idx; | ||||||
|  | 	RC_SERVICE state, bit; | ||||||
|  |  | ||||||
| 	if (argc > 1) | 	if (argc > 1) | ||||||
| 		service = argv[1]; | 		service = argv[1]; | ||||||
| @@ -269,21 +294,11 @@ do_service(int argc, char **argv) | |||||||
| 	if (service == NULL || *service == '\0') | 	if (service == NULL || *service == '\0') | ||||||
| 		eerrorx("%s: no service specified", applet); | 		eerrorx("%s: no service specified", applet); | ||||||
|  |  | ||||||
| 	if (strcmp(applet, "service_started") == 0) | 	state = rc_service_state(service); | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_STARTED); | 	bit = lookup_service_state(applet); | ||||||
| 	else if (strcmp(applet, "service_stopped") == 0) | 	if (bit) { | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_STOPPED); | 		ok = (state & bit); | ||||||
| 	else if (strcmp(applet, "service_inactive") == 0) | 	} else if (strcmp(applet, "service_started_daemon") == 0) { | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_INACTIVE); |  | ||||||
| 	else if (strcmp(applet, "service_starting") == 0) |  | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_STARTING); |  | ||||||
| 	else if (strcmp(applet, "service_stopping") == 0) |  | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_STOPPING); |  | ||||||
| 	else if (strcmp(applet, "service_hotplugged") == 0) |  | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_HOTPLUGGED); |  | ||||||
| 	else if (strcmp(applet, "service_wasinactive") == 0) |  | ||||||
| 		ok = (rc_service_state(service) & RC_SERVICE_WASINACTIVE); |  | ||||||
| 	else if (strcmp(applet, "service_started_daemon") == 0) { |  | ||||||
| 		service = getenv("RC_SVCNAME"); | 		service = getenv("RC_SVCNAME"); | ||||||
| 		exec = argv[1]; | 		exec = argv[1]; | ||||||
| 		if (argc > 3) { | 		if (argc > 3) { | ||||||
| @@ -315,37 +330,34 @@ do_mark_service(int argc, char **argv) | |||||||
| 	char *svcname = getenv("RC_SVCNAME"); | 	char *svcname = getenv("RC_SVCNAME"); | ||||||
| 	char *service = NULL; | 	char *service = NULL; | ||||||
| 	char *runscript_pid; | 	char *runscript_pid; | ||||||
| 	char *mtime; | 	/* char *mtime; */ | ||||||
| 	pid_t pid; | 	pid_t pid; | ||||||
| 	size_t l; | 	RC_SERVICE bit; | ||||||
|  | 	/* size_t l; */ | ||||||
|  |  | ||||||
| 	if (argc > 1) | 	if (argc > 1) | ||||||
| 		service = argv[1]; | 		service = argv[1]; | ||||||
| 	else | 	else | ||||||
| 		service = getenv("RC_SVCNAME"); | 		service = svcname; | ||||||
|  |  | ||||||
| 	if (service == NULL || *service == '\0') | 	if (service == NULL || *service == '\0') | ||||||
| 		eerrorx("%s: no service specified", applet); | 		eerrorx("%s: no service specified", applet); | ||||||
|  |  | ||||||
| 	if (strcmp(applet, "mark_service_started") == 0) | 	if (!strncmp(applet, "mark_", 5) && | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_STARTED); | 	    (bit = lookup_service_state(applet + 5))) | ||||||
| 	else if (strcmp(applet, "mark_service_stopped") == 0) | 		ok = rc_service_mark(service, bit); | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_STOPPED); |  | ||||||
| 	else if (strcmp(applet, "mark_service_inactive") == 0) |  | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_INACTIVE); |  | ||||||
| 	else if (strcmp(applet, "mark_service_starting") == 0) |  | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_STARTING); |  | ||||||
| 	else if (strcmp(applet, "mark_service_stopping") == 0) |  | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_STOPPING); |  | ||||||
| 	else if (strcmp(applet, "mark_service_hotplugged") == 0) |  | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_HOTPLUGGED); |  | ||||||
| 	else if (strcmp(applet, "mark_service_failed") == 0) |  | ||||||
| 		ok = rc_service_mark(service, RC_SERVICE_FAILED); |  | ||||||
| 	else | 	else | ||||||
| 		eerrorx("%s: unknown applet", applet); | 		eerrorx("%s: unknown applet", applet); | ||||||
|  |  | ||||||
| 	/* If we're marking ourselves then we need to inform our parent | 	/* If we're marking ourselves then we need to inform our parent | ||||||
| 	   runscript process so they do not mark us based on our exit code */ | 	   runscript process so they do not mark us based on our exit code */ | ||||||
|  | 	/* | ||||||
|  | 	 * FIXME: svcname and service are almost always equal except called from a | ||||||
|  | 	 * shell with just argv[1] - So that doesn't seem to do what Roy initially | ||||||
|  | 	 * expected. | ||||||
|  | 	 * See 20120424041423.GA23657@odin.qasl.de (Tue, 24 Apr 2012 06:14:23 +0200, | ||||||
|  | 	 * openrc@gentoo.org). | ||||||
|  | 	 */ | ||||||
| 	if (ok && svcname && strcmp(svcname, service) == 0) { | 	if (ok && svcname && strcmp(svcname, service) == 0) { | ||||||
| 		runscript_pid = getenv("RC_RUNSCRIPT_PID"); | 		runscript_pid = getenv("RC_RUNSCRIPT_PID"); | ||||||
| 		if (runscript_pid && sscanf(runscript_pid, "%d", &pid) == 1) | 		if (runscript_pid && sscanf(runscript_pid, "%d", &pid) == 1) | ||||||
| @@ -355,6 +367,7 @@ do_mark_service(int argc, char **argv) | |||||||
|  |  | ||||||
| 		/* Remove the exclusive time test. This ensures that it's not | 		/* Remove the exclusive time test. This ensures that it's not | ||||||
| 		   in control as well */ | 		   in control as well */ | ||||||
|  | 		/* | ||||||
| 		l = strlen(RC_SVCDIR "/exclusive") + strlen(svcname) + | 		l = strlen(RC_SVCDIR "/exclusive") + strlen(svcname) + | ||||||
| 		    strlen(runscript_pid) + 4; | 		    strlen(runscript_pid) + 4; | ||||||
| 		mtime = xmalloc(l); | 		mtime = xmalloc(l); | ||||||
| @@ -363,6 +376,7 @@ do_mark_service(int argc, char **argv) | |||||||
| 		if (exists(mtime) && unlink(mtime) != 0) | 		if (exists(mtime) && unlink(mtime) != 0) | ||||||
| 			eerror("%s: unlink: %s", applet, strerror(errno)); | 			eerror("%s: unlink: %s", applet, strerror(errno)); | ||||||
| 		free(mtime); | 		free(mtime); | ||||||
|  | 		*/ | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return ok ? EXIT_SUCCESS : EXIT_FAILURE; | 	return ok ? EXIT_SUCCESS : EXIT_FAILURE; | ||||||
| @@ -400,7 +414,7 @@ do_value(int argc, char **argv) | |||||||
| } | } | ||||||
|  |  | ||||||
| static int | static int | ||||||
| do_shell_var(int argc, char **argv) | shell_var(int argc, char **argv) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	char *p; | 	char *p; | ||||||
| @@ -421,106 +435,127 @@ do_shell_var(int argc, char **argv) | |||||||
| 	return EXIT_SUCCESS; | 	return EXIT_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | is_older_than(int argc, char **argv) | ||||||
|  | { | ||||||
|  | 	int i; | ||||||
|  |  | ||||||
|  | 	if (argc < 3) | ||||||
|  | 		return EXIT_FAILURE; | ||||||
|  |  | ||||||
|  | 	/* This test is perverted - historically the baselayout function | ||||||
|  | 	 * returns 0 on *failure*, which is plain wrong */ | ||||||
|  | 	for (i = 2; i < argc; ++i) | ||||||
|  | 		if (!rc_newer_than(argv[1], argv[i], NULL, NULL)) | ||||||
|  | 			return EXIT_SUCCESS; | ||||||
|  |  | ||||||
|  | 	return EXIT_FAILURE; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | is_newer_than(int argc, char **argv) | ||||||
|  | { | ||||||
|  | 	int i; | ||||||
|  |  | ||||||
|  | 	if (argc < 3) | ||||||
|  | 		return EXIT_FAILURE; | ||||||
|  |  | ||||||
|  | 	/* This test is correct as it's not present in baselayout */ | ||||||
|  | 	for (i = 2; i < argc; ++i) | ||||||
|  | 		if (!rc_newer_than(argv[1], argv[i], NULL, NULL)) | ||||||
|  | 			return EXIT_FAILURE; | ||||||
|  |  | ||||||
|  | 	return EXIT_SUCCESS; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | is_runlevel_start(_unused int argc, _unused char **argv) | ||||||
|  | { | ||||||
|  | 	return rc_runlevel_starting() ? 0 : 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | is_runlevel_stop(_unused int argc, _unused char **argv) | ||||||
|  | { | ||||||
|  | 	return rc_runlevel_stopping() ? 0 : 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | rc_abort(_unused int argc, _unused char **argv) | ||||||
|  | { | ||||||
|  | 	const char *p = getenv("RC_PID"); | ||||||
|  | 	int pid; | ||||||
|  |  | ||||||
|  | 	if (p && sscanf(p, "%d", &pid) == 1) { | ||||||
|  | 		if (kill(pid, SIGUSR1) != 0) | ||||||
|  | 			eerrorx("rc-abort: failed to signal parent %d: %s", | ||||||
|  | 			    pid, strerror(errno)); | ||||||
|  | 		return EXIT_SUCCESS; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return EXIT_FAILURE; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static const struct { | ||||||
|  | 	const char * const name; | ||||||
|  | 	int (* const applet)(int argc, char **argv); | ||||||
|  | } applets[] = { | ||||||
|  | #define A(a) { #a, a } | ||||||
|  | 	A(fstabinfo), | ||||||
|  | 	A(mountinfo), | ||||||
|  | 	{ "rc-depend",           rc_depend,         }, | ||||||
|  | 	{ "rc-service",          rc_service,        }, | ||||||
|  | 	{ "rc-status",           rc_status,         }, | ||||||
|  | 	{ "rc-update",           rc_update,         }, | ||||||
|  | 	{ "update-rc",           rc_update,         }, | ||||||
|  | 	A(runscript), | ||||||
|  | 	{ "start-stop-daemon",   start_stop_daemon, }, | ||||||
|  | 	A(checkpath), | ||||||
|  | 	A(swclock), | ||||||
|  | 	A(shell_var), | ||||||
|  | 	A(is_older_than), | ||||||
|  | 	A(is_newer_than), | ||||||
|  | 	A(is_runlevel_start), | ||||||
|  | 	A(is_runlevel_stop), | ||||||
|  | 	{ "rc-abort",            rc_abort,          }, | ||||||
|  | 	/* These are purely for init scripts and do not make sense as | ||||||
|  | 	 * anything else */ | ||||||
|  | 	{ "service_get_value",   do_value,          }, | ||||||
|  | 	{ "service_set_value",   do_value,          }, | ||||||
|  | 	{ "get_options",         do_value,          }, | ||||||
|  | 	{ "save_options",        do_value,          }, | ||||||
|  | #undef A | ||||||
|  | }; | ||||||
|  |  | ||||||
| void | void | ||||||
| run_applets(int argc, char **argv) | run_applets(int argc, char **argv) | ||||||
| { | { | ||||||
| 	int i = 2; | 	size_t i; | ||||||
| 	char *p; |  | ||||||
| 	pid_t pid = 0; |  | ||||||
|  |  | ||||||
| 	/* Bug 351712: We need an extra way to explicitly select an applet OTHER | 	/* Bug 351712: We need an extra way to explicitly select an applet OTHER | ||||||
| 	 * than trusting argv[0], as argv[0] is not going to be the applet value if | 	 * than trusting argv[0], as argv[0] is not going to be the applet value if | ||||||
| 	 * we are doing SELinux context switching. For this, we allow calls such as | 	 * we are doing SELinux context switching. For this, we allow calls such as | ||||||
| 	 * 'rc --applet APPLET', and shift ALL of argv down by two array items. */ | 	 * 'rc --applet APPLET', and shift ALL of argv down by two array items. */ | ||||||
| 	if (strcmp(applet, "rc") == 0 && argc >= 3 && | 	if (strcmp(applet, "rc") == 0 && argc >= 3 && | ||||||
| 		    (strcmp(argv[1],"--applet") == 0 || strcmp(argv[1], "-a") == 0)) { | 		(strcmp(argv[1],"--applet") == 0 || strcmp(argv[1], "-a") == 0)) { | ||||||
| 		applet = argv[2]; | 		applet = argv[2]; | ||||||
| 		argv += 2; | 		argv += 2; | ||||||
| 		argc -= 2; | 		argc -= 2; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* These are designed to be applications in their own right */ | 	for (i = 0; i < ARRAY_SIZE(applets); ++i) | ||||||
| 	if (strcmp(applet, "fstabinfo") == 0) | 		if (!strcmp(applet, applets[i].name)) | ||||||
| 		exit(fstabinfo(argc, argv)); | 			exit(applets[i].applet(argc, argv)); | ||||||
| 	else if (strcmp(applet, "mountinfo") == 0) |  | ||||||
| 		exit(mountinfo(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "rc-depend") == 0) |  | ||||||
| 		exit(rc_depend(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "rc-service") == 0) |  | ||||||
| 		exit(rc_service(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "rc-status") == 0) |  | ||||||
| 		exit(rc_status(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "rc-update") == 0 || |  | ||||||
| 	    strcmp(applet, "update-rc") == 0) |  | ||||||
| 		exit(rc_update(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "runscript") == 0) |  | ||||||
| 		exit(runscript(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "start-stop-daemon") == 0) |  | ||||||
| 		exit(start_stop_daemon(argc, argv)); |  | ||||||
| 	else if (strcmp (applet, "checkpath") == 0) |  | ||||||
| 		exit(checkpath(argc, argv)); |  | ||||||
| 	else if (strcmp(applet, "swclock") == 0) |  | ||||||
| 		exit(swclock(argc, argv)); |  | ||||||
|  |  | ||||||
| 	/* These could also be applications in their own right */ |  | ||||||
| 	if (strcmp(applet, "shell_var") == 0) |  | ||||||
| 		exit(do_shell_var(argc, argv)); |  | ||||||
|  |  | ||||||
| 	/* This test is perverted - historically the baselayout function |  | ||||||
| 	 * returns 0 on *failure*, which is plain wrong */ |  | ||||||
| 	if (strcmp(applet, "is_older_than") == 0) { |  | ||||||
| 		if (argc < 3) |  | ||||||
| 			exit (EXIT_FAILURE); |  | ||||||
| 		while (i < argc) { |  | ||||||
| 			if (!rc_newer_than(argv[1], argv[i++], NULL, NULL)) |  | ||||||
| 				exit(EXIT_SUCCESS); |  | ||||||
| 		} |  | ||||||
| 		exit(EXIT_FAILURE); |  | ||||||
| 	}; |  | ||||||
| 	/* This test is correct as it's not present in baselayout */ |  | ||||||
| 	if (strcmp(applet, "is_newer_than") == 0) { |  | ||||||
| 		if (argc < 3) |  | ||||||
| 			exit (EXIT_FAILURE); |  | ||||||
| 		while (i < argc) { |  | ||||||
| 			if (!rc_newer_than(argv[1], argv[i++], NULL, NULL)) |  | ||||||
| 				exit(EXIT_FAILURE); |  | ||||||
| 		} |  | ||||||
| 		exit(EXIT_SUCCESS); |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| 	if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) | 	if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) | ||||||
| 		exit(do_e(argc, argv)); | 		exit(do_e(argc, argv)); | ||||||
|  |  | ||||||
| 	/* These are purely for init scripts and do not make sense as |  | ||||||
| 	 * anything else */ |  | ||||||
| 	if (strcmp(applet, "service_get_value") == 0 || |  | ||||||
| 	    strcmp(applet, "service_set_value") == 0 || |  | ||||||
| 	    strcmp(applet, "get_options") == 0 || |  | ||||||
| 	    strcmp(applet, "save_options") == 0) |  | ||||||
| 		exit(do_value(argc, argv)); |  | ||||||
|  |  | ||||||
| 	if (strncmp(applet, "service_", strlen("service_")) == 0) | 	if (strncmp(applet, "service_", strlen("service_")) == 0) | ||||||
| 		exit(do_service(argc, argv)); | 		exit(do_service(argc, argv)); | ||||||
|  |  | ||||||
| 	if (strncmp(applet, "mark_service_", strlen("mark_service_")) == 0) | 	if (strncmp(applet, "mark_service_", strlen("mark_service_")) == 0) | ||||||
| 		exit(do_mark_service(argc, argv)); | 		exit(do_mark_service(argc, argv)); | ||||||
|  |  | ||||||
| 	if (strcmp(applet, "is_runlevel_start") == 0) |  | ||||||
| 		exit(rc_runlevel_starting() ? 0 : 1); |  | ||||||
| 	else if (strcmp (applet, "is_runlevel_stop") == 0) |  | ||||||
| 		exit(rc_runlevel_stopping() ? 0 : 1); |  | ||||||
|  |  | ||||||
| 	if (strcmp(applet, "rc-abort") == 0) { |  | ||||||
| 		p = getenv("RC_PID"); |  | ||||||
| 		if (p && sscanf(p, "%d", &pid) == 1) { |  | ||||||
| 			if (kill(pid, SIGUSR1) != 0) |  | ||||||
| 				eerrorx("rc-abort: failed to signal parent %d: %s", |  | ||||||
| 				    pid, strerror(errno)); |  | ||||||
| 			exit(EXIT_SUCCESS); |  | ||||||
| 		} |  | ||||||
| 		exit(EXIT_FAILURE); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (strcmp(applet, "rc") != 0) | 	if (strcmp(applet, "rc") != 0) | ||||||
| 		eerrorx("%s: unknown applet", applet); | 		eerrorx("%s: unknown applet", applet); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -793,6 +793,13 @@ main(int argc, char **argv) | |||||||
| 	env_filter(); | 	env_filter(); | ||||||
| 	env_config(); | 	env_config(); | ||||||
|  |  | ||||||
|  | 	/* complain about old configuration settings if they exist */ | ||||||
|  | 	if (exists(RC_CONF_OLD)) { | ||||||
|  | 		ewarn("%s still exists on your system and should be removed.", | ||||||
|  | 				RC_CONF_OLD); | ||||||
|  | 		ewarn("Please migrate to the appropriate settings in %s", RC_CONF); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	argc++; | 	argc++; | ||||||
| 	argv--; | 	argv--; | ||||||
| 	while ((opt = getopt_long(argc, argv, getoptstring, | 	while ((opt = getopt_long(argc, argv, getoptstring, | ||||||
|   | |||||||
| @@ -192,7 +192,7 @@ parse_signal(const char *sig) | |||||||
| 	else | 	else | ||||||
| 		s = NULL; | 		s = NULL; | ||||||
|  |  | ||||||
| 	for (i = 0; i < sizeof(signallist) / sizeof(signallist[0]); i++) | 	for (i = 0; i < ARRAY_SIZE(signallist); ++i) | ||||||
| 		if (strcmp(sig, signallist[i].name) == 0 || | 		if (strcmp(sig, signallist[i].name) == 0 || | ||||||
| 		    (s && strcmp(s, signallist[i].name) == 0)) | 		    (s && strcmp(s, signallist[i].name) == 0)) | ||||||
| 			return signallist[i].signal; | 			return signallist[i].signal; | ||||||
|   | |||||||
| @@ -93,7 +93,7 @@ ebegin "Checking for x* func usage" | |||||||
| out=$(cd ${top_srcdir}; find src -name '*.[ch]' \ | out=$(cd ${top_srcdir}; find src -name '*.[ch]' \ | ||||||
| 	-exec grep -n -E '\<(malloc|strdup)[[:space:]]*\(' {} + \ | 	-exec grep -n -E '\<(malloc|strdup)[[:space:]]*\(' {} + \ | ||||||
| 	| grep -v \ | 	| grep -v \ | ||||||
| 		-e src/includes/rc-misc.h \ | 		-e src/includes/helpers.h \ | ||||||
| 		-e src/libeinfo/libeinfo.c) | 		-e src/libeinfo/libeinfo.c) | ||||||
| [ -z "${out}" ] | [ -z "${out}" ] | ||||||
| eend $? "These need to be using the x* variant:"$'\n'"${out}" | eend $? "These need to be using the x* variant:"$'\n'"${out}" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user