]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/system/network
network scripts: remove check for AUTOCONNECT
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / network
CommitLineData
8ae238a5 1#!/bin/bash
66c36198
PM
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
3fd5feeb
MT
21
22. /etc/sysconfig/rc
23. ${rc_functions}
bf7c473f 24eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
bf7c473f 25
37263bc1
MT
26DO="${1}"
27shift
069680ac 28
37263bc1 29if [ -n "${1}" ]; then
d1e90efc 30 ALL=0
d51e4906 31 for i in green red blue orange; do
d1e90efc
MT
32 eval "${i}=0"
33 done
37263bc1 34else
d1e90efc
MT
35 ALL=1
36 for i in green red blue orange; do
37 eval "${i}=1"
38 done
37263bc1 39fi
069680ac 40
37263bc1 41while [ ! $# = 0 ]; do
d1e90efc
MT
42 for i in green red blue orange; do
43 if [ "${i}" == "${1}" ]; then
44 eval "${i}=1"
45 shift
46 fi
47 done
37263bc1 48done
3fd5feeb 49
37263bc1 50case "${DO}" in
d1e90efc 51 start)
d1e90efc
MT
52 # Starting interfaces...
53 # GREEN
54 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start
55
56 # BLUE
57 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
58 /etc/rc.d/init.d/networking/blue start
59
60 # ORANGE
61 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
62 /etc/rc.d/init.d/networking/orange start
63
64 # RED
65 if [ "$red" == "1" ]; then
100cd24a
JS
66 # Remove possible leftover files
67 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
f2e90a6e 68 /etc/rc.d/init.d/networking/red start
d51e4906 69 fi
1d4897f3 70
68e69b67
MT
71 # Create IPsec interfaces
72 /usr/local/bin/ipsec-interfaces
73
1d4897f3 74 /etc/rc.d/init.d/static-routes start
e704dbe6
MT
75
76 boot_mesg "Mounting network file systems..."
77 mount -a -O _netdev
78 evaluate_retval
d1e90efc
MT
79 ;;
80
81 stop)
e704dbe6
MT
82 boot_mesg "Umounting network file systems..."
83 umount -a -O _netdev
84 evaluate_retval
85
d1e90efc
MT
86 # Stopping interfaces...
87 # GREEN
88 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop
89
90 # BLUE
91 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
92 /etc/rc.d/init.d/networking/blue stop
93
94 # ORANGE
95 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
96 /etc/rc.d/init.d/networking/orange stop
97
98 # RED
99 if [ "$red" == "1" ]; then
100 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
101 /etc/rc.d/init.d/networking/red stop
102 fi
103 fi
7be0be70 104
a4109682 105 exit 0
d1e90efc
MT
106 ;;
107
108 restart)
109 for i in green red blue orange; do
110 if [ "${!i}" == "1" ]; then
111 ARGS+=" ${i}"
112 fi
113 done
114 ${0} stop ${ARGS}
115 sleep 1
116 ${0} start ${ARGS}
117 ;;
118
119 *)
120 echo "Usage: ${0} {start|stop|restart} [device(s)]"
121 exit 1
122 ;;
3fd5feeb 123esac