mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
firmware: allow os-squid install during major upgrade; closes #7030
This commit is contained in:
parent
713809efeb
commit
2cfe2fdc1c
1
plist
1
plist
@ -149,6 +149,7 @@
|
||||
/usr/local/etc/rc.syshook.d/stop/90-backup
|
||||
/usr/local/etc/rc.syshook.d/stop/99-config
|
||||
/usr/local/etc/rc.syshook.d/update/10-refresh
|
||||
/usr/local/etc/rc.syshook.d/upgrade/20-squid-plugin.php
|
||||
/usr/local/etc/rc.syshook.d/upgrade/20-unbound-duckdb.py
|
||||
/usr/local/etc/ssl/opnsense.cnf
|
||||
/usr/local/etc/strongswan.opnsense.d/README
|
||||
|
||||
41
src/etc/rc.syshook.d/upgrade/20-squid-plugin.php
Executable file
41
src/etc/rc.syshook.d/upgrade/20-squid-plugin.php
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 Deciso B.V.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
require_once 'config.inc';
|
||||
require_once 'util.inc';
|
||||
|
||||
if (
|
||||
isset($config['OPNsense']['proxy']['general']['enabled']) &&
|
||||
$config['OPNsense']['proxy']['general']['enabled'] == 1
|
||||
) {
|
||||
echo 'Squid web proxy is active. Installing replacement plugin...' . PHP_EOL;
|
||||
passthru('/usr/local/opnsense/scripts/firmware/launcher.sh -u install os-squid');
|
||||
} else {
|
||||
echo 'Squid web proxy is not active. Not installing replacement plugin.' . PHP_EOL;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015-2021 Franco Fichtner <franco@opnsense.org>
|
||||
# Copyright (C) 2015-2024 Franco Fichtner <franco@opnsense.org>
|
||||
# Copyright (C) 2014 Deciso B.V.
|
||||
# All rights reserved.
|
||||
#
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
LOCKFILE=/tmp/pkg_upgrade.progress
|
||||
PACKAGE=${1}
|
||||
TEE="/usr/bin/tee -a"
|
||||
|
||||
: > ${LOCKFILE}
|
||||
|
||||
@ -40,14 +41,14 @@ if [ "${PACKAGE#os-}" != "${PACKAGE}" ]; then
|
||||
|
||||
# plugins must pass a version check on up-to-date core package
|
||||
if [ "$(pkg version -t ${COREVER} ${REPOVER})" = "<" ]; then
|
||||
echo "Installation out of date. The update to ${COREPKG}-${REPOVER} is required." >> ${LOCKFILE} 2>&1
|
||||
echo "Installation out of date. The update to ${COREPKG}-${REPOVER} is required." | ${TEE} ${LOCKFILE}
|
||||
echo '***DONE***' >> ${LOCKFILE}
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
pkg install -y ${PACKAGE} >> ${LOCKFILE} 2>&1
|
||||
/usr/local/opnsense/scripts/firmware/register.php install ${PACKAGE} >> ${LOCKFILE} 2>&1
|
||||
pkg autoremove -y >> ${LOCKFILE} 2>&1
|
||||
(pkg install -y ${PACKAGE} 2>&1) | ${TEE} ${LOCKFILE}
|
||||
(/usr/local/opnsense/scripts/firmware/register.php install ${PACKAGE} 2>&1) | ${TEE} ${LOCKFILE}
|
||||
(pkg autoremove -y 2>&1) | ${TEE} ${LOCKFILE}
|
||||
|
||||
echo '***DONE***' >> ${LOCKFILE}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user