]> git.pld-linux.org Git - projects/rc-scripts.git/blame - rc.d/init.d/functions.network
Zrobione. (to z ipv6)
[projects/rc-scripts.git] / rc.d / init.d / functions.network
CommitLineData
b0443108 1#
e016cdae 2# $Id: functions.network,v 1.11 1999/07/15 13:29:44 misiek Exp $
b0443108 3#
7e04fe0e 4# This is not a shell script; it provides functions to network scripts
5# that source it.
6
7source_config ()
8{
9 DEVNAME=`basename $CONFIG | sed 's/^ifcfg-//g'`
10
11 if basename $CONFIG | grep -q '[^g]-' ; then
12 PARENTCONFIG=`echo $CONFIG | sed 's/-[^-]*$//g'`
13 PARENTDEVNAME=`echo $PARENTCONFIG | sed 's/^ifcfg-//g'`
14 [ -f $PARENTCONFIG ] || {
15 echo "Missing config file $PARENTCONFIG." >&2
16 exit 1
17 }
18 . ./$PARENTCONFIG
19 fi
20 . /etc/sysconfig/interfaces/$CONFIG
21}
22
23do_netreport ()
24{
25 # Notify programs that have requested notification
26 ( cd /var/run/netreport || exit
27 for i in * ; do
28 [ -f $i ] && \
29 kill -SIGIO $i >/dev/null 2>&1 || \
30 rm -f $i >/dev/null 2>&1
31 done
32 )
33}
34
35need_hostname()
36{
37 if [ "`hostname`" = "(none)" -o "`hostname`" = "localhost" -o \
38 "`hostname`" = "localhost.localdomain" ]; then
39 NEEDHOSTNAME=yes
40 else
41 unset NEEDHOSTNAME
42 fi
43}
44
45set_hostname()
46{
47 echo "$1" > /etc/HOSTNAME
48 hostname $1
49 if ! grep search /etc/resolv.conf; then
50 domain=`echo $1 | sed 's/^[^\.]*\.//'`
51 echo "search $domain" >> /etc/resolv.conf
52 fi
53}
54
55# PLD network functions
56