Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a73ac8f8 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'disable-rsync-when-no-version-change' into 'master'

Disabled rsync step when version not updated

See merge request !33
parents 3c77edc5 c768c7c7
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
+27 −28
Original line number Diff line number Diff line
#!/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"

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/
@@ -17,20 +28,8 @@ rsync $rsync_options --include "/email-recovery" --exclude '/*' $SRC_DIR/custom_
    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"
    echo "Skipping rsync step as version not updated!"
fi


echo "NC ready!"
/entrypoint.sh "$@"
 No newline at end of file