Compare commits

..

23 Commits

Author SHA1 Message Date
William Hubbs
b708852784 release openrc-0.6.3 2010-09-02 10:15:17 -05:00
William Hubbs
f700243016 Revert "fix bug 266395"
This reverts commit 1a188f8f72.

This revert fixes bug #334663.
2010-09-02 09:42:11 -05:00
Jory A. Pratt
b232e529f1 Fix for make-3.82 breakage. 2010-08-22 15:05:11 -05:00
William Hubbs
ae3186834f release openrc-0.6.2 2010-08-19 17:00:38 -05:00
William Hubbs
23546e27d9 fix detection of renamed vlan interfaces
This fixes bug 327059, thanks to Jonathan for reporting this and for the patch.
2010-08-19 16:17:38 -05:00
William Hubbs
1a188f8f72 fix bug 266395
Do not stop wpa_supplicant or wpa_cli if they are in the background.
Thanks to Slava Gorbunov for the patch.
2010-08-18 15:01:23 -05:00
Anthony G. Basile
89829f6d7c Fixes bug #332383. Thanks Lutz Heermann. 2010-08-13 17:42:23 -04:00
Anthony G. Basile
6e3b3bfc53 Fix bug #332181. Thanks Lutz Heermann. 2010-08-13 17:32:31 -04:00
Jory A. Pratt
14c95ae9a6 update consolefont/keymap to include -lxc in keywords 2010-08-10 08:21:08 -05:00
William Hubbs
d3ccbdb5a9 allow ip to be in /sbin or /bin
This makes it possible for the "ip" program in iproute2 to be installed
in /sbin or /bin.
2010-08-09 20:01:15 -05:00
William Hubbs
1cdf85e1ce fix bug #330173
This fixes a typo in the comments in net.example.
2010-07-28 13:18:33 -05:00
Jory A. Pratt
2982cfab70 Fix bug #301237, update example to list proper package for mii-tool 2010-07-12 22:45:40 -05:00
Jory A. Pratt
761fe99fe2 on_ac_power needs to exit not return bug #322037 2010-07-12 22:19:56 -05:00
William Hubbs
6f24d1cbd8 fix typo
I made a typo while manually transferring over Roy's last commit.  This
fixes that typo.
2010-07-10 15:31:16 -05:00
William Hubbs
898552dcc3 fix metric
This change was also taken from Roy Marples' git.
2010-07-07 19:55:37 -05:00
William Hubbs
6850566be0 remove extra route
This was taken from Roy Marples' git repository.
2010-07-07 19:42:56 -05:00
Mike Frysinger
3036b44798 restore init.d pause option 2010-04-09 02:19:40 -04:00
Mike Frysinger
acc0edb040 restore old e* func output
Gentoo has always used the sytle:
 * moo ...                [ ok ]
Latest openrc now does:
* moo...                    [ok]

Realistically, 4 spaces out of 80 on reduced terminals doesn't make any
sort of realistic difference and it's been just fine for the last 10
years, so keep the default behavior.
2010-04-09 02:19:40 -04:00
Seth Robertson
316a316d9b Allow dhclient per $IFACE arguments. 2010-03-30 09:21:54 +01:00
Michal Gorny
20b4076b12 Support sysfs.
Fixes #214
2010-03-27 08:53:04 +00:00
Roy Marples
4d86d34635 Fix -s and -S. 2010-03-26 22:10:03 +00:00
Roy Marples
ae7a92ae7b Try and describe bonding errors a bit more. 2010-03-24 20:41:18 +00:00
Roy Marples
67b538fd26 Fix tentative ip addresses 2010-03-24 20:25:42 +00:00
14 changed files with 78 additions and 43 deletions

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.6.1
VERSION= 0.6.3
PKG= ${NAME}-${VERSION}

View File

@@ -896,7 +896,7 @@
# and you're done :)
# By default we don't wait for netplug/ifplugd to configure the interface.
# If you would like it to wait so that other services now that network is up
# If you would like it to wait so that other services know that network is up
# then you can specify a timeout here.
#plug_timeout="10"
# A value of 0 means wait forever.
@@ -936,8 +936,8 @@
#preup() {
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the mii-diag
# # package to be installed.
# # only works on some network adapters and requires the
# # sys-apps/net-tools package to be installed.
# if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then
# ewarn "No link on ${IFACE}, aborting configuration"
# return 1

View File

@@ -8,7 +8,7 @@ depend()
{
need localmount termencoding
after hotplug bootmisc
keyword -openvz -prefix -uml -vserver -xenu
keyword -openvz -prefix -uml -vserver -xenu -lxc
}
start()

View File

