1 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-nextcloud-1.2.0.old/createlinks smeserver-nextcloud-1.2.0/createlinks |
2 |
|
|
--- smeserver-nextcloud-1.2.0.old/createlinks 2022-07-07 21:44:09.038000000 -0400 |
3 |
|
|
+++ smeserver-nextcloud-1.2.0/createlinks 2022-07-07 21:45:43.035000000 -0400 |
4 |
|
|
@@ -47,6 +47,6 @@ |
5 |
|
|
httpd-e-smith sigusr1 |
6 |
|
|
php74-php-fpm reload-or-restart |
7 |
|
|
)); |
8 |
|
|
-event_link("nextcloud-conf", $event, "20"); |
9 |
|
|
-event_link("nextcloud-occ-conf", $event, "30"); |
10 |
|
|
+event_link("nextcloud-conf", $event, "91"); |
11 |
|
|
+event_link("nextcloud-occ-conf", $event, "92"); |
12 |
|
|
|
13 |
|
|
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 |
14 |
|
|
--- smeserver-nextcloud-1.2.0.old/root/etc/e-smith/events/actions/nextcloud-conf 2022-07-07 21:44:09.038000000 -0400 |
15 |
|
|
+++ smeserver-nextcloud-1.2.0/root/etc/e-smith/events/actions/nextcloud-conf 2022-07-07 23:08:20.777000000 -0400 |
16 |
|
|
@@ -8,17 +8,30 @@ |
17 |
|
|
TERM=dumb /usr/bin/occ $params |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
+ |
21 |
|
|
# important configuration variables |
22 |
|
|
password=`/sbin/e-smith/db configuration getprop nextcloud DbPassword || echo "missing"` |
23 |
|
|
dbname=`/sbin/e-smith/db configuration getprop nextcloud DbName || echo "nextcloud"` |
24 |
|
|
dbuser=`/sbin/e-smith/db configuration getprop nextcloud DbUser || echo "nextcloud"` |
25 |
|
|
adminuser=`/sbin/e-smith/db configuration getprop nextcloud AdminUser || echo "admin"` |
26 |
|
|
adminpass=`/sbin/e-smith/db configuration getprop nextcloud AdminPassword ||/sbin/e-smith/db configuration getprop sysconfig SystemID || echo "password;109"` |
27 |
|
|
+#occ config:system:get dbhost |
28 |
|
|
+host="localhost" |
29 |
|
|
+socket="--socket=/var/lib/mysql/mysql.sock" |
30 |
|
|
+# need to check what db we are supposed to use. starting NC 21 mariadb >= 102 is needed core is 55 |
31 |
|
|
+# are we fresh install or update ? |
32 |
|
|
+installed=$(/usr/bin/occ status --output json |jq -r '.installed') |
33 |
|
|
+# what version |
34 |
|
|
+majversion=$(/usr/bin/occ status --output json |jq -r '.version'|cut -d'.' -f1) |
35 |
|
|
+# is there a nextcloud db in core mariadb |
36 |
|
|
+if [ "$installed" != "true" ]; then host="localhost:/var/lib/mysql/mariadb105.sock"; socket="--socket=/var/lib/mysql/mariadb105.sock"; fi |
37 |
|
|
+if [ "$installed" == "true" ]; then host=$(occ config:system:get dbhost); socket="--socket=$(echo $host|awk -F'[:]' '{print $2}')" ; fi |
38 |
|
|
+if [ "$socket" == "--socket=" ]; then socket=""; fi |
39 |
|
|
|
40 |
|
|
# initialize grants mysql nextcloud database |
41 |
|
|
-/usr/bin/mysql --defaults-file=/root/.my.cnf -e "CREATE DATABASE IF NOT EXISTS $dbname;" |
42 |
|
|
-/usr/bin/mysql --defaults-file=/root/.my.cnf -e "grant all on $dbname.* to '$dbuser'@'localhost' identified by '$password';" |
43 |
|
|
-/usr/bin/mysql --defaults-file=/root/.my.cnf -e "FLUSH PRIVILEGES" |
44 |
|
|
+/usr/bin/mysql --defaults-file=/root/.my.cnf $socket -e "CREATE DATABASE IF NOT EXISTS $dbname;" |
45 |
|
|
+/usr/bin/mysql --defaults-file=/root/.my.cnf $socket -e "grant all on $dbname.* to '$dbuser'@'localhost' identified by '$password';" |
46 |
|
|
+/usr/bin/mysql --defaults-file=/root/.my.cnf $socket -e "FLUSH PRIVILEGES" |
47 |
|
|
|
48 |
|
|
# check if we are migrating from release 10 to 11 |
49 |
|
|
if [ -f /var/www/html/nextcloud/config/config.php ]; then |
50 |
|
|
@@ -26,10 +39,10 @@ |
51 |
|
|
rm -rf /var/www/html/nextcloud/ |
52 |
|
|
fi |
53 |
|
|
|
54 |
|
|
-res=`/usr/bin/mysql --defaults-file=/root/.my.cnf -e "select count(*) from information_schema.tables where table_type = 'BASE TABLE' and table_schema = '$dbname'" | tail -n1`; |
55 |
|
|
+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`; |
56 |
|
|
|
57 |
|
|
if [[ $res == '0' ]]; then |
58 |
|
|
- OCC "maintenance:install --database mysql --database-name $dbname --database-user $dbuser --database-pass $password --admin-user $adminuser --admin-pass $adminpass --data-dir /home/e-smith/files/nextcloud/data/" |
59 |
|
|
+ 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/" |
60 |
|
|
|
61 |
|
|
OCC "app:enable user_ldap" |
62 |
|
|
OCC "ldap:create-empty-config" # create config with empty id |