source: bootscripts/lfs/sysconfig/network-devices/services/ipv4-static@ 1c48007

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 1c48007 was 1c48007, checked in by Bruce Dubbs <bdubbs@…>, 16 years ago

Moved bootscripts and udev-config to BOOK
Updated Makefile to automatically generate bootscript and udev-config tarballs
Updated licesnse to be the same as BLFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8548 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin $network_devices/services/ipv4-static
4#
5# Description : IPV4 Static Boot Script
6#
7# Authors : Nathan Coulson - nathan@linuxfromscratch.org
8# Kevin P. Fleming - kpfleming@linuxfromscratch.org
9#
10# Version : 00.00
11#
12# Notes :
13#
14########################################################################
15
16. /etc/sysconfig/rc
17. ${rc_functions}
18. ${IFCONFIG}
19
20if [ -z "${IP}" ]; then
21 boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
22 echo_failure
23 exit 1
24fi
25
26if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
27 boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
28 boot_mesg " assuming 24."
29 echo_warning
30 PREFIX=24
31 args="${args} ${IP}/${PREFIX}"
32elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
33 boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
34 echo_failure
35 exit 1
36elif [ -n "${PREFIX}" ]; then
37 args="${args} ${IP}/${PREFIX}"
38elif [ -n "${PEER}" ]; then
39 args="${args} ${IP} peer ${PEER}"
40fi
41
42if [ -n "${BROADCAST}" ]; then
43 args="${args} broadcast ${BROADCAST}"
44fi
45
46case "${2}" in
47 up)
48 boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..."
49 ip addr add ${args} dev ${1}
50 evaluate_retval
51
52 if [ -n "${GATEWAY}" ]; then
53 if ip route | grep -q default; then
54 boot_mesg "Gateway already setup; skipping." ${WARNING}
55 echo_warning
56 else
57 boot_mesg "Setting up default gateway..."
58 ip route add default via ${GATEWAY} dev ${1}
59 evaluate_retval
60 fi
61 fi
62 ;;
63
64 down)
65 if [ -n "${GATEWAY}" ]; then
66 boot_mesg "Removing default gateway..."
67 ip route del default
68 evaluate_retval
69 fi
70
71 boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..."
72 ip addr del ${args} dev ${1}
73 evaluate_retval
74 ;;
75
76 *)
77 echo "Usage: ${0} [interface] {up|down}"
78 exit 1
79 ;;
80esac
81
82# End $network_devices/services/ipv4-static
Note: See TracBrowser for help on using the repository browser.