#!/bin/sh
#
# ELWIX Initial RC script
#
# $Id: rc.initial,v 1.1.1.1 2011/07/05 23:43:00 misho Exp $
#
trap : 2
trap : 3
trap : 18
#exec </dev/console >/dev/console 2>/dev/console
MAGIC_MENU="unhide menu, now!"
menu()
{
echo
echo
echo "elwix - console setup"
echo "*********************"
echo "0) Logout"
echo "1) Interfaces: assign network ports"
echo "2) Set up LAN IP address"
echo "3) Reset webGUI password"
echo "4) Reset to factory defaults"
echo "5) Reboot system"
echo "6) Ping host"
echo "7) SSH to host"
echo "8) Go to shell"
[ -r /etc/platform ] && PLATFORM=$(cat /etc/platform)
if [ "${PLATFORM}" != "embedded" ]; then
echo "9) Install on Hard Drive $PLATFORM";
fi
echo
read -p "Enter number: " opcode
case ${opcode} in
0)
exit
;;
1)
;;
2)
;;
3)
;;
4)
;;
5)
reboot
;;
6)
read -p " +Address: " host
read -p " +Number packets [4]: " cx
ping -n -c ${cx:-4} ${host:-localhost}
;;
7)
read -p " +Address: " host
read -p " +Port [22]: " port
read -p " +User [$USER]: " user
ssh -p ${port:-22} -l ${user:-$USER} ${host:-localhost}
;;
8)
$SHELL
;;
9)
;;
esac
}
### main()
while : ; do
if [ -r /etc/disablemenu ]; then
echo
echo
echo "*** Console menu disabled. ***"
echo
stty -echo
read tmp
stty echo
if [ X"${tmp}" = X"${MAGIC_MENU}" ]; then
echo
echo "> OK, temporary unhide menu ..."
echo
menu
fi
else
menu
fi
done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>