File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / Attic / rc.initial
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Fri Oct 12 08:22:44 2012 UTC (11 years, 8 months ago) by misho
Branches: MAIN
CVS tags: elwix1_7, HEAD, ELWIX1_6
ELWIX 1.6

#!/bin/sh
#
# ELWIX Initial RC Menu script
#
# $Id: rc.initial,v 1.2 2012/10/12 08:22:44 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>