Compare commits
	
		
			14 Commits
		
	
	
		
			openrc-0.9
			...
			openrc-0.9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					aac509837e | ||
| 
						 | 
					2a84a8081e | ||
| 
						 | 
					b27a9003bb | ||
| 
						 | 
					9fa54a8e80 | ||
| 
						 | 
					7a1e4ef606 | ||
| 
						 | 
					0dc9431bdb | ||
| 
						 | 
					0fa164dff2 | ||
| 
						 | 
					ba457f1fed | ||
| 
						 | 
					722871c0ae | ||
| 
						 | 
					582c8e9868 | ||
| 
						 | 
					de6323ba51 | ||
| 
						 | 
					d670dbddf7 | ||
| 
						 | 
					f1a19aed78 | ||
| 
						 | 
					3272261479 | 
@@ -1,3 +1,3 @@
 | 
			
		||||
NAME=		openrc
 | 
			
		||||
VERSION=	0.9.9
 | 
			
		||||
VERSION=	0.9.9.3
 | 
			
		||||
PKG=		${NAME}-${VERSION}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								TODO
									
									
									
									
									
								
							@@ -5,3 +5,17 @@
 | 
			
		||||
- oldnet[bridging]: Review setting of bridge configuration on dynamic interface add
 | 
			
		||||
 | 
			
		||||
- 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.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,11 @@
 | 
			
		||||
# you should set it to "local".
 | 
			
		||||
clock="UTC"
 | 
			
		||||
 | 
			
		||||
# If you want to set the system time to the current hardware clock
 | 
			
		||||
# during bootup, then say "YES" here. You do not need this if you are
 | 
			
		||||
# running a modern kernel with CONFIG_RTC_HCTOSYS set to y.
 | 
			
		||||
# If you want the hwclock script to set the system time (software clock)
 | 
			
		||||
# to match the current hardware clock during bootup, leave this
 | 
			
		||||
# 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"
 | 
			
		||||
 | 
			
		||||
# If you do not want to set the hardware clock to the current system
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,8 @@ or stopping them.
 | 
			
		||||
The following variables affect the service script:
 | 
			
		||||
.Bl -tag -width "RC_DEFAULTLEVEL"
 | 
			
		||||
.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
 | 
			
		||||
Space separated list of extra commands the service defines. These only work if
 | 
			
		||||
the service has already been started.
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 | 
			
		||||
