librenms tweaks:
- replace more hardcoded php binary names with ${MODPHP_BIN}, unbreaks some scripts as we include the PHP release branch in the string (php-5.6 etc). - drop php-mysql dependency, no longer required.
This commit is contained in:
parent
ea5e19fc98
commit
ecf046c6f9
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.53 2017/11/27 17:41:36 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.54 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
COMMENT = auto-discovering network management/monitoring system
|
||||
|
||||
@ -6,6 +6,7 @@ GH_ACCOUNT = librenms
|
||||
GH_PROJECT = librenms
|
||||
GH_TAGNAME = 1.34
|
||||
EPOCH = 0
|
||||
REVISION = 0
|
||||
|
||||
CATEGORIES = net www
|
||||
|
||||
@ -24,7 +25,6 @@ RUN_DEPENDS = databases/py-mysql \
|
||||
lang/php/${MODPHP_VERSION},-curl \
|
||||
lang/php/${MODPHP_VERSION},-gd \
|
||||
lang/php/${MODPHP_VERSION},-mcrypt \
|
||||
lang/php/${MODPHP_VERSION},-mysql \
|
||||
lang/php/${MODPHP_VERSION},-mysqli \
|
||||
lang/php/${MODPHP_VERSION},-snmp \
|
||||
net/fping \
|
||||
@ -46,7 +46,7 @@ SUBST_VARS = INSTDIR MODPHP_BIN
|
||||
|
||||
R = s,^\#!( )?(/usr/bin/env |/bin/)bash,\#!${LOCALBASE}/bin/bash,;
|
||||
R += s,^\#!( )?/usr/bin/(env )?python.*,\#!${MODPY_BIN},;
|
||||
R += s,^\#!( )?/usr/bin/(env )?php,\#!${MODPHP_BIN},;
|
||||
R += s,/usr/bin/(env )?php,${MODPHP_BIN},g;
|
||||
R += s,/opt/librenms,/var/www/librenms,g;
|
||||
R += s,/var/www/librenms,${TRUEPREFIX}/librenms,g;
|
||||
R += s,/usr/local,${LOCALBASE},g
|
||||
@ -60,7 +60,7 @@ do-install:
|
||||
find ${INSTDIR} -name '*.orig' -print0 | xargs -r0 rm
|
||||
mkdir -p ${INSTDIR}/{rrd,logs}
|
||||
cd ${INSTDIR}; \
|
||||
sed -i 's,%PHP%,${MODPHP_BIN},' daily.sh *-wrapper.py validate.php; \
|
||||
sed -i 's,%PHP%,${MODPHP_BIN},' daily.sh *-wrapper.py *-service.py validate.php LibreNMS/Validations/Php.php html/includes/output/capture.inc.php; \
|
||||
sed -i 's,%LNMS_VERSION%,${DISTNAME:S/librenms-//},' includes/common.php
|
||||
cp /usr/share/snmp/mibs/OPENBSD-* ${INSTDIR}/mibs/
|
||||
rm -r ${INSTDIR}/tests
|
||||
|
17
net/librenms/patches/patch-LibreNMS_FileLock_php
Normal file
17
net/librenms/patches/patch-LibreNMS_FileLock_php
Normal file
@ -0,0 +1,17 @@
|
||||
$OpenBSD: patch-LibreNMS_FileLock_php,v 1.1 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Use a directory which is reasonably expected to have write-access for the
|
||||
user running LibreNMS.
|
||||
|
||||
Index: LibreNMS/FileLock.php
|
||||
--- LibreNMS/FileLock.php.orig
|
||||
+++ LibreNMS/FileLock.php
|
||||
@@ -29,7 +29,7 @@ class FileLock
|
||||
global $config;
|
||||
|
||||
$this->name = $lock_name;
|
||||
- $this->file = "$config[install_dir]/.$lock_name.lock";
|
||||
+ $this->file = "$config[log_dir]/.$lock_name.lock";
|
||||
$this->handle = fopen($this->file, "w+");
|
||||
}
|
||||
|
23
net/librenms/patches/patch-LibreNMS_Validations_Php_php
Normal file
23
net/librenms/patches/patch-LibreNMS_Validations_Php_php
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-LibreNMS_Validations_Php_php,v 1.1 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Index: LibreNMS/Validations/Php.php
|
||||
--- LibreNMS/Validations/Php.php.orig
|
||||
+++ LibreNMS/Validations/Php.php
|
||||
@@ -84,7 +84,7 @@ class Php implements ValidationGroup
|
||||
foreach ($required_modules as $extension) {
|
||||
if (!extension_loaded($extension)) {
|
||||
$validator->fail("Missing PHP extension: $extension", "Please install $extension");
|
||||
- } elseif (shell_exec("php -r \"var_export(extension_loaded('$extension'));\"") == 'false') {
|
||||
+ } elseif (shell_exec("%PHP% -r \"var_export(extension_loaded('$extension'));\"") == 'false') {
|
||||
$validator->fail("Missing CLI PHP extension: $extension", "Please install $extension");
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class Php implements ValidationGroup
|
||||
$ini_tz = ini_get('date.timezone');
|
||||
$sh_tz = rtrim(shell_exec('date +%Z'));
|
||||
$php_tz = date('T');
|
||||
- $php_cli_tz = rtrim(shell_exec('php -r "echo date(\'T\');"'));
|
||||
+ $php_cli_tz = rtrim(shell_exec('%PHP% -r "echo date(\'T\');"'));
|
||||
|
||||
if (empty($ini_tz)) {
|
||||
// make sure timezone is set
|
@ -1,9 +1,14 @@
|
||||
$OpenBSD: patch-daily_sh,v 1.20 2017/11/02 12:49:42 sthen Exp $
|
||||
$OpenBSD: patch-daily_sh,v 1.21 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Index: daily.sh
|
||||
--- daily.sh.orig
|
||||
+++ daily.sh
|
||||
@@ -26,10 +26,10 @@ COMPOSER="php ${LIBRENMS_DIR}/scripts/composer_wrapper
|
||||
@@ -22,14 +22,14 @@
|
||||
# define DAILY_SCRIPT as the full path to this script and LIBRENMS_DIR as the directory this script is in
|
||||
DAILY_SCRIPT=$(readlink -f "$0")
|
||||
LIBRENMS_DIR=$(dirname "$DAILY_SCRIPT")
|
||||
-COMPOSER="php ${LIBRENMS_DIR}/scripts/composer_wrapper.php"
|
||||
+COMPOSER="%PHP% ${LIBRENMS_DIR}/scripts/composer_wrapper.php"
|
||||
|
||||
# set log_file, using librenms $config['log_dir'], if set
|
||||
# otherwise we default to <LibreNMS Install Directory>/logs
|
||||
@ -34,9 +39,21 @@ Index: daily.sh
|
||||
done
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ main () {
|
||||
@@ -116,7 +116,7 @@ set_notifiable_result() {
|
||||
local arg_type=$1;
|
||||
local arg_result=$2;
|
||||
|
||||
- php "${LIBRENMS_DIR}/daily.php" -f handle_notifiable -t ${arg_type} -r ${arg_result};
|
||||
+ %PHP% "${LIBRENMS_DIR}/daily.php" -f handle_notifiable -t ${arg_type} -r ${arg_result};
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -152,9 +152,9 @@ main () {
|
||||
fi
|
||||
|
||||
if [[ -z "$arg" ]]; then
|
||||
status_run 'Checking PHP version' "php ${LIBRENMS_DIR}/daily.php -f check_php_ver" 'check_php_ver'
|
||||
- status_run 'Checking PHP version' "php ${LIBRENMS_DIR}/daily.php -f check_php_ver" 'check_php_ver'
|
||||
+ status_run 'Checking PHP version' "%PHP% ${LIBRENMS_DIR}/daily.php -f check_php_ver" 'check_php_ver'
|
||||
|
||||
- up=$(php daily.php -f update >&2; echo $?)
|
||||
+ up=$(%PHP% daily.php -f update >&2; echo $?)
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-discovery-wrapper_py,v 1.1 2017/11/27 17:41:36 sthen Exp $
|
||||
$OpenBSD: patch-discovery-wrapper_py,v 1.2 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Index: discovery-wrapper.py
|
||||
--- discovery-wrapper.py.orig
|
||||
@ -12,12 +12,3 @@ Index: discovery-wrapper.py
|
||||
try:
|
||||
proc = subprocess.Popen(config_cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
except:
|
||||
@@ -305,7 +305,7 @@ def poll_worker():
|
||||
# EOC5
|
||||
try:
|
||||
start_time = time.time()
|
||||
- command = "/usr/bin/env php %s -h %s >> /dev/null 2>&1" % (discovery_path, device_id)
|
||||
+ command = "%PHP% %s -h %s >> /dev/null 2>&1" % (discovery_path, device_id)
|
||||
subprocess.check_call(command, shell=True)
|
||||
elapsed_time = int(time.time() - start_time)
|
||||
print_queue.put([threading.current_thread().name, device_id, elapsed_time])
|
||||
|
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-html_includes_output_capture_inc_php,v 1.1 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Index: html/includes/output/capture.inc.php
|
||||
--- html/includes/output/capture.inc.php.orig
|
||||
+++ html/includes/output/capture.inc.php
|
||||
@@ -33,7 +33,7 @@ $type = $_REQUEST['type'];
|
||||
|
||||
switch ($type) {
|
||||
case 'poller':
|
||||
- $cmd = "php ${config['install_dir']}/poller.php -h $hostname -r -f -d";
|
||||
+ $cmd = "%PHP% ${config['install_dir']}/poller.php -h $hostname -r -f -d";
|
||||
$filename = "poller-$hostname.txt";
|
||||
break;
|
||||
case 'snmpwalk':
|
||||
@@ -48,7 +48,7 @@ switch ($type) {
|
||||
$filename = $device['os'] . '-' . $device['hostname'] . '.snmpwalk';
|
||||
break;
|
||||
case 'discovery':
|
||||
- $cmd = "php ${config['install_dir']}/discovery.php -h $hostname -d";
|
||||
+ $cmd = "%PHP% ${config['install_dir']}/discovery.php -h $hostname -d";
|
||||
$filename = "discovery-$hostname.txt";
|
||||
break;
|
||||
default:
|
@ -1,9 +1,11 @@
|
||||
$OpenBSD: patch-includes_defaults_inc_php,v 1.28 2017/11/27 17:41:36 sthen Exp $
|
||||
$OpenBSD: patch-includes_defaults_inc_php,v 1.29 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
N.B. snmpgetnext was not in upstream file at time of adding here
|
||||
|
||||
Index: includes/defaults.inc.php
|
||||
--- includes/defaults.inc.php.orig
|
||||
+++ includes/defaults.inc.php
|
||||
@@ -42,25 +42,25 @@ $config['db_socket'] = null;
|
||||
@@ -42,25 +42,26 @@ $config['db_socket'] = null;
|
||||
$config['own_hostname'] = 'localhost';
|
||||
|
||||
// Location of executables
|
||||
@ -21,6 +23,7 @@ Index: includes/defaults.inc.php
|
||||
-$config['snmptranslate'] = '/usr/bin/snmptranslate';
|
||||
+$config['snmpwalk'] = '/usr/local/bin/snmpwalk';
|
||||
+$config['snmpget'] = '/usr/local/bin/snmpget';
|
||||
+$config['snmpgetnext'] = '/usr/local/bin/snmpgetnext';
|
||||
+$config['snmpbulkwalk'] = '/usr/local/bin/snmpbulkwalk';
|
||||
+$config['snmptranslate'] = '/usr/local/bin/snmptranslate';
|
||||
$config['whois'] = '/usr/bin/whois';
|
||||
@ -43,7 +46,7 @@ Index: includes/defaults.inc.php
|
||||
|
||||
// Memcached - Keep immediate statistics
|
||||
$config['memcached']['enable'] = false;
|
||||
@@ -501,11 +501,11 @@ $config['billing']['bill_autoadd'] = 0;
|
||||
@@ -501,11 +502,11 @@ $config['billing']['bill_autoadd'] = 0;
|
||||
$config['billing']['base'] = 1000;
|
||||
// Set the base to divider bytes to kB, MB, GB ,... (1000|1024)
|
||||
// External Integration
|
||||
@ -58,7 +61,7 @@ Index: includes/defaults.inc.php
|
||||
$config['smokeping']['pings'] = 20;
|
||||
// $config['oxidized']['enabled'] = FALSE;//Set to TRUE
|
||||
// $config['oxidized']['url'] = 'http://127.0.0.1:8888';// Set the Oxidized rest URL
|
||||
@@ -513,7 +513,7 @@ $config['smokeping']['pings'] = 20;
|
||||
@@ -513,7 +514,7 @@ $config['smokeping']['pings'] = 20;
|
||||
// NFSen RRD dir.
|
||||
$config['nfsen_enable'] = 0;
|
||||
// $config['nfsen_split_char'] = "_";
|
||||
@ -67,7 +70,7 @@ Index: includes/defaults.inc.php
|
||||
// $config['nfsen_suffix'] = "_yourdomain_com";
|
||||
// Location Mapping
|
||||
// Use this feature to map ugly locations to pretty locations
|
||||
@@ -852,7 +852,7 @@ $config['api_demo'] = 0;
|
||||
@@ -852,7 +853,7 @@ $config['api_demo'] = 0;
|
||||
// Set this to 1 if you want to disable some untrusting features for the API
|
||||
// Distributed Poller-Settings
|
||||
$config['distributed_poller'] = false;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-poller-wrapper_py,v 1.12 2017/11/27 17:41:36 sthen Exp $
|
||||
$OpenBSD: patch-poller-wrapper_py,v 1.13 2017/12/13 15:30:43 sthen Exp $
|
||||
|
||||
Index: poller-wrapper.py
|
||||
--- poller-wrapper.py.orig
|
||||
@ -21,12 +21,3 @@ Index: poller-wrapper.py
|
||||
db_username = config['db_user']
|
||||
db_password = config['db_pass']
|
||||
db_port = int(config['db_port'])
|
||||
@@ -310,7 +310,7 @@ def poll_worker():
|
||||
# EOC5
|
||||
try:
|
||||
start_time = time.time()
|
||||
- command = "/usr/bin/env php %s -h %s >> /dev/null 2>&1" % (poller_path, device_id)
|
||||
+ command = "%PHP% %s -h %s >> /dev/null 2>&1" % (poller_path, device_id)
|
||||
subprocess.check_call(command, shell=True)
|
||||
elapsed_time = int(time.time() - start_time)
|
||||
print_queue.put([threading.current_thread().name, device_id, elapsed_time])
|
||||
|
Loading…
x
Reference in New Issue
Block a user