@@ -8,7 +8,7 @@ depend()
{
need localmount termencoding
after bootmisc
keyword -openvz -prefix -uml -vserver -xenu
keyword -openvz -prefix -uml -vserver -xenu -lxc
}
start()

View File

@@ -63,17 +63,9 @@ tentative()
case "$RC_UNAME" in
Linux)
[ -x /sbin/ip ] || return 1
LC_ALL=C ip addr show | while read inet address rest; do
case "${inet}" in
inet6)
case "${rest}" in
*" "tentative*) return 2;;
esac
;;
esac
done
[ $? = 2 ]
[ -x /sbin/ip ] || [ -x /bin/ip ] || return 1
[ -n "$(ip -f inet6 addr show tentative)" ]
;;
*)
local inet= address= rest=
LC_ALL=C ifconfig -a | while read inet address rest; do
@@ -169,7 +161,7 @@ runip()
routeflush()
{
if [ "$RC_UNAME" = Linux ]; then
if [ -x /sbin/ip ]; then
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then
ip route flush scope global
ip route delete default 2>/dev/null
else
@@ -231,8 +223,6 @@ start()
routeflush
if [ "$RC_UNAME" = "Linux" ]; then
ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
route add -net 127.0.0.0 netmask 255.0.0.0 \
gw 127.0.0.1 2>/dev/null
route add -net 127.0.0.0 netmask 255.0.0.0 \
gw 127.0.0.1 reject 2>/dev/null
else
@@ -289,9 +279,14 @@ start()
r=5
while [ $r -gt 0 ]; do
tentative || break
[ $r = 5 ] && vebegin "Waiting for tentative addresses"
sleep 1
r=$(($r - 1))
done
if [ $r != 5 ]; then
[ $r != 0 ]
veend $?
fi
if [ -n "$defaultroute" ]; then
ebegin "Setting default route $defaultroute"
@@ -343,7 +338,7 @@ stop()
then
veinfo "$int"
runargs /etc/ifdown."$int" "$downcmd"
if [ -x /sbin/ip ]; then
if [ -x /sbin/ip ] || [ -x /bin/ip ]; then
# We need to do this, otherwise we may
# fail to add things correctly on restart
ip address flush dev "$int" 2>/dev/null

View File

@@ -15,7 +15,14 @@ _is_bond()
bonding_pre_start()
{
local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
local x= s= n= slaves= primary=
slaves="$(_get_array "slaves_${IFVAR}")"
unset slaves_${IFVAR}
eval primary="\$primary_${IFVAR}"
unset primary_${IFVAR}
[ -z "${slaves}" ] && return 0
@@ -43,9 +50,12 @@ bonding_pre_start()
# Nice and dynamic :)
for x in /sys/class/net/"${IFACE}"/bonding/*; do
[ -f "${x}" ] || continue
eval s=\$${x##*/}_${IFVAR}
n=${x##*/}
eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then
echo "${s}" >"${x}"
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
@@ -72,6 +82,11 @@ bonding_pre_start()
# finally add in slaves
eoutdent
if [ -d /sys/class/net ]; then
if [ -n "${primary}" ]; then
echo "+${primary}" >/sys/class/net/"${IFACE}"/bonding/slaves
echo "${primary}" >/sys/class/net/"${IFACE}"/bonding/primary
slaves="${slaves/${primary}/}"
fi
for s in ${slaves}; do
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
done
@@ -117,6 +132,12 @@ bonding_stop()
done
)
_down
if [ -d /sys/class/net ]; then
echo "-${IFACE}" > /sys/class/net/bonding_masters
fi
eend 0
return 0
}

View File

@@ -17,6 +17,7 @@ dhclient_start()
# Get our options
# These options only work in Gentoo, and maybe RedHat
eval args=\$dhclient_${IFVAR}
eval opts=\$dhcp_${IFVAR}
[ -z "${opts}" ] && opts=${dhcp}

View File

@@ -1,9 +1,18 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
_ip()
{
if [ -x /bin/ip ]; then
echo /bin/ip
else
echo /sbin/ip
fi
}
iproute2_depend()
{
program /sbin/ip
program $(_ip)
provide interface
after ifconfig
}
@@ -160,7 +169,8 @@ _add_route()
# We cannot use a metric if we're using a nexthop
if ! ${have_metric} && \
[ -n "${metric}" -a -z "${cmd##* nexthop }" ]
[ -n "${metric}" -a \
"${cmd##* nexthop }" = "$cmd" ]
then
cmd="${cmd} metric ${metric}"
fi

View File

@@ -20,7 +20,7 @@ _is_vlan()
_get_vlans()
{
[ -e /proc/net/vlan/config ] || return 1
sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config
sed -n -e 's/^\W*\([^ ]*\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config
}
_check_vlan()