ifconfig_depend()
 | 
			
		||||
{
 | 
			
		||||
	program /sbin/ifconfig
 | 
			
		||||
	program /sbin/ifconfig /bin/ifconfig
 | 
			
		||||
	provide interface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -19,7 +19,7 @@ _down()
 | 
			
		||||
 | 
			
		||||
_exists()
 | 
			
		||||
{
 | 
			
		||||
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
 | 
			
		||||
	[ -e /sys/class/net/"$IFACE" ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_ifindex()
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@ _down()
 | 
			
		||||
 | 
			
		||||
_exists()
 | 
			
		||||
{
 | 
			
		||||
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
 | 
			
		||||
	[ -e /sys/class/net/"$IFACE" ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_ifindex()
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,22 @@
 | 
			
		||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
 | 
			
		||||
# 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()
 | 
			
		||||
{
 | 
			
		||||
	if [ "$1" = "-e" ]; then
 | 
			
		||||
@@ -24,18 +40,6 @@ if sourcex -e "/sbin/livecd-functions.sh"; then
 | 
			
		||||
	livecd_read_commandline
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ ! -e ${RC_SVCDIR}/softlevel ]; then
 | 
			
		||||
	eerror "You are attempting to run an openrc service on a"
 | 
			
		||||
	eerror "system which openrc did not boot."
 | 
			
		||||
	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
 | 
			
		||||
	eerror "$RC_SVCNAME: not enough arguments"
 | 
			
		||||
	exit 1
 | 
			
		||||
@@ -256,7 +260,7 @@ while [ -n "$1" ]; do
 | 
			
		||||
				# we can run this command
 | 
			
		||||
				for _cmd in $extra_started_commands; do
 | 
			
		||||
					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"
 | 
			
		||||
							exit 1
 | 
			
		||||
						fi
 | 
			
		||||
@@ -266,13 +270,16 @@ while [ -n "$1" ]; do
 | 
			
		||||
				# we can run this command
 | 
			
		||||
				for _cmd in $extra_stopped_commands; do
 | 
			
		||||
					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"
 | 
			
		||||
							exit 1
 | 
			
		||||
						fi
 | 
			
		||||
					fi
 | 
			
		||||
				done
 | 
			
		||||
				unset _cmd
 | 
			
		||||
				case $1 in
 | 
			
		||||
						start|stop|status) verify_boot;;
 | 
			
		||||
				esac
 | 
			
		||||
				if [ "$(command -v "$1_pre")" = "$1_pre" ]
 | 
			
		||||
				then
 | 
			
		||||
					"$1"_pre || exit $?
 | 
			
		||||
 
 | 
			
		||||
@@ -128,10 +128,10 @@ rc_getline(char **line, size_t *len, FILE *fp)
 | 
			
		||||
}
 | 
			
		||||
librc_hidden_def(rc_getline)
 | 
			
		||||
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
char *
 | 
			
		||||
rc_proc_getent(const char *ent)
 | 
			
		||||
{
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
	char *proc, *p, *value = NULL;
 | 
			
		||||
	size_t i, len;
 | 
			
		||||
@@ -171,9 +171,11 @@ rc_proc_getent(const char *ent)
 | 
			
		||||
	free(proc);
 | 
			
		||||
 | 
			
		||||
	return value;
 | 
			
		||||
#else
 | 
			
		||||
	return NULL;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
librc_hidden_def(rc_proc_getent)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
RC_STRINGLIST *
 | 
			
		||||
rc_config_list(const char *file)
 | 
			
		||||
 
 | 
			
		||||
@@ -360,12 +360,10 @@ bool rc_newer_than(const char *, const char *, time_t *, char *);
 | 
			
		||||
 * @return true if source is older than target, otherwise false */
 | 
			
		||||
bool rc_older_than(const char *, const char *, time_t *, char *);
 | 
			
		||||
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
/*! Read variables/values from /proc/cmdline
 | 
			
		||||
 * @param value
 | 
			
		||||
 * @return pointer to the value, otherwise NULL */
 | 
			
		||||
char *rc_proc_getent(const char *);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*! Update the cached dependency tree if it's older than any init script,
 | 
			
		||||
 * its configuration file or an external configuration file the init script
 | 
			
		||||
 
 | 
			
		||||
@@ -1178,20 +1178,18 @@ start_stop_daemon(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_PAM
 | 
			
		||||
		if (changeuser != NULL)
 | 
			
		||||
		if (changeuser != NULL) {
 | 
			
		||||
			pamr = pam_start("start-stop-daemon",
 | 
			
		||||
			    changeuser, &conv, &pamh);
 | 
			
		||||
		else
 | 
			
		||||
			pamr = pam_start("start-stop-daemon",
 | 
			
		||||
			    "nobody", &conv, &pamh);
 | 
			
		||||
 | 
			
		||||
		if (pamr == PAM_SUCCESS)
 | 
			
		||||
			pamr = pam_acct_mgmt(pamh, PAM_SILENT);
 | 
			
		||||
		if (pamr == PAM_SUCCESS)
 | 
			
		||||
			pamr = pam_open_session(pamh, PAM_SILENT);
 | 
			
		||||
		if (pamr != PAM_SUCCESS)
 | 
			
		||||
			eerrorx("%s: pam error: %s",
 | 
			
		||||
			    applet, pam_strerror(pamh, pamr));
 | 
			
		||||
			if (pamr == PAM_SUCCESS)
 | 
			
		||||
				pamr = pam_acct_mgmt(pamh, PAM_SILENT);
 | 
			
		||||
			if (pamr == PAM_SUCCESS)
 | 
			
		||||
				pamr = pam_open_session(pamh, PAM_SILENT);
 | 
			
		||||
			if (pamr != PAM_SUCCESS)
 | 
			
		||||
				eerrorx("%s: pam error: %s",
 | 
			
		||||
					applet, pam_strerror(pamh, pamr));
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		if (gid && setgid(gid))
 | 
			
		||||
@@ -1219,15 +1217,17 @@ start_stop_daemon(int argc, char **argv)
 | 
			
		||||
			rc_stringlist_add(env_list, environ[i++]);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_PAM
 | 
			
		||||
		pamenv = (const char *const *)pam_getenvlist(pamh);
 | 
			
		||||
		if (pamenv) {
 | 
			
		||||
			while (*pamenv) {
 | 
			
		||||
				/* Don't add strings unless they set a var */
 | 
			
		||||
				if (strchr(*pamenv, '='))
 | 
			
		||||
					putenv(xstrdup(*pamenv));
 | 
			
		||||
				else
 | 
			
		||||
					unsetenv(*pamenv);
 | 
			
		||||
				pamenv++;
 | 
			
		||||
		if (changeuser != NULL) {
 | 
			
		||||
			pamenv = (const char *const *)pam_getenvlist(pamh);
 | 
			
		||||
			if (pamenv) {
 | 
			
		||||
				while (*pamenv) {
 | 
			
		||||
					/* Don't add strings unless they set a var */
 | 
			
		||||
					if (strchr(*pamenv, '='))
 | 
			
		||||
						putenv(xstrdup(*pamenv));
 | 
			
		||||
					else
 | 
			
		||||
						unsetenv(*pamenv);
 | 
			
		||||
					pamenv++;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1304,7 +1304,7 @@ start_stop_daemon(int argc, char **argv)
 | 
			
		||||
		setsid();
 | 
			
		||||
		execvp(exec, argv);
 | 
			
		||||
#ifdef HAVE_PAM
 | 
			
		||||
		if (pamr == PAM_SUCCESS)
 | 
			
		||||
		if (changeuser != NULL && pamr == PAM_SUCCESS)
 | 
			
		||||
			pam_close_session(pamh, PAM_SILENT);
 | 
			
		||||
#endif
 | 
			
		||||
		eerrorx("%s: failed to exec `%s': %s",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user