diff --git a/Dockerfile b/Dockerfile index bcd23bba2855f6fbcd8b578a930904999b0e920a..1cf58c061a767f7620a8b7642620aad2b201ea52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images COPY patches/ ${TMP_PATCH_DIR}/ COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh -RUN sed -i 's/20,0,11,1/20,0,11,5/' ${BASE_DIR}/version.php +RUN sed -i 's/20,0,11,1/20,0,11,6/' ${BASE_DIR}/version.php # Install unzip for unzipping artifacts RUN apt-get update && apt-get install unzip @@ -75,6 +75,9 @@ RUN curl -fsSL -o ecloud_drop_account.tar.gz \ # Remove unzip when unzipping is done RUN apt-get -y remove unzip +# force eelo theme not to be disabled even when there is an upgrade process launched +RUN sed -i "s/\$systemConfig->setValue('theme', '');/\$systemConfig->setValue('theme', 'eelo');/g" ${BASE_DIR}/lib/base.php + # Patches RUN patch -u ${BASE_DIR}/core/Controller/LoginController.php -i ${TMP_PATCH_DIR}/002-login-without-domain.patch RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003-contact-search-removal.patch diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index e69c4babe871c0033845e624ca164269c66f18ec..892723e2ff5ea557cf49bdffe4cc46e04fa42bf0 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -1,36 +1,35 @@ #!/bin/sh +version_greater() { + [ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ] +} + echo "Custom eCloud entrypoint" rsync_options="-rlDog --chown www-data:www-data --delete" SRC_DIR="/usr/src/nextcloud" DST_DIR="/var/www/html" -rsync $rsync_options --include "/news/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/notes/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/quota_warning/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/calendar/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/contacts/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/user_backend_sql_raw/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/rainloop" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/email-recovery" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ -rsync $rsync_options --include "/ecloud_drop_account" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ - -rsync $rsync_options --include "/eelo/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/ - -# force eelo theme not to be disabled even when there is an upgrade process launched -sed -i "s/\$systemConfig->setValue('theme', '');/\$systemConfig->setValue('theme', 'eelo');/g" $DST_DIR/lib/base.php - -/entrypoint.sh "$@" - -# force eelo theme to be (re)loaded after an upgrade - if [ "$(id -u)" = 0 ]; then - su -p www-data -s /bin/sh -c "php /var/www/html/occ config:system:set theme --value eelo" - su -p www-data -s /bin/sh -c "php /var/www/html/occ maintenance:theme:update" - else - sh -c "php /var/www/html/occ config:system:set theme --value eelo" - sh -c "php /var/www/html/occ maintenance:theme:update" - fi - - -echo "NC ready!" +installed_version="0.0.0.0" +if [ -f /var/www/html/version.php ]; then + installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" +fi +image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" + +if version_greater "$image_version" "$installed_version"; then + rsync $rsync_options --include "/news/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/notes/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/quota_warning/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/calendar/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/contacts/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/user_backend_sql_raw/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/rainloop" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/email-recovery" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/ecloud_drop_account" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + + rsync $rsync_options --include "/eelo/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/ +else + echo "Skipping rsync step as version not updated!" +fi + +/entrypoint.sh "$@" \ No newline at end of file