firmware: changes for kernel/base set visibility #1992

This commit is contained in:
Franco Fichtner 2017-12-16 18:26:01 +00:00
parent 086b91c04a
commit a5d91a7e9b
6 changed files with 66 additions and 13 deletions

1
plist
View File

@ -589,6 +589,7 @@
/usr/local/opnsense/scripts/firmware/reinstall.sh
/usr/local/opnsense/scripts/firmware/remove.sh
/usr/local/opnsense/scripts/firmware/running.sh
/usr/local/opnsense/scripts/firmware/sets.sh
/usr/local/opnsense/scripts/firmware/type.sh
/usr/local/opnsense/scripts/firmware/unlock.sh
/usr/local/opnsense/scripts/firmware/upgrade.sh

View File

@ -665,6 +665,9 @@ class FirmwareController extends ApiControllerBase
}
foreach ($keys as $key) {
$translated[$key] = $expanded[$index++];
if (empty($translated[$key])) {
$translated[$key] = gettext('N/A');
}
}
/* mark remote packages as "provided", local as "installed" */

View File

@ -28,14 +28,17 @@
PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
PACKAGE=${1}
if [ -z "${PACKAGE}" ]; then
opnsense-update -L
exit 0
fi
# Truncate upgrade progress file
: > ${PKG_PROGRESS_FILE}
echo "***GOT REQUEST TO LOCK: ${PACKAGE}***" >> ${PKG_PROGRESS_FILE}
pkg lock -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
if [ "${PACKAGE}" = "base" ]; then
echo "Locking base set" >> ${PKG_PROGRESS_FILE}
opnsense-update -bL >> ${PKG_PROGRESS_FILE} 2>&1
elif [ "${PACKAGE}" = "kernel" ]; then
echo "Locking kernel set" >> ${PKG_PROGRESS_FILE}
opnsense-update -kL >> ${PKG_PROGRESS_FILE} 2>&1
else
pkg lock -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
fi
echo '***DONE***' >> ${PKG_PROGRESS_FILE}

View File

@ -0,0 +1,42 @@
#!/bin/sh
# Copyright (C) 2017 Franco Fichtner <franco@opnsense.org>
# 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.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
# AUTHOR 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.
LIC="BSD2CLAUSE"
OS="FreeBSD"
SEP=${1:-","}
BV=$(opnsense-update -bv)
KV=$(opnsense-update -kv)
BL=0
KL=0
# XXX pragmatic approach, we don't have a portable command yet
[ -f /usr/local/opnsense/version/base.lock ] && BL=1
[ -f /usr/local/opnsense/version/kernel.lock ] && KL=1
echo "base${SEP}${BV%-*}${SEP}${OS} userland set${SEP}${SEP}${BL}${SEP}${LIC}"
echo "kernel${SEP}${KV%-*}${SEP}${OS} kernel set${SEP}${SEP}${KL}${SEP}${LIC}"

View File

@ -28,14 +28,17 @@
PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
PACKAGE=${1}
if [ -z "${PACKAGE}" ]; then
opnsense-update -U
exit 0
fi
# Truncate upgrade progress file
: > ${PKG_PROGRESS_FILE}
echo "***GOT REQUEST TO UNLOCK: ${PACKAGE}***" >> ${PKG_PROGRESS_FILE}
pkg unlock -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
if [ "${PACKAGE}" = "base" ]; then
echo "Unlocking base set" >> ${PKG_PROGRESS_FILE}
opnsense-update -bU >> ${PKG_PROGRESS_FILE} 2>&1
elif [ "${PACKAGE}" = "kernel" ]; then
echo "Unlocking kernel set" >> ${PKG_PROGRESS_FILE}
opnsense-update -kU >> ${PKG_PROGRESS_FILE} 2>&1
else
pkg unlock -y ${PACKAGE} >> ${PKG_PROGRESS_FILE} 2>&1
fi
echo '***DONE***' >> ${PKG_PROGRESS_FILE}

View File

@ -132,7 +132,8 @@ type:script_output
message:Querying %s package details
[local]
command:pkg query "%n|||%v|||%c|||%sh|||%k|||%L"
command: pkg query "%n|||%v|||%c|||%sh|||%k|||%L"; \
/usr/local/opnsense/scripts/firmware/sets.sh '|||'
parameters:
type:script_output
message:view local packages