/[smecontribs]/rpms/smeserver-nextcloud/contribs10/smeserver-nextcloud-1.2.0-eventsactionsfixes.patch
ViewVC logotype

Annotation of /rpms/smeserver-nextcloud/contribs10/smeserver-nextcloud-1.2.0-eventsactionsfixes.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Jan 10 05:58:49 2023 UTC (21 months, 3 weeks ago) by jpp
Branch: MAIN
CVS Tags: smeserver-nextcloud-1_2_0-29_el7_sme, smeserver-nextcloud-1_2_0-22_el7_sme, smeserver-nextcloud-1_2_0-26_el7_sme, smeserver-nextcloud-1_2_0-27_el7_sme, smeserver-nextcloud-1_2_0-31_el7_sme, smeserver-nextcloud-1_2_0-24_el7_sme, smeserver-nextcloud-1_2_0-30_el7_sme, smeserver-nextcloud-1_2_0-25_el7_sme, smeserver-nextcloud-1_2_0-23_el7_sme, smeserver-nextcloud-1_2_0-21_el7_sme, smeserver-nextcloud-1_2_0-28_el7_sme, HEAD
* Mon Jan 09 2023 Jean-Philippe Pialasse <tests@pialasse.com> 1.2.0-21.sme
- update disabled_fucntions list [SME: 12277]
- allow customization of opcache for Nextcloud see wiki [SME: 12299]
- actions scripts update

