#!/bin/sh # # ELWIX Initial RC Menu script # # $Id: rc.initial,v 1.2.2.1 2013/01/23 14:13:14 misho Exp $ # trap : 2 trap : 3 trap : 18 #exec /dev/console 2>/dev/console MAGIC_MENU="menu" 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