]>
Commit | Line | Data |
---|---|---|
b0443108 | 1 | # |
706a60ed | 2 | # $Id: functions.network,v 1.20 1999/08/31 23:12:45 wiget Exp $ |
b0443108 | 3 | # |
7e04fe0e | 4 | # This is not a shell script; it provides functions to network scripts |
5 | # that source it. | |
6 | ||
7 | source_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 ] || { | |
706a60ed | 15 | nls "Missing config file %s.\n" "$PARENTCONFIG" >&2 |
7e04fe0e | 16 | exit 1 |
17 | } | |
18 | . ./$PARENTCONFIG | |
19 | fi | |
20 | . /etc/sysconfig/interfaces/$CONFIG | |
21 | } | |
22 | ||
23 | do_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 | ||
35 | need_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 | ||
45 | set_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 |