ready to rebase

This commit is contained in:
2025-11-03 13:58:07 -05:00
parent e7a2a53edf
commit d74b62652e
10 changed files with 97 additions and 49 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
*.log
*spec-20*
*.tar.gz
*.xz

View File

@@ -8,17 +8,17 @@ event_actions("nextcloud-update", qw(
event_templates("nextcloud-update", qw(
/etc/httpd/conf/httpd.conf
/etc/opt/remi/php74/php.d/20-opcache.ini
/etc/opt/remi/php81/php.d/20-opcache.ini
/etc/opt/remi/php83/php.d/20-opcache.ini
/etc/crontab
/etc/opt/remi/php74/php-fpm.d/www.conf
/etc/opt/remi/php81/php-fpm.d/www.conf
/etc/opt/remi/php83/php-fpm.d/www.conf
));
event_services("nextcloud-update", qw(
httpd-e-smith sigusr1
php74-php-fpm reload-or-restart
php81-php-fpm reload-or-restart
php83-php-fpm reload-or-restart
));
event_actions("nextcloud-save", qw(
@@ -41,17 +41,17 @@ foreach my $event (qw(bootstrap-console-save console-save webapps-update post-u
my $event="smeserver-nextcloud-update";
event_templates($event, qw(
/etc/httpd/conf/httpd.conf
/etc/opt/remi/php74/php.d/20-opcache.ini
/etc/opt/remi/php81/php.d/20-opcache.ini
/etc/opt/remi/php83/php.d/20-opcache.ini
/etc/crontab
/etc/opt/remi/php74/php-fpm.d/www.conf
/etc/opt/remi/php81/php-fpm.d/www.conf
/etc/opt/remi/php83/php-fpm.d/www.conf
));
event_services($event, qw(
httpd-e-smith sigusr1
php74-php-fpm reload-or-restart
php81-php-fpm reload-or-restart
php84-php-fpm reload-or-restart
));
# this is after service restart as it depends on installation of mariadb
# however if we increase initial version of nextcloud >25 then we need to

View File

@@ -12,17 +12,13 @@ dbuser=`/sbin/e-smith/db configuration getprop nextcloud DbUser || echo "nextclo
adminuser=`/sbin/e-smith/db configuration getprop nextcloud AdminUser || echo "admin"`
adminpass=`/sbin/e-smith/db configuration getprop nextcloud AdminPassword ||/sbin/e-smith/db configuration getprop sysconfig SystemID || echo "password;109"`
host="localhost:/var/lib/mysql/mariadb105.sock"
socket="--socket=/var/lib/mysql/mariadb105.sock"
host="localhost:/var/lib/mysql/mysql.sock"
socket="--socket=/var/lib/mysql/mysql.sock"
# need to check what db we are supposed to use. starting NC 21 mariadb >= 102 is needed core is 55
# are we fresh install or update ?
installed=$(/usr/bin/occ status --output json |jq -r '.installed')
# what version
majversion=$(/usr/bin/occ status --output json |jq -r '.version'|cut -d'.' -f1)
# is there a nextcloud db in core mariadb
if [ "$installed" != "true" ]; then host="localhost:/var/lib/mysql/mariadb105.sock"; socket="--socket=/var/lib/mysql/mariadb105.sock"; fi
if [ "$installed" == "true" ]; then host=$(occ config:system:get dbhost); socket="--socket=$(echo $host|awk -F'[:]' '{print $2}')" ; fi
if [ "$socket" == "--socket=" ]; then socket=""; fi
# initialize grants mysql nextcloud database
/usr/bin/mysql --defaults-file=/root/.my.cnf $socket -e "CREATE DATABASE IF NOT EXISTS $dbname;"
@@ -31,23 +27,50 @@ if [ "$socket" == "--socket=" ]; then socket=""; fi
res=`/usr/bin/mysql --defaults-file=/root/.my.cnf $socket -e "select count(*) from information_schema.tables where table_type = 'BASE TABLE' and table_schema = '$dbname'" | tail -n1`;
#TODO : SME11 we need to see if db nextcloud exist
# if not we must check if /home/e-smith/db/mariadb105/nexcloud.dump exists and import it
# if not we must check if /home/e-smith/db/mysql/nexcloud.dump exists and import it
## those might be skipped if the /usr/share/nextcloud had to be created
if [[ $res == '0' ]]; then
/usr/bin/occ maintenance:install --database mysql --database-host $host --database-name $dbname --database-user $dbuser --database-pass $password --admin-user $adminuser --admin-pass $adminpass --data-dir /home/e-smith/files/nextcloud/data/
/usr/bin/occ app:enable user_ldap
# might create s01 or empty id depending on version
/usr/bin/occ ldap:create-empty-config
# create config with id s01 if not already present
/usr/bin/occ ldap:show-config s01 1>/dev/null || /usr/bin/occ ldap:create-empty-config
# delete config with empty id if exist
/usr/bin/occ ldap:delete-config '' 1>/dev/null
mkdir -p /home/e-smith/files/nextcloud/skeleton/ibays
if [ -f /home/e-smith/db/mariadb105/nexcloud.dump ]; then
echo "Mariadb database empty and there was a backup in /home/e-smith/db/mariadb105/nexcloud.dump; restoring it ..."
/usr/bin/mysql --defaults-file=/root/.my.cnf $socket $dbname < /home/e-smith/db/mariadb105/nexcloud.dump && mv /home/e-smith/db/mariadb105/nexcloud.dump /home/e-smith/files/nextcloud/data/mariadb105-nexcloud.dump
/usr/bin/occ upgrade -n
elif [ -f /home/e-smith/db/myslq/nexcloud.dump ]; then
echo "Mariadb database empty and there was a backup in /home/e-smith/db/myslq/nexcloud.dump; restoring it ..."
/usr/bin/mysql --defaults-file=/root/.my.cnf $socket $dbname < /home/e-smith/db/mariadb105/nexcloud.dump
/usr/bin/occ upgrade -n
else
echo "Fresh install detected, starting occ maintenance:install procedure..."
/usr/bin/occ maintenance:install --database mysql --database-host $host --database-name $dbname --database-user $dbuser --database-pass $password --admin-user $adminuser --admin-pass $adminpass --data-dir /home/e-smith/files/nextcloud/data/
/usr/bin/occ app:enable user_ldap
# might create s01 or empty id depending on version
/usr/bin/occ ldap:create-empty-config
# create config with id s01 if not already present
/usr/bin/occ ldap:show-config s01 1>/dev/null || /usr/bin/occ ldap:create-empty-config
# delete config with empty id if exist
/usr/bin/occ ldap:delete-config '' 1>/dev/null
fi
else
echo "We are reinstalling Nextcloud with an already populated mariadb database"
if [ -f /home/e-smith/db/mariadb105/nexcloud.dump ]; then
echo "if you did a SME10 to SME11 migration: /home/e-smith/db/mariadb105/nexcloud.dump has been detected !!!"
echo " ! check that you did not also migrate an older nextcloud.dump from SME10 mariadb 5.5 !"
fi
echo "Trying to upgrade"
/usr/bin/occ upgrade -n
fi
mkdir -p /home/e-smith/files/nextcloud/skeleton/ibays
/usr/bin/occ config:system:set skeletondirectory --value="/home/e-smith/files/nextcloud/skeleton"
#/usr/bin/occ config:system:set templatedirectory --value=""
# prepare geoip2.phar and custom apps
mkdir -p /usr/share/nextcloud/custom_apps/geoblocker/3rdparty/maxmind_geolite2/
chown www:www -R /usr/share/nextcloud/custom_apps
curl -q https://api.github.com/repos/maxmind/GeoIP2-php/releases/latest | jq -r '.assets[] | select(.name | match("phar")) | .browser_download_url' | xargs wget -q -O /usr/share/nextcloud/custom_apps/geoblocker/3rdparty/maxmind_geolite2/geoip2.phar
# to satisfy code integrity check
if [ -f /usr/share/nextcloud/.htaccess.rpmsave ]; then
rm -f /usr/share/nextcloud/.htaccess.rpmsave

View File

@@ -1,13 +1,13 @@
# nextcloud cron
*/5 * * * * www {
$OUT="/usr/bin/php81";
$version="26";
$OUT="/usr/bin/php83";
$version="30";
$search=qr/\s*'version'\s*=>\s*'([0-9]{2})\.[0-9]{1,2}.*/;
if ( open NC, "</usr/share/nextcloud/config/config.php") {
map {$version = $1 if /$search/ } <NC>;
close NC;
}
$OUT="/usr/bin/php74" if $version <= 24;
$OUT="/usr/bin/php81" if $version < 30;
} --define apc.enable_cli=1 --define memory_limit={ $memory=$nextcloud{'memory_limit'}||'1024M';} -f /usr/share/nextcloud/cron.php > /dev/null 2>&1
# nextcloud db update

View File

@@ -46,14 +46,14 @@ if ((exists $php{status} and $php{status} eq "enabled") and $phpModule eq "enabl
_EOF
}
if ($fastcgi_mod eq 'mod_proxy_fcgi'){
my $phpversion="81";
my $version="26";
my $phpversion="83";
my $version="30";
my $search=qr/\s*'version'\s*=>\s*'([0-9]{2})\.[0-9]{1,2}.*/;
if ( open NC, "</usr/share/nextcloud/config/config.php") {
map {$version = $1 if /$search/ } <NC>;
close NC;
}
$phpversion="74" if $version <= 24;
$phpversion="81" if $version < 30;
$php =<<"_EOF";
<FilesMatch \\.php\$>

View File

@@ -0,0 +1,9 @@
opcache.enable=1
opcache.file_cache= /var/opt/remi/php81/lib/php/opcache
opcache.enable_cli= 1
opcache.interned_strings_buffer= {$nextcloud{'opcache.interned_strings_buffer'} || 64;}
opcache.max_accelerated_files= {$nextcloud{'opcache.max_accelerated_files'} || 65406;}
opcache.memory_consumption= {$nextcloud{'opcache.memory_consumption'} || 512;}
opcache.save_comments= 1
opcache.revalidate_freq= 1

View File

@@ -1,12 +1,12 @@
{
my $phpversion="81";
my $version="26";
my $phpversion="83";
my $version="30";
my $search=qr/\s*'version'\s*=>\s*'([0-9]{2})\.[0-9]{1,2}.*/;
if ( open NC, "</usr/share/nextcloud/config/config.php") {
map {$version = $1 if /$search/ } <NC>;
close NC;
}
$phpversion="74" if $version <= 24;
$phpversion="81" if $version < 30;
if ($PHP_VERSION eq $phpversion){
if (($nextcloud{'status'} || 'disabled') eq 'enabled'){
@@ -15,7 +15,7 @@ if ($PHP_VERSION eq $phpversion){
my $memory_limit = ($nextcloud{MemoryLimit} || '512M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $nextcloud{PHPBaseDir} || '';
$open_basedir = "/usr/share/nextcloud:/var/lib/nextcloud:/var/log/nextcloud.log:/var/lib/php/nextcloud:/home/e-smith/files/nextcloud:/dev/urandom:/proc/meminfo:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo:$open_basedir";
$open_basedir = "/usr/share/nextcloud:/var/lib/nextcloud:/var/log/nextcloud.log:/var/lib/php/nextcloud:/home/e-smith/files/nextcloud:/dev/urandom:/proc/meminfo:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo:/usr/bin/ffmpeg:$open_basedir";
my $id = 'nextcloud';
my $max_children = $nextcloud{'PHPmaxChildren'} || 20;
my $min_spare_servers = $nextcloud{'PHPminServers'} || 4;

View File

@@ -1,8 +1,8 @@
#!/bin/bash
majversion=$((/usr/bin/grep -Eo "'version'.*[0-9]{2}\." /usr/share/nextcloud/config/config.php 2>/dev/null || echo "26" )|/usr/bin/grep -Eo "[0-9]{2}"|head -1)
majversion=$((/usr/bin/grep -Eo "'version'.*[0-9]{2}\." /usr/share/nextcloud/config/config.php 2>/dev/null || echo "30" )|/usr/bin/grep -Eo "[0-9]{2}"|head -1)
memory=$(/sbin/e-smith/config getprop nextcloud memory_limit|| echo "1024M")
myphp=/usr/bin/php81
if [[ $majversion -le '24' ]]; then
myphp=/usr/bin/php74
myphp=/usr/bin/php83
if [[ $majversion -lt '30' ]]; then
myphp=/usr/bin/php81
fi
/usr/sbin/runuser -u www -- $myphp -d memory_limit=$memory -d apc.enable_cli=1 /usr/share/nextcloud/occ "$@"

View File

@@ -1,4 +1,4 @@
%define release 33
%define release 34
%define version 1.2.0
Summary: Koozali SME Server Nextcloud configuration
@@ -13,22 +13,17 @@ URL: https://www.nextcloud.com
BuildRequires: smeserver-devtools
Requires: nextcloud-src >= 26.0.1
Requires: nextcloud-src >= 29.0.1
Requires: smeserver-apache
Requires: smeserver-mysql
Requires: smeserver-webapps-common
Requires: smeserver-php >= 3.0.0-15
Requires: smeserver-php >= 11
Requires: samba-client
Requires: perl-JSON
Requires: perl-JSON-PP
Requires: perl-Exporter-Tiny
Requires: perl-Sub-Quote
Requires: php74-php-smbclient
Requires: php74-php-opcache
Requires: php74-php-pecl-apcu
Requires: php74-php-pecl-inotify
Requires: php74-php-pecl-zip
Requires: php74-php-pecl-imagick
Requires: php74-php-gmp
# supported for NC 29 to 31
Requires: php81-php-smbclient
Requires: php81-php-opcache
Requires: php81-php-pecl-apcu
@@ -37,11 +32,20 @@ Requires: php81-php-pecl-zip
Requires: php81-php-pecl-imagick
Requires: php81-php-gmp
Requires: php81-php-redis
# suported from NC 30 and up
Requires: php83-php-smbclient
Requires: php83-php-opcache
Requires: php83-php-pecl-apcu
Requires: php83-php-pecl-inotify
Requires: php83-php-pecl-zip
Requires: php83-php-pecl-imagick
Requires: php83-php-gmp
Requires: php83-php-redis
Requires: smeserver-redis
Requires: jq
Requires: smeserver-mariadb105
Requires: smeserver-apache >= 2.6.0-19
Requires: smeserver-php >= 3.0.0-43
Requires: smeserver-apache >= 11
Requires: smeserver-php >= 11
Requires: ffmpeg
%description
Koozali SME Server Nextcloud files and configuration.
@@ -79,6 +83,17 @@ cat %{name}-%{version}-filelist
%changelog
* Thu Sep 11 2025 Jean-Philippe Pialasse <jpp@koozali.org> 1.2.0-34.sme
- import to SME11
- set minimum version 29 (last suported in SME10)
- update requirements
- rewrite install script to handle migration/restore
- require JSON-PP [SME: 13137]
- ffmpeg [SME: 13104]
- TODO add notify_push [SME: 12994]
- TODO dedicated domain template [SME: 12993]
- TODO switch support for php83 [SME: 12406]
* Sun Sep 08 2024 fix-e-smith-pkg.sh by Trevor Batley <trevor@batley.id.au> 1.2.0-33.sme
- Fix e-smith references in smeserver-nextcloud [SME: 12732]