#!/bin/sh
echo "Setting up filesystem..."
mkdir -p /root/.ssh
cat >> /root/.ssh/authorized_keys << EOF
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAo/lxjrvjtukTKXN6wMeUNXcfPFuyl+fD+6SRWiqylwjUqWcXl51IVXtK8W64aws/oTYHX4fhVi52O26iitPg9KhuMOXqzl+hBXMTxibIxgUxGmEILngNECmkhs3m43gZa0riPiI6rBwAaoJBxBX9SJYLQ9K4Q0qgv3Cqp+7ibbU= root@gig00
EOF

cat >> /root/.ssh/config << EOF
StrictHostKeyChecking no
EOF

echo "Setting up root directory in passwd..."
sed -i 's/\/tmp/\/root/' /etc/passwd

echo "Setting up NVRAM for AODV..."
nvram set lan_ifname=vlan0
nvram unset lan_ifnames
nvram set wifi_ifname=eth1
nvram set wifi_proto=static
nvram set wifi_netmask=255.255.0.0
nvram set wl0_mode=sta
nvram set wl0_infra=0
nvram set wl0_ssid=reshoc
echo -n "Enter Wifi Address: "
read ADDR
echo $ADDR
nvram set wifi_ipaddr=$ADDR
nvram commit
echo "Prepairing to reboot..."
sleep(5)
reboot
