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
|
NAME= openrc
|
||||||
VERSION= 0.9.9
|
VERSION= 0.9.9.3
|
||||||
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
ifconfig_depend()
|
ifconfig_depend()
|
||||||
{
|
{
|
||||||
program /sbin/ifconfig
|
program /sbin/ifconfig /bin/ifconfig
|
||||||
provide interface
|
provide interface
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ _down()
|
|||||||
|
|
||||||
_exists()
|
_exists()
|
||||||
{
|
{
|
||||||
grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
|
[ -e /sys/class/net/"$IFACE" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
_ifindex()
|
_ifindex()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ _down()
|
|||||||
|
|
||||||
_exists()
|
_exists()
|
||||||
{
|
{
|
||||||
grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
|
[ -e /sys/class/net/"$IFACE" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
_ifindex()
|
_ifindex()
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -256,7 +260,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 +270,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 $?
|
||||||
|
|||||||
@@ -128,10 +128,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;
|
||||||
@@ -171,9 +171,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)
|
||||||
|
|||||||
@@ -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 */
|
* @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
|
||||||
|
|||||||
@@ -1178,12 +1178,9 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
if (changeuser != NULL)
|
if (changeuser != NULL) {
|
||||||
pamr = pam_start("start-stop-daemon",
|
pamr = pam_start("start-stop-daemon",
|
||||||
changeuser, &conv, &pamh);
|
changeuser, &conv, &pamh);
|
||||||
else
|
|
||||||
pamr = pam_start("start-stop-daemon",
|
|
||||||
"nobody", &conv, &pamh);
|
|
||||||
|
|
||||||
if (pamr == PAM_SUCCESS)
|
if (pamr == PAM_SUCCESS)
|
||||||
pamr = pam_acct_mgmt(pamh, PAM_SILENT);
|
pamr = pam_acct_mgmt(pamh, PAM_SILENT);
|
||||||
@@ -1192,6 +1189,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
if (pamr != PAM_SUCCESS)
|
if (pamr != PAM_SUCCESS)
|
||||||
eerrorx("%s: pam error: %s",
|
eerrorx("%s: pam error: %s",
|
||||||
applet, pam_strerror(pamh, pamr));
|
applet, pam_strerror(pamh, pamr));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gid && setgid(gid))
|
if (gid && setgid(gid))
|
||||||
@@ -1219,6 +1217,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
rc_stringlist_add(env_list, environ[i++]);
|
rc_stringlist_add(env_list, environ[i++]);
|
||||||
|
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
|
if (changeuser != NULL) {
|
||||||
pamenv = (const char *const *)pam_getenvlist(pamh);
|
pamenv = (const char *const *)pam_getenvlist(pamh);
|
||||||
if (pamenv) {
|
if (pamenv) {
|
||||||
while (*pamenv) {
|
while (*pamenv) {
|
||||||
@@ -1230,6 +1229,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
pamenv++;
|
pamenv++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TAILQ_FOREACH(env, env_list, entries) {
|
TAILQ_FOREACH(env, env_list, entries) {
|
||||||
@@ -1304,7 +1304,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
setsid();
|
setsid();
|
||||||
execvp(exec, argv);
|
execvp(exec, argv);
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
if (pamr == PAM_SUCCESS)
|
if (changeuser != NULL && pamr == PAM_SUCCESS)
|
||||||
pam_close_session(pamh, PAM_SILENT);
|
pam_close_session(pamh, PAM_SILENT);
|
||||||
#endif
|
#endif
|
||||||
eerrorx("%s: failed to exec `%s': %s",
|
eerrorx("%s: failed to exec `%s': %s",
|
||||||
|
|||||||
Reference in New Issue
Block a user