1 jpp 1.1 diff -Nur --no-dereference smeserver-nextcloud-1.2.0.old/root/etc/e-smith/events/actions/nextcloud-conf smeserver-nextcloud-1.2.0/root/etc/e-smith/events/actions/nextcloud-conf
2     --- smeserver-nextcloud-1.2.0.old/root/etc/e-smith/events/actions/nextcloud-conf 2023-01-10 00:53:25.041000000 -0500
3     +++ smeserver-nextcloud-1.2.0/root/etc/e-smith/events/actions/nextcloud-conf 2023-01-10 00:54:25.821000000 -0500
4     @@ -1,13 +1,5 @@
5     #!/bin/bash
6    
7     -function OCC
8     -{
9     - params=$@;
10     - source /opt/remi/php74/enable
11     - cd /usr/share/nextcloud/
12     - TERM=dumb /usr/bin/occ $params
13     -}
14     -
15     # does /usr/share/nextcloud exists ? no: we create it from sources
16     if [ ! -d /usr/share/nextcloud ]; then
17     cp -a /usr/share/nextcloud-src /usr/share/nextcloud
18     @@ -46,12 +38,12 @@
19     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`;
20    
21     if [[ $res == '0' ]]; then
22     - 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/"
23     + /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/
24    
25     - OCC "app:enable user_ldap"
26     - OCC "ldap:create-empty-config" # create config with empty id
27     - OCC "ldap:create-empty-config" # create config with id s01
28     - OCC "ldap:delete-config ''" # delte config with empty id
29     + /usr/bin/occ app:enable user_ldap
30     + /usr/bin/occ ldap:create-empty-config # create config with empty id
31     + /usr/bin/occ ldap:create-empty-config # create config with id s01
32     + /usr/bin/occ ldap:delete-config '' # delete config with empty id
33     mkdir -p /home/e-smith/files/nextcloud/skeleton/ibays
34     /usr/bin/occ config:system:set skeletondirectory --value="/home/e-smith/files/nextcloud/skeleton"
35     #/usr/bin/occ config:system:set templatedirectory --value=""
36     @@ -65,10 +57,9 @@
37     if [ -f /usr/share/nextcloud/.htaccess.rpmnew ]; then
38     rm -f /usr/share/nextcloud/.htaccess.rpmnew
39     fi
40     - OCC "maintenance:mode --on"
41     - OCC "upgrade"
42     - OCC "maintenance:mode --off"
43     - OCC "integrity:check-core"
44     + /usr/bin/occ upgrade
45     + /usr/bin/occ maintenance:mode --off
46     + /usr/bin/occ integrity:check-core
47     # Catch 'Nextcloud is already latest version' message
48     if [ $? -eq 3 ]; then
49     exit 0
50     diff -Nur --no-dereference smeserver-nextcloud-1.2.0.old/root/etc/e-smith/events/actions/nextcloud-occ-conf smeserver-nextcloud-1.2.0/root/etc/e-smith/events/actions/nextcloud-occ-conf
51     --- smeserver-nextcloud-1.2.0.old/root/etc/e-smith/events/actions/nextcloud-occ-conf 2023-01-10 00:53:25.049000000 -0500
52     +++ smeserver-nextcloud-1.2.0/root/etc/e-smith/events/actions/nextcloud-occ-conf 2023-01-10 00:54:16.121000000 -0500
53     @@ -10,7 +10,7 @@
54     sub OCC
55     {
56     my $params = join(" ", @_);
57     - system("TERM=dumb /usr/bin/occ $params");
58     + system("TERM=dumb /usr/bin/occ $params 2>/dev/null");
59     }
60    
61     sub OCCr
62     @@ -55,6 +55,20 @@
63     return %NCusers;
64     }
65    
66     +sub listGroups
67     +{
68     + my %NCgroups;
69     + my $json = JSON->new->allow_nonref->convert_blessed->escape_slash;
70     + my $result = $json->decode(OCCr " group:list -i --output json");
71     + for my $key (keys %$result){
72     + my $type = $result->{$key}{'backends'}[0];
73     + next unless $type eq "LDAP";
74     + my $subresult = $json->decode(OCCr " group:info $key --output json");
75     + my $name = $subresult->{'displayName'};# not editable for this backend!
76     + $NCgroups{$name}=$key;
77     + }
78     + return %NCgroups;
79     +}
80    
81     my $cdb = esmith::ConfigDB->open_ro();
82     my $adb = esmith::AccountsDB->open_ro();
83     @@ -76,7 +90,8 @@
84     my $smb = $cdb->get('smb');
85     $status = $smb->prop('status') || 'disabled';
86     $status = $nextcloud->prop('UseSMB') || $status;
87     -my %NCusers= listUsers;
88     +my %NCusers;
89     +my %NCgroups;
90     my $storage = ( $status eq "enabled" ) ? 'smb' : 'local' ;
91     my $domain = $cdb->get_value('DomainName');
92     my $host = $cdb->get_value('SystemName');
93     @@ -158,13 +173,14 @@
94     # test new config to make it available, and sync user/groups
95     OCC "ldap:test-config s01";
96     %NCusers= listUsers;
97     - my $totrash = OCCr "group:list";
98     + %NCgroups= listGroups;
99     + #my $totrash = OCCr "group:list";
100    
101     # set ibays shares
102     foreach ( @ibays) {
103     my $group = $_->prop('Group') ||'';
104     my $key = $_->key;
105     - print "Configuring file repo : $key\n";
106     + #print "Configuring file repo : $key\n";
107     my $id = "";
108     my $typ = $_->prop('type');
109     my @wgroups = split(',', $_->prop('WriteGroups')||'');
110     @@ -183,11 +199,12 @@
111     next if (grep(/^$key$/i, @excI) );
112    
113     # get existing mount
114     - %localmounts = listLocalMounts;
115     + %localmounts = listLocalMounts;
116     # search for our current one
117     - my @matching_keys = grep { $localmounts{$_}{'mount_point'} =~ m/^ibays\/$key$/ && $localmounts{$_}{'storage'} eq $storage } keys %localmounts;
118     + my @matching_keys = grep { $localmounts{$_}{'mount_point'} =~ m/ibays\/$key$/ && $localmounts{$_}{'storage'} eq $storage } keys %localmounts;
119    
120     if (scalar(@matching_keys) == 0) {
121     + print "Configuring file repo : $key\n";
122     #if none create
123     if ($storage eq "smb") {
124     $id = OCCr "files_external:create -c share=$key -c host=localhost -c domain=$workgroup -c root='' -c show_hidden=false -c check_acl=false -c timeout='' 'ibays/$key' smb password::logincredentials --output json";
125     @@ -195,6 +212,7 @@
126     $id = OCCr "files_external:create -c datadir=/home/e-smith/files/$typ/$key 'ibays/$key' local null::null --output json";
127     }
128     for $group (@groups) {
129     + $group = $NCgroups{$group} || next;
130     print " adding group $group to file repo $id\n";
131     OCC "files_external:applicable --add-group $group $id --output json";
132     }
133     @@ -225,6 +243,7 @@
134     print "updating $key\n";
135     OCC "files_external:applicable --remove-all $id --output json";
136     for $group (@groups) {
137     + $group = $NCgroups{$group} || next;
138     OCC "files_external:applicable --add-group $group $id --output json" ;
139     }
140     for my $u (@uUsers) {
141     @@ -244,7 +263,7 @@
142     if( $localmounts{$key}{'mount_point'} =~ m/ibays\/.*$/ && ! exists($params{$key})) {
143     my $mount= $localmounts{$key}{'mount_point'};
144     print "delete $key : $mount\n";
145     - OCC "files_external:delete $key -y";
146     + OCC "files_external:delete -y $key ";
147     }
148     }
149    
150     @@ -294,7 +313,7 @@
151     print " more than one $key, deleting the latest, keeping first\n";
152     while (scalar(@matching_keys) > 1){
153     my $bad = pop @matching_keys;
154     - OCC "files_external:delete $bad -y";
155     + OCC "files_external:delete -y $bad ";
156     }
157     }
158     $id = pop @matching_keys;

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed