mirror of
https://github.com/linuxserver/docker-nextcloud.git
synced 2026-02-19 23:03:50 +08:00
Trim whitespace around version numbers
This commit is contained in:
parent
0ec959e8c7
commit
00b7ea5cb3
@ -10,7 +10,7 @@ mkdir -p \
|
||||
/data
|
||||
|
||||
# migrate legacy install (copy inside container)
|
||||
if [ -f /config/www/nextcloud/version.php ]; then
|
||||
if [[ -f /config/www/nextcloud/version.php ]]; then
|
||||
echo "Migrating legacy install (this can take a while) ...)"
|
||||
rsync -rlD --remove-source-files --exclude-from=/app/upgrade.exclude /config/www/nextcloud/ /app/www/public/
|
||||
rm -rf /config/www/nextcloud/updater/
|
||||
@ -26,7 +26,7 @@ fi
|
||||
|
||||
# symlink config folders
|
||||
for dir in apps config themes; do
|
||||
if [ "$(readlink /app/www/public/${dir})" != "/config/www/nextcloud/${dir}" ]; then
|
||||
if [[ "$(readlink /app/www/public/${dir})" != "/config/www/nextcloud/${dir}" ]]; then
|
||||
rm -rf "/app/www/public/${dir}"
|
||||
ln -s "/config/www/nextcloud/${dir}" "/app/www/public/${dir}"
|
||||
lsiown abc:abc "/config/www/nextcloud/${dir}" "/app/www/public/${dir}"
|
||||
@ -34,9 +34,9 @@ for dir in apps config themes; do
|
||||
done
|
||||
|
||||
# get versions
|
||||
image_version=$(php -r "require '/app/www/src/version.php'; echo implode('.', \$OC_Version);" 2>/dev/null)
|
||||
installed_version=$(php -r "require '/config/www/nextcloud/config/config.php'; echo \$CONFIG['version'];" 2>/dev/null)
|
||||
if [ "${installed_version}" = "" ]; then
|
||||
image_version=$(php -r "require '/app/www/src/version.php'; echo implode('.', \$OC_Version);" 2>/dev/null | xargs)
|
||||
installed_version=$(php -r "require '/config/www/nextcloud/config/config.php'; echo \$CONFIG['version'];" 2>/dev/null | xargs)
|
||||
if [[ "${installed_version}" = "" ]]; then
|
||||
installed_version="0.0.0.0"
|
||||
fi
|
||||
image_major="${image_version%%.*}"
|
||||
@ -54,23 +54,23 @@ if vergt "${installed_version}" "${image_version}"; then
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
if [ "${installed_version}" != "0.0.0.0" ] && vergt "${image_major}" "${max_upgrade}"; then
|
||||
if [[ "${installed_version}" != "0.0.0.0" ]] && vergt "${image_major}" "${max_upgrade}"; then
|
||||
echo "Can't start Nextcloud because the version of the data (${installed_version}) is more than one major version behind the docker image version (${image_version}) and upgrading more than one major version is not supported. Please run an image tagged for the major version ${max_upgrade} first."
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
if [ "${installed_version}" = "0.0.0.0" ] || [ ! -f /app/www/public/version.php ] || [ -z "$(ls -A /config/www/nextcloud/apps 2>/dev/null)" ]; then
|
||||
if [[ "${installed_version}" = "0.0.0.0" ]] || [[ ! -f /app/www/public/version.php ]] || [[ -z "$(ls -A /config/www/nextcloud/apps 2>/dev/null)" ]]; then
|
||||
touch /tmp/needs_install
|
||||
fi
|
||||
|
||||
if [ "${installed_version}" != "0.0.0.0" ] && vergt "${image_version}" "${installed_version}"; then
|
||||
if [[ "${installed_version}" != "0.0.0.0" ]] && vergt "${image_version}" "${installed_version}"; then
|
||||
touch /tmp/needs_upgrade
|
||||
fi
|
||||
|
||||
# initialize nextcloud
|
||||
if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_install ] || [ -f /tmp/needs_upgrade ]; then
|
||||
if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_install ]] || [[ -f /tmp/needs_upgrade ]]; then
|
||||
echo "Initializing nextcloud ${image_version} (this can take a while) ..."
|
||||
if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_upgrade ]; then
|
||||
if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_upgrade ]]; then
|
||||
echo "Upgrading nextcloud from ${installed_version} ..."
|
||||
shippedApps=$(jq -r .shippedApps[] /app/www/src/core/shipped.json)
|
||||
for app in ${shippedApps}; do
|
||||
@ -80,11 +80,11 @@ if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_instal
|
||||
|
||||
rsync -rlD --exclude-from=/app/upgrade.exclude /app/www/src/ /app/www/public/
|
||||
for dir in apps config themes; do
|
||||
if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_upgrade ] || [ -z "$(ls -A /app/www/public/${dir} 2>/dev/null)" ]; then
|
||||
if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_upgrade ]] || [[ -z "$(ls -A /app/www/public/${dir} 2>/dev/null)" ]]; then
|
||||
rsync -rlD --include "/${dir}" --exclude '/*' /app/www/src/ /config/www/nextcloud/
|
||||
fi
|
||||
done
|
||||
if [ -z "$(ls -A /data/ 2>/dev/null)" ]; then
|
||||
if [[ -z "$(ls -A /data/ 2>/dev/null)" ]]; then
|
||||
rsync -rlD --include "/data" --exclude '/*' /app/www/src/ /
|
||||
fi
|
||||
|
||||
@ -94,11 +94,11 @@ if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_instal
|
||||
/app/www/public \
|
||||
/config/www/nextcloud
|
||||
|
||||
if [ -f /config/www/nextcloud/config/needs_migration ] || [ -f /tmp/needs_upgrade ]; then
|
||||
if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_upgrade ]]; then
|
||||
# Upgrade
|
||||
occ upgrade
|
||||
else
|
||||
if [ "${installed_version}" = "0.0.0.0" ]; then
|
||||
if [[ "${installed_version}" = "0.0.0.0" ]]; then
|
||||
# Install
|
||||
echo "New nextcloud instance"
|
||||
echo "Please run the web-based installer on first connect!"
|
||||
@ -148,14 +148,14 @@ for APP in richdocumentscode; do
|
||||
echo "Removing ${APP}"
|
||||
fi
|
||||
APP_PATH=$(occ app:getpath "${APP}" 2>/dev/null)
|
||||
if [ -z "${APP_PATH}" ] || [ ! -d "${APP_PATH}" ]; then
|
||||
if [[ -z "${APP_PATH}" ]] || [[ ! -d "${APP_PATH}" ]]; then
|
||||
APP_PATH="/app/www/public/apps/${APP}"
|
||||
fi
|
||||
if [ -d "${APP_PATH}" ]; then
|
||||
if [[ -d "${APP_PATH}" ]]; then
|
||||
occ app:disable "${APP}" >/dev/null 2>&1
|
||||
fi
|
||||
APP_STATUS="$(occ config:app:get "${APP}" enabled 2>/dev/null)"
|
||||
if [ "${APP_STATUS}" != "no" ] && [ -n "${APP_STATUS}" ]; then
|
||||
if [[ "${APP_STATUS}" != "no" ]] && [[ -n "${APP_STATUS}" ]]; then
|
||||
occ config:app:set "${APP}" enabled --value="no" >/dev/null 2>&1
|
||||
fi
|
||||
occ app:remove "${APP}" >/dev/null 2>&1
|
||||
@ -163,14 +163,14 @@ for APP in richdocumentscode; do
|
||||
done
|
||||
|
||||
# set data directory
|
||||
if [ ! -s /config/www/nextcloud/config/config.php ]; then
|
||||
if [[ ! -s /config/www/nextcloud/config/config.php ]]; then
|
||||
echo -e "<?php\n\$CONFIG = array (\n 'datadirectory' => '/data',\n);" >/config/www/nextcloud/config/config.php
|
||||
elif [ -f /config/www/nextcloud/config/config.php ]; then
|
||||
elif [[ -f /config/www/nextcloud/config/config.php ]]; then
|
||||
sed -i "s|/app/www/public/data|/data|g" /config/www/nextcloud/config/config.php
|
||||
fi
|
||||
|
||||
#modify javascript mime type and add .mjs support
|
||||
if [ -s /etc/nginx/mime.types ]; then
|
||||
if [[ -s /etc/nginx/mime.types ]]; then
|
||||
sed -i 's|\bjs;|js mjs;|g' /etc/nginx/mime.types
|
||||
sed -i 's|\bapplication/javascript|text/javascript|g' /etc/nginx/mime.types
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user