View File

@@ -2,7 +2,8 @@ DIR= ${LIBDIR}/pkgconfig
SRCS= einfo.pc.in openrc.pc.in
INC= einfo.pc openrc.pc
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
.DEFAULT:
${SED} -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
SED_EXTRA= -e 's:@VERSION@:${VERSION}:g'

View File

@@ -6,26 +6,30 @@
if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
cat /proc/acpi/ac_adapter/AC*/state | while read line; do
case "$line" in
"state:"*"off-line") return 128;;
"state:"*"off-line") exit 128;;
esac
done
elif [ -f /sys/class/power_supply/AC*/online ]; then
cat /sys/class/power_supply/AC*/online | while read line; do
[ "${line}" = 0 ] && exit 128
done
elif [ -f /proc/pmu/info ]; then
cat /proc/pmu/info | while read line; do
case "$line" in
"AC Power"*": 0") return 128;;
"AC Power"*": 0") exit 128;;
esac
done
elif type envstat >/dev/null 2>&1; then
# NetBSD has envstat
envstat -d acpiacad0 2>/dev/null | while read line; do
case "$line" in
"connected:"*"OFF") return 128;;
"connected:"*"OFF") exit 128;;
esac
done
elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
case $(sysctl -n hw.acpi.acline) in
0) return 1;;
*) return 0;;
0) exit 1;;
*) exit 0;;
esac
else
exit 255

View File

@@ -643,7 +643,7 @@ static int EINFO_PRINTF(3, 0)
fprintf(f, "\n");
if (_eprefix)
fprintf(f, "%s%s%s|", _ecolor(f, color), _eprefix, _ecolor(f, ECOLOR_NORMAL));
fprintf(f, "%s*%s ", _ecolor(f, color), _ecolor(f, ECOLOR_NORMAL));
fprintf(f, " %s*%s ", _ecolor(f, color), _ecolor(f, ECOLOR_NORMAL));
retval += _eindent(f);
va_copy(ap, va);
retval += vfprintf(f, fmt, ap) + 3;
@@ -800,7 +800,7 @@ ebegin(const char *EINFO_RESTRICT fmt, ...)
va_start(ap, fmt);
retval = _einfovn(fmt, ap);
va_end(ap);
retval += printf("...");
retval += printf(" ...");
if (colour_terminal(stdout))
retval += printf("\n");
LASTCMD("ebegin");
@@ -817,7 +817,7 @@ _eend(FILE * EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
if (!msg)
return;
cols = get_term_columns(fp) - (strlen(msg) + 3);
cols = get_term_columns(fp) - (strlen(msg) + 5);
/* cons25 is special - we need to remove one char, otherwise things
* do not align properly at all. */
@@ -831,18 +831,15 @@ _eend(FILE * EINFO_RESTRICT fp, int col, ECOLOR color, const char *msg)
if (term_is_cons25)
cols--;
/* If extra spacing is required around msg, then please change
* via a runtime knob and leave this default as is as it saves 2
* valuable columns when running on 80 column screens. */
if (cols > 0 && colour_terminal(fp)) {
fprintf(fp, "%s%s %s[%s%s%s]%s\n", up, tgoto(goto_column, 0, cols),
fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols),
ecolor(ECOLOR_BRACKET), ecolor(color), msg,
ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL));
} else {
if (col > 0)
for (i = 0; i < cols - col; i++)
fprintf(fp, " ");
fprintf(fp, " [%s]\n", msg);
fprintf(fp, " [ %s ]\n", msg);
}
}
@@ -1030,7 +1027,7 @@ ebeginv(const char *EINFO_RESTRICT fmt, ...)
va_start(ap, fmt);
retval = _einfovn(fmt, ap);
retval += printf("...");
retval += printf(" ...");
if (colour_terminal(stdout))
retval += printf("\n");
va_end(ap);

View File

@@ -773,7 +773,7 @@ handle_bad_signal(int sig)
#endif
#include "_usage.h"
#define getoptstring "o:" getoptstring_COMMON
#define getoptstring "o:s:S" getoptstring_COMMON
static const struct option longopts[] = {
{ "override", 1, NULL, 'o' },
{ "service", 1, NULL, 's' },

View File

@@ -1318,6 +1318,12 @@ runscript(int argc, char **argv)
prefix = NULL;
retval = svc_exec("status", NULL);
} else {
if (strcmp(optarg, "pause") == 0) {
ewarn("WARNING: 'pause' is deprecated; please use '--nodeps stop'");
deps = false;
optarg = "stop";
}
if (strcmp(optarg, "conditionalrestart") == 0 ||
strcmp(optarg, "condrestart") == 0)
{