mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
rc: opnsense-recover is now known as opnsense-shell #1966
Merge the purpose of these scripts now that we can execute other commands using the shell menu trampoline.
This commit is contained in:
parent
26ee607a31
commit
7d14f2d8ee
@ -24,7 +24,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 19, 2018
|
||||
.Dd May 27, 2018
|
||||
.Dt OPNSENSE-SHELL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -32,17 +32,32 @@
|
||||
.Nd OPNsense console menu
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl c Ar script
|
||||
.Op Ar command
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility offers the administrator easy access to core functionality
|
||||
of the system.
|
||||
Said functionality only works for the root user, but when arguments
|
||||
are given the program will pass them to a real shell directly to allow
|
||||
compatibility with the
|
||||
Said functionality only works for the root user, who is able to either
|
||||
run an interactive menu or directly pass a
|
||||
.Ar command .
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width ".Fl c" -offset indent
|
||||
.It Fl c
|
||||
Execute a shell
|
||||
.Ar script
|
||||
in
|
||||
.Xr csh 1 .
|
||||
This feature can be invoked by all users to allow compatibility with the
|
||||
.Xr rc 8
|
||||
system.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr csh 1 ,
|
||||
.Xr opnsense-installer 8 ,
|
||||
.Xr rc 8
|
||||
.Sh HISTORY
|
||||
|
||||
@ -9,7 +9,18 @@
|
||||
trap : 2
|
||||
trap : 3
|
||||
|
||||
CMD_DEFAULTS="/usr/local/opnsense/scripts/shell/defaults.php"
|
||||
CMD_FIRMWARE="/usr/local/opnsense/scripts/shell/firmware.sh"
|
||||
CMD_HALT="/usr/local/opnsense/scripts/shell/halt.php"
|
||||
CMD_PASSWORD="/usr/local/opnsense/scripts/shell/password.php"
|
||||
CMD_PFLOG="/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0"
|
||||
CMD_PFTOP="/usr/local/sbin/pftop"
|
||||
CMD_PING="/usr/local/opnsense/scripts/shell/ping.php"
|
||||
CMD_REBOOT="/usr/local/opnsense/scripts/shell/reboot.php"
|
||||
CMD_RELOAD="/usr/local/etc/rc.reload_all"
|
||||
CMD_RESTORE="/usr/local/opnsense/scripts/shell/restore.sh"
|
||||
CMD_SETADDR="/usr/local/opnsense/scripts/shell/setaddr.php"
|
||||
CMD_SETPORTS="/usr/local/opnsense/scripts/shell/setports.php"
|
||||
CMD_SHELL="/bin/csh"
|
||||
|
||||
# rc.d may call this while being root using `su -m user -c ...'
|
||||
@ -40,11 +51,53 @@ if [ "$(id -u)" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The invoke using "opnsense-shell cmd" will launch the
|
||||
# utility without presenting and looping the menu.
|
||||
case "${1}" in
|
||||
defaults)
|
||||
shift
|
||||
exec ${CMD_DEFAULTS} "${@}"
|
||||
;;
|
||||
update)
|
||||
shift
|
||||
exec ${CMD_UPDATE} "${@}"
|
||||
;;
|
||||
halt)
|
||||
shift
|
||||
exec ${CMD_HALT} "${@}"
|
||||
;;
|
||||
password)
|
||||
shift
|
||||
exec ${CMD_PASSWORD} "${@}"
|
||||
;;
|
||||
ping)
|
||||
shift
|
||||
exec ${CMD_PING} "${@}"
|
||||
;;
|
||||
pflog)
|
||||
shift
|
||||
exec ${CMD_PFLOG} "${@}"
|
||||
;;
|
||||
pftop)
|
||||
shift
|
||||
exec ${CMD_PFTOP} "${@}"
|
||||
;;
|
||||
reboot)
|
||||
shift
|
||||
exec ${CMD_REBOOT} "${@}"
|
||||
;;
|
||||
reload)
|
||||
shift
|
||||
exec ${CMD_RELOAD} "${@}"
|
||||
;;
|
||||
restore)
|
||||
shift
|
||||
exec ${CMD_RESTORE} "${@}"
|
||||
;;
|
||||
shell)
|
||||
shift
|
||||
exec ${CMD_SHELL} "${@}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# endless loop
|
||||
@ -63,7 +116,7 @@ echo " 1) Assign interfaces 8) Shell"
|
||||
echo " 2) Set interface IP address 9) pfTop"
|
||||
echo " 3) Reset the root password 10) Firewall log"
|
||||
echo " 4) Reset to factory defaults 11) Reload all services"
|
||||
echo " 5) Power off system 12) Upgrade from console"
|
||||
echo " 5) Power off system 12) Update from console"
|
||||
echo " 6) Reboot system 13) Restore a backup"
|
||||
echo
|
||||
read -p "Enter an option: " OPCODE
|
||||
@ -78,43 +131,43 @@ case ${OPCODE} in
|
||||
exit
|
||||
;;
|
||||
1)
|
||||
/usr/local/opnsense/scripts/shell/setports.php
|
||||
${CMD_SETPORTS}
|
||||
;;
|
||||
2)
|
||||
/usr/local/opnsense/scripts/shell/setaddr.php
|
||||
${CMD_SETADDR}
|
||||
;;
|
||||
3)
|
||||
${CMD_PASSWORD}
|
||||
;;
|
||||
4)
|
||||
/usr/local/opnsense/scripts/shell/defaults.php
|
||||
${CMD_DEFAULTS}
|
||||
;;
|
||||
5)
|
||||
/usr/local/opnsense/scripts/shell/halt.php
|
||||
${CMD_HALT}
|
||||
;;
|
||||
6)
|
||||
/usr/local/opnsense/scripts/shell/reboot.php
|
||||
${CMD_REBOOT}
|
||||
;;
|
||||
7)
|
||||
/usr/local/opnsense/scripts/shell/ping.php
|
||||
${CMD_PING}
|
||||
;;
|
||||
8)
|
||||
${CMD_SHELL}
|
||||
;;
|
||||
9)
|
||||
/usr/local/sbin/pftop
|
||||
${CMD_PFTOP}
|
||||
;;
|
||||
10)
|
||||
/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0
|
||||
${CMD_PFLOG}
|
||||
;;
|
||||
11)
|
||||
/usr/local/etc/rc.reload_all
|
||||
${CMD_RELOAD}
|
||||
;;
|
||||
12)
|
||||
/usr/local/opnsense/scripts/shell/firmware.sh
|
||||
${CMD_FIRMWARE}
|
||||
;;
|
||||
13)
|
||||
/usr/local/opnsense/scripts/shell/restore.sh
|
||||
${CMD_RESTORE}
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user