summaryrefslogtreecommitdiffstats
path: root/src/usr/local/sbin
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-10-08 11:38:25 -0400
committerStephen Beaver <sbeaver@netgate.com>2015-10-08 11:38:25 -0400
commit55e73a5650d685982bd8adbd88ac13d672e1c323 (patch)
tree1a318876aa1b9c6cc4bee68076a1a742b0baf6d9 /src/usr/local/sbin
parent8b53fe2f51ba2609c65409abb8367d572a3a6131 (diff)
downloadpfsense-55e73a5650d685982bd8adbd88ac13d672e1c323.zip
pfsense-55e73a5650d685982bd8adbd88ac13d672e1c323.tar.gz
Preparation for $5279
New wrapper script to be called by web GUI
Diffstat (limited to 'src/usr/local/sbin')
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade6
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade-GUI.sh86
2 files changed, 91 insertions, 1 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 3e65961..2aaf563 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -51,6 +51,7 @@ usage() {
echo " -b - Platform is booting" >&2
echo " -d - Turn on debug" >&2
echo " -h - Show this usage help" >&2
+ echo " -l - Logfile name in /cf/conf/ (defaults to upgrade_log.txt)" >&2
echo " -p FIFO - Write pkg progress to FIFO"
echo " -y - Consider yes as the answer for any possible interaction" >&2
echo "" >&2
@@ -546,7 +547,7 @@ unset yes
unset progress_fifo
unset action
unset action_pkg
-while getopts b:di:hp:r:uy opt; do
+while getopts b:di:hp:l:r:uy opt; do
case ${opt} in
b)
booting=1
@@ -567,6 +568,9 @@ while getopts b:di:hp:r:uy opt; do
usage
_exit 0
;;
+ l)
+ logfile="/cf/conf/${OPTARG}"
+ ;;
p)
progress_fifo="${OPTARG}"
;;
diff --git a/src/usr/local/sbin/pfSense-upgrade-GUI.sh b/src/usr/local/sbin/pfSense-upgrade-GUI.sh
new file mode 100755
index 0000000..f008d23
--- /dev/null
+++ b/src/usr/local/sbin/pfSense-upgrade-GUI.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+
+# Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgment:
+# "This product includes software developed by the pfSense Project
+# for use in the pfSense® software distribution. (http://www.pfsense.org/).
+#
+# 4. The names "pfSense" and "pfSense Project" must not be used to
+# endorse or promote products derived from this software without
+# prior written permission. For written permission, please contact
+# coreteam@pfsense.org.
+#
+# 5. Products derived from this software may not be called "pfSense"
+# nor may "pfSense" appear in their names without prior written
+# permission of the Electric Sheep Fencing, LLC.
+#
+# 6. Redistributions of any form whatsoever must retain the following
+# acknowledgment:
+#
+# "This product includes software developed by the pfSense Project
+# for use in the pfSense software distribution (http://www.pfsense.org/).
+#
+# THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Script is a simple wrapper around pfSense-upgrade. It is called from pkg_install.php to perform an
+# installation or remval.
+# FIFO is set up, log files named
+if [ $# -lt 2 ] ; then
+ echo "Usage: inst.sh [-i || -r] PACKAGE"
+ echo "e.g.: inst.sh -i pfSense-pkg-sudo"
+fi
+
+if [ "$1" == "-i" ] ; then
+ echo "Installing $2"
+elif [ "$1" == "-r" ] ; then
+ echo "Removing $2"
+else
+ echo "Error: Unsupported option $1"
+ exit
+fi
+
+PKG="$2"
+ACTION="$2"
+LOGFILE="webgui-log.txt"
+FIFO=/tmp/upgr.fifo
+JSONFILE="/cf/conf/webgui-log.json"
+
+if [ -a $FIFO ] ; then
+ rm $FIFO 2>/dev/null
+fi
+
+mkfifo $FIFO
+
+# Capture the JSON progress status and send it to the file we are watching
+tail -f $FIFO >$JSONFILE &
+TAILPID=$!
+
+/usr/local/sbin/pfSense-upgrade -l $LOGFILE -p $FIFO $ACTION $PKG >/dev/null
+
+kill $TAILPID
+rm $FIFO 2>/dev/null \ No newline at end of file
OpenPOWER on IntegriCloud