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