[Helper] Download Nextcloud 15, add --update switch and some minor fixes
parent
b685499b22
commit
a2a963c840
|
@ -10,6 +10,7 @@ while [ "$1" != '' ]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-p|--purge) NC_PURGE=y && shift;;
|
-p|--purge) NC_PURGE=y && shift;;
|
||||||
-i|--install) NC_INSTALL=y && shift;;
|
-i|--install) NC_INSTALL=y && shift;;
|
||||||
|
-u|--update) NC_UPDATE=y && shift;;
|
||||||
-h|--help) NC_HELP=y && shift;;
|
-h|--help) NC_HELP=y && shift;;
|
||||||
*) echo "Unknown parameter: ${1}" && shift;;
|
*) echo "Unknown parameter: ${1}" && shift;;
|
||||||
esac
|
esac
|
||||||
|
@ -19,6 +20,7 @@ if [[ ${NC_HELP} == "y" ]]; then
|
||||||
printf 'Usage:\n\n'
|
printf 'Usage:\n\n'
|
||||||
printf ' -p|--purge\n Purge Nextcloud\n'
|
printf ' -p|--purge\n Purge Nextcloud\n'
|
||||||
printf ' -i|--install\n Install Nextcloud\n\n'
|
printf ' -i|--install\n Install Nextcloud\n\n'
|
||||||
|
printf ' -u|--update\n Update Nextcloud\n\n'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -29,9 +31,15 @@ cd ${SCRIPT_DIR}/../
|
||||||
source mailcow.conf
|
source mailcow.conf
|
||||||
|
|
||||||
if [[ ${NC_PURGE} == "y" ]]; then
|
if [[ ${NC_PURGE} == "y" ]]; then
|
||||||
|
read -r -p "Are you sure you want to purge Nextcloud? [y/N] " response
|
||||||
|
response=${response,,}
|
||||||
|
if [[ ! "$response" =~ ^(yes|y)$ ]]; then
|
||||||
|
echo "OK, aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e \
|
docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e \
|
||||||
"$(docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e "SELECT GROUP_CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME SEPARATOR ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'nc_%' AND TABLE_SCHEMA = '${DBNAME}';" -BN)"
|
"$(docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e "SELECT IFNULL(GROUP_CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME SEPARATOR ';'),'SELECT NULL;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'nc_%' AND TABLE_SCHEMA = '${DBNAME}';" -BN)"
|
||||||
docker exec -it $(docker ps -f name=redis-mailcow -q) /bin/sh -c ' cat <<EOF | redis-cli
|
docker exec -it $(docker ps -f name=redis-mailcow -q) /bin/sh -c ' cat <<EOF | redis-cli
|
||||||
SELECT 10
|
SELECT 10
|
||||||
FLUSHDB
|
FLUSHDB
|
||||||
|
@ -47,14 +55,40 @@ EOF
|
||||||
|
|
||||||
docker restart $(docker ps -aqf name=nginx-mailcow)
|
docker restart $(docker ps -aqf name=nginx-mailcow)
|
||||||
|
|
||||||
elif [[ ${NC_INSTALL} == "y" ]]; then
|
elif [[ ${NC_UPDATE} == "y" ]]; then
|
||||||
|
read -r -p "Are you sure you want to update Nextcloud? [y/N] " response
|
||||||
|
response=${response,,}
|
||||||
|
if [[ ! "$response" =~ ^(yes|y)$ ]]; then
|
||||||
|
echo "OK, aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f data/web/nextcloud/occ ]; then
|
||||||
|
echo "Nextcloud occ not found. Is Nextcloud installed?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q 'installed: true' <<<$(docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ --no-warnings status"); then
|
||||||
|
curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-15.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
|
||||||
|
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
|
||||||
|
&& rm nextcloud.tar.bz2 \
|
||||||
|
&& rm -rf ./data/web/nextcloud/updater \
|
||||||
|
&& mkdir -p ./data/web/nextcloud/data \
|
||||||
|
&& mkdir -p ./data/web/nextcloud/custom_apps \
|
||||||
|
&& chmod +x ./data/web/nextcloud/occ
|
||||||
|
docker exec -it $(docker ps -f name=php-fpm-mailcow -q) bash -c "chown www-data:www-data -R /web/nextcloud"
|
||||||
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ --no-warnings upgrade"
|
||||||
|
else
|
||||||
|
echo "Nextcloud seems not to be installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ ${NC_INSTALL} == "y" ]]; then
|
||||||
NC_TYPE=
|
NC_TYPE=
|
||||||
while [[ ! ${NC_TYPE} =~ ^subfolder$|^subdomain$ ]]; do
|
while [[ ! ${NC_TYPE} =~ ^subfolder$|^subdomain$ ]]; do
|
||||||
read -p "Configure as subdomain or subfolder? [subdomain/subfolder] " NC_TYPE
|
read -p "Configure as subdomain or subfolder? [subdomain/subfolder] " NC_TYPE
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if [[ ${NC_TYPE} == "subdomain" ]]; then
|
if [[ ${NC_TYPE} == "subdomain" ]]; then
|
||||||
NC_SUBD=
|
NC_SUBD=
|
||||||
while [[ -z ${NC_SUBD} ]]; do
|
while [[ -z ${NC_SUBD} ]]; do
|
||||||
|
@ -68,7 +102,7 @@ elif [[ ${NC_INSTALL} == "y" ]]; then
|
||||||
|
|
||||||
ADMIN_NC_PASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
|
ADMIN_NC_PASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
|
||||||
|
|
||||||
curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-14.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
|
curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-15.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
|
||||||
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
|
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
|
||||||
&& rm nextcloud.tar.bz2 \
|
&& rm nextcloud.tar.bz2 \
|
||||||
&& rm -rf ./data/web/nextcloud/updater \
|
&& rm -rf ./data/web/nextcloud/updater \
|
||||||
|
@ -77,7 +111,7 @@ elif [[ ${NC_INSTALL} == "y" ]]; then
|
||||||
&& chmod +x ./data/web/nextcloud/occ
|
&& chmod +x ./data/web/nextcloud/occ
|
||||||
|
|
||||||
docker exec -it $(docker ps -f name=php-fpm-mailcow -q) /bin/bash -c "chown -R www-data:www-data /web/nextcloud/data /web/nextcloud/config /web/nextcloud/apps /web/nextcloud/custom_apps"
|
docker exec -it $(docker ps -f name=php-fpm-mailcow -q) /bin/bash -c "chown -R www-data:www-data /web/nextcloud/data /web/nextcloud/config /web/nextcloud/apps /web/nextcloud/custom_apps"
|
||||||
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ maintenance:install \
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ --no-warnings maintenance:install \
|
||||||
--database mysql \
|
--database mysql \
|
||||||
--database-host mysql \
|
--database-host mysql \
|
||||||
--database-name ${DBNAME} \
|
--database-name ${DBNAME} \
|
||||||
|
@ -88,32 +122,32 @@ elif [[ ${NC_INSTALL} == "y" ]]; then
|
||||||
--admin-pass ${ADMIN_NC_PASS} \
|
--admin-pass ${ADMIN_NC_PASS} \
|
||||||
--data-dir /web/nextcloud/data
|
--data-dir /web/nextcloud/data
|
||||||
|
|
||||||
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ config:system:set redis host --value=redis --type=string; \
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ --no-warnings config:system:set redis host --value=redis --type=string; \
|
||||||
/web/nextcloud/occ config:system:set redis port --value=6379 --type=integer; \
|
/web/nextcloud/occ --no-warnings config:system:set redis port --value=6379 --type=integer; \
|
||||||
/web/nextcloud/occ config:system:set redis timeout --value=0.0 --type=integer; \
|
/web/nextcloud/occ --no-warnings config:system:set redis timeout --value=0.0 --type=integer; \
|
||||||
/web/nextcloud/occ config:system:set redis dbindex --value=10 --type=integer; \
|
/web/nextcloud/occ --no-warnings config:system:set redis dbindex --value=10 --type=integer; \
|
||||||
/web/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis' --type=string; \
|
/web/nextcloud/occ --no-warnings config:system:set memcache.locking --value='\OC\Memcache\Redis' --type=string; \
|
||||||
/web/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\Redis' --type=string; \
|
/web/nextcloud/occ --no-warnings config:system:set memcache.local --value='\OC\Memcache\Redis' --type=string; \
|
||||||
/web/nextcloud/occ config:system:set trusted_domains 1 --value=${MAILCOW_HOSTNAME}; \
|
/web/nextcloud/occ --no-warnings config:system:set trusted_domains 1 --value=${MAILCOW_HOSTNAME}; \
|
||||||
/web/nextcloud/occ config:system:set trusted_proxies 0 --value=${IPV6_NETWORK}; \
|
/web/nextcloud/occ --no-warnings config:system:set trusted_proxies 0 --value=${IPV6_NETWORK}; \
|
||||||
/web/nextcloud/occ config:system:set trusted_proxies 1 --value=${IPV4_NETWORK}.0/24; \
|
/web/nextcloud/occ --no-warnings config:system:set trusted_proxies 1 --value=${IPV4_NETWORK}.0/24; \
|
||||||
/web/nextcloud/occ config:system:set overwritewebroot --value=/nextcloud; \
|
/web/nextcloud/occ --no-warnings config:system:set overwritewebroot --value=/nextcloud; \
|
||||||
/web/nextcloud/occ config:system:set overwritehost --value=${MAILCOW_HOSTNAME}; \
|
/web/nextcloud/occ --no-warnings config:system:set overwritehost --value=${MAILCOW_HOSTNAME}; \
|
||||||
/web/nextcloud/occ config:system:set overwriteprotocol --value=https; \
|
/web/nextcloud/occ --no-warnings config:system:set overwriteprotocol --value=https; \
|
||||||
/web/nextcloud/occ config:system:set mail_smtpmode --value=smtp; \
|
/web/nextcloud/occ --no-warnings config:system:set mail_smtpmode --value=smtp; \
|
||||||
/web/nextcloud/occ config:system:set mail_smtpauthtype --value=LOGIN; \
|
/web/nextcloud/occ --no-warnings config:system:set mail_smtpauthtype --value=LOGIN; \
|
||||||
/web/nextcloud/occ config:system:set mail_from_address --value=nextcloud; \
|
/web/nextcloud/occ --no-warnings config:system:set mail_from_address --value=nextcloud; \
|
||||||
/web/nextcloud/occ config:system:set mail_domain --value=${MAILCOW_HOSTNAME}; \
|
/web/nextcloud/occ --no-warnings config:system:set mail_domain --value=${MAILCOW_HOSTNAME}; \
|
||||||
/web/nextcloud/occ config:system:set mail_smtphost --value=postfix; \
|
/web/nextcloud/occ --no-warnings config:system:set mail_smtphost --value=postfix; \
|
||||||
/web/nextcloud/occ config:system:set mail_smtpport --value=588
|
/web/nextcloud/occ --no-warnings config:system:set mail_smtpport --value=588
|
||||||
/web/nextcloud/occ app:enable user_external
|
/web/nextcloud/occ --no-warnings app:install user_external
|
||||||
/web/nextcloud/occ config:system:set user_backends 0 arguments 0 --value={dovecot:143/imap/tls/novalidate-cert}
|
/web/nextcloud/occ --no-warnings config:system:set user_backends 0 arguments 0 --value={dovecot:143/imap/tls/novalidate-cert}
|
||||||
/web/nextcloud/occ config:system:set user_backends 0 class --value=OC_User_IMAP"
|
/web/nextcloud/occ --no-warnings config:system:set user_backends 0 class --value=OC_User_IMAP"
|
||||||
|
|
||||||
if [[ ${NC_TYPE} == "subdomain" ]]; then
|
if [[ ${NC_TYPE} == "subdomain" ]]; then
|
||||||
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ config:system:set trusted_domains 1 --value=${NC_SUBD}
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ --no-warnings config:system:set trusted_domains 1 --value=${NC_SUBD}
|
||||||
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ config:system:set overwritewebroot --value=/
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ --no-warnings config:system:set overwritewebroot --value=/
|
||||||
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ config:system:set overwritehost --value=${NC_SUBD}
|
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ --no-warnings config:system:set overwritehost --value=${NC_SUBD}
|
||||||
cp ./data/assets/nextcloud/nextcloud.conf ./data/conf/nginx/
|
cp ./data/assets/nextcloud/nextcloud.conf ./data/conf/nginx/
|
||||||
sed -i "s/NC_SUBD/${NC_SUBD}/g" ./data/conf/nginx/nextcloud.conf
|
sed -i "s/NC_SUBD/${NC_SUBD}/g" ./data/conf/nginx/nextcloud.conf
|
||||||
elif [[ ${NC_TYPE} == "subfolder" ]]; then
|
elif [[ ${NC_TYPE} == "subfolder" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue