#!/bin/sh
#
# Copyright (c) 2006 Meraki Networks, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, subject to the conditions
# listed in the Meraki.LICENSE file. These conditions include: you must
# preserve this copyright notice, and you cannot mention the copyright
# holders in advertising related to the Software without their permission.
# The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
# notice is a summary of the Meraki.LICENSE file; the license in that file is
# legally binding.
#
#

/usr/bin/check-bootreason

echo `/usr/bin/serial_number.sh` | /usr/bin/passwd -s meraki
echo `/usr/bin/serial_number.sh` | /usr/bin/passwd -s roofnet

# initially configure the wired network in case brain dies.
if [ `cat /MERAKI_ARCH` == "mipsel" ]; then
    /sbin/ifconfig vlan0 192.168.87.1
else
    /sbin/ifconfig eth0 192.168.87.1
fi

/usr/bin/ruby /usr/bin/brain.rb >> /tmp/brain.log 2>&1 &
crontab /etc/crontab

# /usr/bin/harvestd &

/usr/bin/ruby /usr/bin/reporter.rb &
/usr/bin/nc-fix.sh &
#/usr/bin/upgrade.rb &
if [ -f /storage/late-init.sh ]; then
    . /storage/late-init.sh
fi
