#!/bin/sh

if [ -c "/dev/ppp" ]
        then echo "."
        else
        mknod /dev/ppp c 108 0
fi

if [ ! -d "/run/lock" ]
	then
        mkdir -p /run/lock
fi


#---- expand rootfs if not done yet
/etc/init.d/expandfs.sh
#---- X30 /dev/ttyS2 Einstellungen
switchserialmode ttyuart -D /dev/ttyS2 -m rs485
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do

     # Ignore dangling symlinks (if any).
     [ ! -f "$i" ] && continue

     case "$i" in
	*.sh)
	    # Source shell script for speed.
	    (
		trap - INT QUIT TSTP
		set start
		. $i
	    )
	    ;;
	*.detach)
	    # start detached
	    $i start &
	    ;;
	*)
	    # No sh extension, so fork subprocess.
	    $i start
	    ;;
    esac
done

#--- iptables settings
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
/root/portfwd.sh &
#----
