https://bugs.koozali.org/show_bug.cgi?id=12298

--- Comment #8 from Jean-Philippe Pialasse <te...@pialasse.com> ---
(In reply to Jean-Philippe Pialasse from comment #1)
> majversion=$(/usr/bin/occ status --output json |jq -r '.version'|cut -d'.'
> -f1)

this will get recursive in /usr/bin/occ

one dirty way could be 

grep "'version'" /usr/share/nextcloud/config/config.php |sed
"s/[[:alpha:]|(|=>|'|\n|,|[:space:]]//g" | awk -F- '{print $1}'|cut -d'.' -f1

alternatively we could test for error on try to run php81

# /usr/sbin/runuser -u www -- /usr/bin/php74 -d memory_limit=1024M -d
apc.enable_cli=1 /usr/share/nextcloud/occ status --output json
{"installed":true,"version":"25.0.8.2","versionstring":"25.0.8","edition":"","maintenance":false,"needsDbUpgrade":false,"productname":"Nextcloud","extendedSupport":false}
# echo $?
0

# /usr/sbin/runuser -u www -- /usr/bin/php80 -d memory_limit=1024M -d
apc.enable_cli=1 /usr/share/nextcloud/occ status --output json
An unhandled exception has been thrown:
OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local
cache (Is the matching PHP module installed and enabled?)
# echo $?
1

in this case the error is due to APC opcache not set



maybe this alternative

grep -Eo "'version'.*[0-9]{2}\." /usr/share/nextcloud/config/config.php |grep
-Eo "[0-9]{2}"






#!/bin/bash
#majversion=$(/usr/bin/occ status --output json |jq -r '.version'|cut -d'.'
-f1)
majversion=$(/usr/bin/grep -Eo "'version'.*[0-9]{2}\."
/usr/share/nextcloud/config/config.php |/usr/bin/grep -Eo "[0-9]{2}")
myphp=/usr/bin/php74
if [[ $majversion -ge '25' ]]; then
  myphp=/usr/bin/php81
fi
/usr/sbin/runuser -u www -- $myphp -d memory_limit=1024M -d apc.enable_cli=1
/usr/share/nextcloud/occ "$@"


ned an easy way also for perl templates

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail contribteam-unsubscr...@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to