summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2012-03-11 12:56:13 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2012-03-11 12:56:13 -0700
commit2a84a8081e8dca836073e8a49d2d1cc9bc2a1820 (patch)
treeb55e75138b680adbd057b87ee39e11e5607077ca
parentba457f1fed09ea4e095a54466e616f1fa656e05c (diff)
parentb27a9003bb0e3123b91b2b734629f980b8ccad6f (diff)
downloadopenrc-2a84a8081e8dca836073e8a49d2d1cc9bc2a1820.tar.gz
openrc-2a84a8081e8dca836073e8a49d2d1cc9bc2a1820.tar.bz2
openrc-2a84a8081e8dca836073e8a49d2d1cc9bc2a1820.tar.xz
Merge branch 'master' into openrc-0.9.9.x
-rw-r--r--TODO14
-rw-r--r--conf.d/hwclock8
-rw-r--r--man/runscript.83
-rw-r--r--net/ifconfig.sh.Linux.in4
-rw-r--r--net/iproute2.sh2
-rw-r--r--sh/runscript.sh.in35
6 files changed, 45 insertions, 21 deletions
diff --git a/TODO b/TODO
index cd9ac0c..ccc074b 100644
--- a/TODO
+++ b/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.
+
diff --git a/conf.d/hwclock b/conf.d/hwclock
index 230d81d..59bb732 100644
--- a/conf.d/hwclock
+++ b/conf.d/hwclock
@@ -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
diff --git a/man/runscript.8 b/man/runscript.8
index 3b037ce..64f36b1 100644
--- a/man/runscript.8
+++ b/man/runscript.8
@@ -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.
diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in
index 80a0b98..411401d 100644
--- a/net/ifconfig.sh.Linux.in
+++ b/net/ifconfig.sh.Linux.in
@@ -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()
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 09912bf..e06152f 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -20,7 +20,7 @@ _down()
_exists()
{
- grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev
+ [ -e /sys/class/net/"$IFACE" ]
}
_ifindex()
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 83db42b..15cdb86 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -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 $?