Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
508121866c | ||
|
|
7793e4bc19 | ||
|
|
9730a62265 |
7
Makefile
7
Makefile
@@ -8,13 +8,14 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
DEPENDS = dhclient,iproute2
|
DEPENDS = dash,dhclient,iproute2
|
||||||
ARCH = none
|
ARCH = none
|
||||||
URL =
|
URL = http://snaplinux.org/
|
||||||
|
REPO = core
|
||||||
BRIEF = Scripts for starting and stopping network interfaces
|
BRIEF = Scripts for starting and stopping network interfaces
|
||||||
DESC = Scripts which use the iproute2 tools for automatically starting and \
|
DESC = Scripts which use the iproute2 tools for automatically starting and \
|
||||||
stopping network devices during startup.
|
stopping network devices during startup.
|
||||||
SNAPVER = 0
|
SNAPVER = 1
|
||||||
|
|
||||||
ARCHIVE :=
|
ARCHIVE :=
|
||||||
SRCDIR := $(PWD)/SRC/iftools
|
SRCDIR := $(PWD)/SRC/iftools
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -7,8 +7,8 @@ case $1 in
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
postinst)
|
postinst)
|
||||||
if [ ! -f ${TARGET}/etc/network.conf ]; then
|
if [ ! -f /etc/network.conf ]; then
|
||||||
cp ${TARGET}/usr/share/iftools/network.conf ${TARGET}/etc/network.conf
|
cp /usr/share/iftools/network.conf /etc/network.conf
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
prerm)
|
prerm)
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ dirs:
|
|||||||
install -d -v -m 755 $(DESTDIR)/etc/init.d
|
install -d -v -m 755 $(DESTDIR)/etc/init.d
|
||||||
install -d -v -m 755 $(DESTDIR)/etc/network.d
|
install -d -v -m 755 $(DESTDIR)/etc/network.d
|
||||||
install -d -v -m 755 $(DESTDIR)/usr/share/iftools
|
install -d -v -m 755 $(DESTDIR)/usr/share/iftools
|
||||||
install -d -v -m 755 $(DESTDIR)/usr/share/man/man{5,8}
|
install -d -v -m 755 $(DESTDIR)/usr/share/man/man5
|
||||||
|
install -d -v -m 755 $(DESTDIR)/usr/share/man/man8
|
||||||
install -d -v -m 755 $(DESTDIR)/sbin
|
install -d -v -m 755 $(DESTDIR)/sbin
|
||||||
|
|
||||||
files:
|
files:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
VERSION=1.0
|
VERSION=1.2
|
||||||
CONFDIR=/etc
|
CONFDIR=/etc
|
||||||
CONFIGFILE=$CONFDIR/network.conf
|
CONFIGFILE=$CONFDIR/network.conf
|
||||||
NL='
|
NL='
|
||||||
@@ -19,7 +19,9 @@ auto () {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <<< "$1"
|
done << EOF
|
||||||
|
$1
|
||||||
|
EOF
|
||||||
|
|
||||||
echo "$autoifaces"
|
echo "$autoifaces"
|
||||||
}
|
}
|
||||||
@@ -84,7 +86,9 @@ getinet () {
|
|||||||
address=${address%% *}
|
address=${address%% *}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done <<< "$(ip addr show $iface)"
|
done << EOF
|
||||||
|
$(ip addr show $iface)
|
||||||
|
EOF
|
||||||
|
|
||||||
echo $address
|
echo $address
|
||||||
}
|
}
|
||||||
@@ -218,7 +222,9 @@ up () {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done <<< "$2"
|
done << EOF
|
||||||
|
$2
|
||||||
|
EOF
|
||||||
|
|
||||||
if [ -z "$exists" ]; then
|
if [ -z "$exists" ]; then
|
||||||
echo "$iface not defined"
|
echo "$iface not defined"
|
||||||
@@ -237,6 +243,21 @@ up () {
|
|||||||
|
|
||||||
for brport in "$brports"; do
|
for brport in "$brports"; do
|
||||||
[ -n "$verbose" ] && echo "Configuring $brport as slave to $iface"
|
[ -n "$verbose" ] && echo "Configuring $brport as slave to $iface"
|
||||||
|
[ -n "$verbose" ] && echo "Flushing interface $brport"
|
||||||
|
|
||||||
|
if [ -n "$noact" ]; then
|
||||||
|
echo "ip address flush dev $brport"
|
||||||
|
else
|
||||||
|
ip address flush dev $brport
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$verbose" ] && echo "Bringing up interface $brport"
|
||||||
|
|
||||||
|
if [ -n "$noact" ]; then
|
||||||
|
echo "ip link set dev $brport up"
|
||||||
|
else
|
||||||
|
ip link set dev $brport up
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$noact" ]; then
|
if [ -n "$noact" ]; then
|
||||||
echo "ip link set dev $brport master $iface"
|
echo "ip link set dev $brport master $iface"
|
||||||
@@ -336,7 +357,7 @@ up () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$gateway" ]; then
|
if [ -n "$gateway" ]; then
|
||||||
[ -z "$verbose" ] && echo "Setting default route via $gateway"
|
[ -n "$verbose" ] && echo "Setting default route via $gateway"
|
||||||
|
|
||||||
if [ -n "$noact" ]; then
|
if [ -n "$noact" ]; then
|
||||||
echo "ip route add default via $gateway"
|
echo "ip route add default via $gateway"
|
||||||
@@ -364,7 +385,7 @@ up () {
|
|||||||
if [ -n "$noact" ]; then
|
if [ -n "$noact" ]; then
|
||||||
echo "ip route add $route dev $iface src $address"
|
echo "ip route add $route dev $iface src $address"
|
||||||
else
|
else
|
||||||
ip route add $route dev $iface src $address
|
ip route add $route dev "$iface" src "$address"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user