$OpenBSD: patch-daily_sh,v 1.19 2017/08/31 12:16:31 sthen Exp $

Index: daily.sh
--- daily.sh.orig
+++ daily.sh
@@ -26,10 +26,10 @@ COMPOSER="php ${LIBRENMS_DIR}/scripts/composer_wrapper
 
 # set log_file, using librenms $config['log_dir'], if set
 # otherwise we default to <LibreNMS Install Directory>/logs
-LOG_DIR=$(php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';")
+LOG_DIR=$(%PHP% -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';")
 
 # get the librenms user
-LIBRENMS_USER=$(php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['user']) ? \$config['user'] : 'root';")
+LIBRENMS_USER=$(%PHP% -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['user']) ? \$config['user'] : 'root';")
 LIBRENMS_USER_ID=$(id -u "$LIBRENMS_USER")
 
 
@@ -71,7 +71,7 @@ status_run() {
     else
         printf " \033[0;31mFAIL\033[0m\n";
         if [[ "${arg_option}" == "update" ]]; then
-            php "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}"
+            %PHP% "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}"
         fi
     fi
     return ${exit_code}
@@ -92,7 +92,7 @@ call_daily_php() {
     local args=( "$@" );
 
     for arg in "${args[@]}"; do
-        php "${LIBRENMS_DIR}/daily.php" -f "${arg}";
+        %PHP% "${LIBRENMS_DIR}/daily.php" -f "${arg}";
     done
 }
 
@@ -148,7 +148,7 @@ main () {
     fi
 
     if [[ -z "$arg" ]]; then
-        up=$(php daily.php -f update >&2; echo $?)
+        up=$(%PHP% daily.php -f update >&2; echo $?)
         if [[ "$up" == "0" ]]; then
             ${DAILY_SCRIPT} no-code-update
             set_notification update 1  # make sure there are no update notifications if update is disabled
@@ -206,12 +206,12 @@ main () {
             no-code-update)
                 # Updates of the code are disabled, just check for schema updates
                 # and clean up the db.
-                status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'
+                status_run 'Updating SQL-Schema' '%PHP% includes/sql-schema/update.php'
                 status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
             ;;
             post-pull)
                 # List all tasks to do after pull in the order of execution
-                status_run 'Updating SQL-Schema' 'php includes/sql-schema/update.php'
+                status_run 'Updating SQL-Schema' '%PHP% includes/sql-schema/update.php'
                 status_run 'Updating submodules' "$DAILY_SCRIPT submodules"
                 status_run 'Cleaning up DB' "$DAILY_SCRIPT cleanup"
                 status_run 'Fetching notifications' "$DAILY_SCRIPT notifications"
