Menu

[r10367]: / branches / 0.7exp / etc / rc.initial  Maximize  Restore  History

Download this file

88 lines (79 with data), 2.1 kB

#!/bin/sh

# /etc/rc.initial
# part of m0n0wall (http://neon1.net/m0n0wall)
# Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
# All rights reserved.
# Modified for FreeNAS (http://www.freenas.org) by Olivier Cochard-Labbe <olivier@freenas.org>
# Some lines on this file are taken from pfSense (http://www.pfsense.com/) by Scott Ullrich

. /etc/rc.subr
. /etc/configxml.subr

# Make sure the user can't kill us by pressing Ctrl-C
trap : 2
trap : 3
trap : 4
# Make sure the user can't access rootshell by pressing Ctrl-Z
trap : 18

# Set our operating platform
PLATFORM=`cat /etc/platform`

# Redirect input/output
#exec </dev/console >/dev/console 2>/dev/console

# Check if console menu is disabled.
if configxml_isset "//system/disableconsolemenu"; then
	while : ; do
		printf "\n\n\33[31m%s\33[0m\n\n"  "*** Console menu disabled. ***"
		read tmp
	done
else
	# endless loop
	while : ; do
		# display menu
		printf "\n\n%16s\n%s\n"  "Console setup" "--------------------"
		#echo "0) Logout (SSH only)"
		printf "%s \33[32m%s\33[0m\n" "1)" "Assign interfaces"
		printf "%s \33[32m%s\33[0m\n" "2)" "Set LAN IP address"
		printf "%s \33[31m%s\33[0m\n" "3)" "Reset WebGUI password"
		printf "%s \33[31m%s\33[0m\n" "4)" "Reset to factory defaults"
		printf "%s\n" "5) Ping host"
		printf "%s\n" "6) Shell"
		printf "%s \33[33m%s\33[0m\n" "7)" "Reboot system"
		printf "%s \33[33m%s\33[0m\n" "8)" "Shutdown system"
		if [ "$PLATFORM" = "i386-liveCD" ] || [ "$PLATFORM" = "amd64-liveCD" ]; then
		    printf "%s \33[36m%s\33[0m\n" "9)" "Install/Upgrade to hard drive/flash device, etc."
		fi

		echo
		read -p "Enter a number: " opmode

		# see what the user has chosen
		case ${opmode} in
			0)
				exit && exit && logout
				;;
			1)
				/etc/rc.initial.setports
			 	;;
			2)
				/etc/rc.initial.setlanip
			 	;;
			3)
				/etc/rc.initial.password
				;;
			4)
				/etc/rc.initial.defaults
				;;
			5)
				/etc/rc.initial.ping
				;;
			6)
				exit
				;;
			7)
				/etc/rc.initial.reboot
				;;
			8)
				/etc/rc.initial.halt
				;;
			9)
				/etc/rc.initial.install
				;;
		esac
	done
fi
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.