rc.initial 1.7 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1 2
#!/bin/sh

3
# Copyright (c) 2014-2016 Franco Fichtner <franco@opnsense.org>
4 5
# Copyright (c) 2004-2011 Scott Ullrich <sullrich@gmail.com>
# Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>
Ad Schellevis's avatar
Ad Schellevis committed
6 7
# All rights reserved.

8 9 10
# make sure the user can't kill us
trap : 2
trap : 3
Ad Schellevis's avatar
Ad Schellevis committed
11

12 13 14 15 16
# shell started with parameters, passthrough to real shell
if [ -n "${*}" ]; then
	/bin/csh "${@}"
	exit ${?}
fi
17

Ad Schellevis's avatar
Ad Schellevis committed
18 19 20
# endless loop
while : ; do

21 22
echo

23 24 25 26 27
echo " 0) Logout                             7) Ping host"
echo " 1) Assign Interfaces                  8) Shell"
echo " 2) Set interface(s) IP address        9) pfTop"
echo " 3) Reset the root password           10) Filter Logs"
echo " 4) Reset to factory defaults         11) Restart web interface"
28
echo " 5) Power off system                  12) Upgrade from console"
29
echo " 6) Reboot system                     13) Restore a configuration"
Ad Schellevis's avatar
Ad Schellevis committed
30 31

echo
32
read -p "Enter an option: " OPCODE
Ad Schellevis's avatar
Ad Schellevis committed
33 34 35
echo

# see what the user has chosen
36 37
case ${OPCODE} in
0|exit|logout|quit)
38
        exit
Ad Schellevis's avatar
Ad Schellevis committed
39 40
        ;;
1)
41
        /usr/local/etc/rc.initial.setports
Ad Schellevis's avatar
Ad Schellevis committed
42 43
        ;;
2)
44
        /usr/local/etc/rc.initial.setlanip
Ad Schellevis's avatar
Ad Schellevis committed
45 46
        ;;
3)
47
        /usr/local/etc/rc.initial.password
Ad Schellevis's avatar
Ad Schellevis committed
48 49
        ;;
4)
50
        /usr/local/etc/rc.initial.defaults
Ad Schellevis's avatar
Ad Schellevis committed
51 52
        ;;
5)
53
        /usr/local/etc/rc.initial.halt
Ad Schellevis's avatar
Ad Schellevis committed
54 55
        ;;
6)
56
        /usr/local/etc/rc.initial.reboot
Ad Schellevis's avatar
Ad Schellevis committed
57 58
        ;;
7)
59
        /usr/local/etc/rc.initial.ping
Ad Schellevis's avatar
Ad Schellevis committed
60 61
        ;;
8)
62
        /bin/csh
Ad Schellevis's avatar
Ad Schellevis committed
63 64 65 66 67
        ;;
9)
        /usr/local/sbin/pftop
        ;;
10)
68 69 70
	/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0
	;;
11)
71
	/usr/local/etc/rc.restart_webgui
72
	;;
Ad Schellevis's avatar
Ad Schellevis committed
73
12)
74
	/usr/local/etc/rc.initial.firmware
75
	;;
76
13)
Franco Fichtner's avatar
Franco Fichtner committed
77
	/usr/local/etc/rc.restore_config_backup
78 79
	;;
*)
80
	/bin/sh -c "${OPCODE}"
81
	;;
Ad Schellevis's avatar
Ad Schellevis committed
82 83
esac

84 85 86
/usr/local/etc/rc.initial.banner

done