diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-02-06 00:54:56 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-02-06 00:55:29 +0300 |
commit | 4dce600678a8a82db49782366b89702a1f52cfaa (patch) | |
tree | 6b17fe80ca51c1b9ffbab4c9ce789b115c162a8f /etc/nextcloudpi-config.d | |
parent | 776529f88932bcd94e4a9515e092a3ffe210fd27 (diff) |
nc-nextcloud: fixes for beta versionsv0.45.2
Diffstat (limited to 'etc/nextcloudpi-config.d')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-nextcloud.sh | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh index ff70a5e3..7f86b11d 100644 --- a/etc/nextcloudpi-config.d/nc-nextcloud.sh +++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh @@ -15,6 +15,7 @@ # VER_=12.0.5 +BETA_=no MAXFILESIZE_=2G MEMORYLIMIT_=768M MAXTRANSFERTIME_=3600 @@ -91,47 +92,18 @@ configure() { ping -W 2 -w 1 -q google.com &>/dev/null || { echo "No internet connectivity"; return 1; } - ## RE-CREATE DATABASE TABLE - echo "Starting mariaDB" - - # launch mariadb if not already running (for docker build) - if ! pgrep -c mysqld &>/dev/null; then - mysqld & - fi - - # wait for mariadb - pgrep -x mysqld &>/dev/null || { echo "mariaDB process not found"; return 1; } - - while :; do - [[ -S /var/run/mysqld/mysqld.sock ]] && break - sleep 0.5 - done - - echo "Setting up database..." - - # workaround to emulate DROP USER IF EXISTS ..;) - local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) - mysql <<EOF -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; -EXIT -EOF - ## IF BETA SELECTED ADD "pre" to DOWNLOAD PATH -if [[ "BETA_" == yes ]]; then - local PREFIX="pre" + [[ "$BETA_" == yes ]] && local PREFIX="pre" ## DOWNLOAD AND (OVER)WRITE NEXTCLOUD cd /var/www/ + local URL="https://download.nextcloud.com/server/${PREFIX}releases/nextcloud-$VER_.tar.bz2" echo "Downloading Nextcloud $VER_..." - wget -q https://download.nextcloud.com/server/${PREFIX}releases/nextcloud-$VER_.tar.bz2 -O nextcloud.tar.bz2 || return 1 + wget -q "$URL" -O nextcloud.tar.bz2 || { + echo "couldn't download $URL" + return 1 + } rm -rf nextcloud echo "Installing Nextcloud $VER_..." @@ -179,6 +151,38 @@ if [[ "BETA_" == yes ]]; then mkdir -p $OPCACHEDIR chown -R www-data:www-data $OPCACHEDIR + ## RE-CREATE DATABASE TABLE + echo "Starting mariaDB" + + # launch mariadb if not already running (for docker build) + if ! pgrep -c mysqld &>/dev/null; then + mysqld & + fi + + # wait for mariadb + pgrep -x mysqld &>/dev/null || { echo "mariaDB process not found"; return 1; } + + while :; do + [[ -S /var/run/mysqld/mysqld.sock ]] && break + sleep 0.5 + done + + echo "Setting up database..." + + # workaround to emulate DROP USER IF EXISTS ..;) + local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) + mysql <<EOF +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; +EXIT +EOF + ## SET APACHE VHOST cat > /etc/apache2/sites-available/nextcloud.conf <<'EOF' <IfModule mod_ssl.c> |