mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-12 04:05:53 +02:00
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-2.x into seventeen-geoip
Conflicts: make.sh
This commit is contained in:
@@ -84,11 +84,14 @@ case "$1" in
|
||||
fi
|
||||
|
||||
# Enable swap plugin if swap found
|
||||
if [ "$(swapon -s | wc -l)" == "1" ]; then
|
||||
if [ "$(swapon -s | wc -l)" == "0" ]; then
|
||||
sed -i -e "s|^LoadPlugin swap|#LoadPlugin swap|g" /etc/collectd.conf
|
||||
else
|
||||
sed -i -e "s|^#LoadPlugin swap|LoadPlugin swap|g" /etc/collectd.conf
|
||||
fi
|
||||
|
||||
# sync after config update...
|
||||
sync
|
||||
|
||||
if [ $(date +%Y) -gt 2011 ]; then
|
||||
boot_mesg "Starting Collection daemon..."
|
||||
@@ -107,6 +110,8 @@ case "$1" in
|
||||
if [ "$(basename $0)" == "collectd" ]; then
|
||||
/etc/init.d/tmpfs backup
|
||||
fi
|
||||
# sync after backup...
|
||||
sync
|
||||
;;
|
||||
restart)
|
||||
${0} stop
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
. ${rc_functions}
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
|
||||
|
||||
FONT="LatArCyrHeb-16"
|
||||
FONT="latarcyrheb-sun16"
|
||||
KEYMAP_CORRECTIONS="euro2"
|
||||
UNICODE="1"
|
||||
BROKEN_COMPOSE="0"
|
||||
|
||||
@@ -106,8 +106,18 @@ case "${1}" in
|
||||
sleep 2
|
||||
|
||||
if [ "$(/usr/sbin/iwconfig $INTERFACE | /bin/grep "Mode:Master")" == "" ]; then
|
||||
boot_mesg "Error! Can't set wlan master mode"
|
||||
echo_failure;
|
||||
killproc /usr/bin/hostapd > /dev/null 2>&1
|
||||
boot_mesg "Try to create additional AP device ..."
|
||||
ip link set ${INTERFACE} down
|
||||
ip link set ${INTERFACE} name ${INTERFACE}_man
|
||||
iw dev ${INTERFACE}_man interface add ${INTERFACE} type __ap
|
||||
evaluate_retval;
|
||||
if [ -d /sys/class/net/${INTERFACE} ]; then
|
||||
/usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf >/dev/null 2>&1 &
|
||||
else
|
||||
ip link set ${INTERFACE}_man down
|
||||
ip link set ${INTERFACE}_man name ${INTERFACE}
|
||||
fi
|
||||
exit 0;
|
||||
else
|
||||
echo_ok
|
||||
@@ -116,7 +126,9 @@ case "${1}" in
|
||||
|
||||
stop)
|
||||
boot_mesg "Stopping hostapd..."
|
||||
|
||||
ip link set ${INTERFACE} down > /dev/null 2>&1
|
||||
ip link set ${INTERFACE} down_man > /dev/null 2>&1
|
||||
sleep 1
|
||||
killproc /usr/bin/hostapd
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
@@ -94,6 +94,11 @@ case "${1}" in
|
||||
setup_netdev_trigger nas6210:red:power ${RED_DEV} tx rx
|
||||
setup_netdev_trigger nas6210:red:usb_copy ${GREEN_DEV} tx rx
|
||||
|
||||
# Mirabox start
|
||||
setup_heartbeat_trigger mirabox:green:pwr
|
||||
setup_netdev_trigger mirabox:green:stat ${GREEN_DEV} tx rx
|
||||
setup_netdev_trigger mirabox:blue:stat ${BLUE_DEV} tx rx
|
||||
|
||||
exit 0
|
||||
;;
|
||||
|
||||
@@ -132,6 +137,12 @@ case "${1}" in
|
||||
disable_led_trigger nas6210:red:power
|
||||
disable_led_trigger nas6210:red:usb_copy
|
||||
|
||||
# Mirabox stop
|
||||
disable_led_trigger mirabox:green:pwr
|
||||
enable_led mirabox:green:pwr
|
||||
disable_led_trigger mirabox:green:stat
|
||||
disable_led_trigger mirabox:blue:stat
|
||||
|
||||
exit 0
|
||||
;;
|
||||
|
||||
|
||||
79
src/initscripts/init.d/swconfig
Normal file
79
src/initscripts/init.d/swconfig
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/swconfig
|
||||
#
|
||||
# Description : Script to setup lan switch.
|
||||
# don't edit this script! If you want change the functions
|
||||
# create an own script called swconfig.user
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
if [ -e /etc/init.d/swconfig.user ]; then
|
||||
/etc/init.d/swconfig.user $*
|
||||
exit ${?}
|
||||
fi
|
||||
|
||||
if [ -e /var/ipfire/ethernet/swconfig_mac ]; then
|
||||
SWMAC=`cat /var/ipfire/ethernet/swconfig_mac`
|
||||
else
|
||||
# Generate a random local administrated mac address for vlan swconfig.
|
||||
SWMAC=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
|
||||
echo $SWMAC > /var/ipfire/ethernet/swconfig_mac
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
case `cat /proc/device-tree/model 2>/dev/null` in
|
||||
"Lamobo-R1")
|
||||
#
|
||||
# Lamobo R1 aka BPi R1 Routerboard
|
||||
#
|
||||
# Speaker | LAN1 | LAN2 | LAN3 | LAN4 || LAN5 | HDMI
|
||||
# SW-Port | P2 | P1 | P0 | P4 || P3 |
|
||||
# VLAN | 11 | 12 | 13 | 14 ||ALL(t)|
|
||||
#
|
||||
# Switch-Port P8 - ALL(t) boards internal CPU Port
|
||||
#
|
||||
device=`ls /sys/class/net/*/device/stmmac-0* | head -1 | cut -d/ -f5`
|
||||
ip link set $device up
|
||||
boot_mesg "Configure vlan-switch on $device ..."
|
||||
# Reset switch, counter and enable vlan mode
|
||||
swconfig dev $device set reset 1
|
||||
swconfig dev $device set reset_mib 1
|
||||
swconfig dev $device set enable_vlan 1
|
||||
# configure vlans
|
||||
swconfig dev $device vlan 11 set ports "2 3t 8t"
|
||||
swconfig dev $device vlan 12 set ports "1 3t 8t"
|
||||
swconfig dev $device vlan 13 set ports "0 3t 8t"
|
||||
swconfig dev $device vlan 14 set ports "4 3t 8t"
|
||||
# activate new config
|
||||
swconfig dev $device set apply 1
|
||||
# create interfaces for the vlan's
|
||||
modprobe 8021q
|
||||
vconfig add $device 11
|
||||
vconfig add $device 12
|
||||
vconfig add $device 13
|
||||
vconfig add $device 14
|
||||
# set local mac addresses.
|
||||
ip link set dev $device.11 address $SWMAC:11
|
||||
ip link set dev $device.12 address $SWMAC:12
|
||||
ip link set dev $device.13 address $SWMAC:13
|
||||
ip link set dev $device.14 address $SWMAC:14
|
||||
# need to restart udev...
|
||||
killall udevd
|
||||
/etc/init.d/udev start
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/swconfig
|
||||
|
||||
Reference in New Issue
Block a user