diff options
-rw-r--r-- | etc/nextcloudpi-config.d/nc-init.sh | 15 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-nextcloud.sh | 10 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-restore.sh | 10 |
3 files changed, 18 insertions, 17 deletions
diff --git a/etc/nextcloudpi-config.d/nc-init.sh b/etc/nextcloudpi-config.d/nc-init.sh index a1d387a4..b0107e0a 100644 --- a/etc/nextcloudpi-config.d/nc-init.sh +++ b/etc/nextcloudpi-config.d/nc-init.sh @@ -16,7 +16,8 @@ # ADMINUSER_=admin -DBADMIN_=ncadmin +ADMINPASS_=ownyourbits +DBADMIN=ncadmin DESCRIPTION="(Re)initiate Nextcloud to a clean configuration" show_info() @@ -53,10 +54,10 @@ DROP DATABASE IF EXISTS nextcloud; CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -GRANT USAGE ON *.* TO '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -DROP USER '$DBADMIN_'@'localhost'; -CREATE USER '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN_@localhost; +GRANT USAGE ON *.* TO '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +DROP USER '$DBADMIN'@'localhost'; +CREATE USER '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN@localhost; EXIT EOF @@ -67,8 +68,8 @@ EOF cd /var/www/nextcloud/ rm -f config/config.php sudo -u www-data php occ maintenance:install --database \ - "mysql" --database-name "nextcloud" --database-user "$DBADMIN_" --database-pass \ - "$DBPASSWD" --admin-user "$ADMINUSER_" --admin-pass "$DBPASSWD" + "mysql" --database-name "nextcloud" --database-user "$DBADMIN" --database-pass \ + "$DBPASSWD" --admin-user "$ADMINUSER_" --admin-pass "$ADMINPASS_" # cron jobs sudo -u www-data php occ background:cron diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh index dcaf0317..f35d165b 100644 --- a/etc/nextcloudpi-config.d/nc-nextcloud.sh +++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh @@ -19,7 +19,7 @@ VER_=12.0.0 MAXFILESIZE_=2G MEMORYLIMIT_=768M MAXTRANSFERTIME_=3600 -DBADMIN_=ncadmin +DBADMIN=ncadmin DESCRIPTION="Install any NextCloud version" export DEBIAN_FRONTEND=noninteractive @@ -69,10 +69,10 @@ DROP DATABASE IF EXISTS nextcloud; CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -GRANT USAGE ON *.* TO '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -DROP USER '$DBADMIN_'@'localhost'; -CREATE USER '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN_@localhost; +GRANT USAGE ON *.* TO '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +DROP USER '$DBADMIN'@'localhost'; +CREATE USER '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN@localhost; EXIT EOF diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index c99a41ad..2c8e6cfe 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -19,7 +19,7 @@ BACKUPFILE_=/media/USBdrive/nextcloud-bkp_xxxxxxxx.tar BASEDIR_=/var/www -DBADMIN_=ncadmin +DBADMIN=ncadmin DESCRIPTION="Restore a previously backuped NC instance" show_info() @@ -60,10 +60,10 @@ configure() mysql -u root -p$DBPASSWD <<EOF DROP DATABASE IF EXISTS nextcloud; CREATE DATABASE nextcloud; -GRANT USAGE ON *.* TO '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -DROP USER '$DBADMIN_'@'localhost'; -CREATE USER '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD'; -GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN_@localhost; +GRANT USAGE ON *.* TO '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +DROP USER '$DBADMIN'@'localhost'; +CREATE USER '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; +GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN@localhost; EXIT EOF [ $? -ne 0 ] && { echo -e "Error configuring nextcloud database"; return 1; } |