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

Commit eb928d5b authored by Akhil's avatar Akhil 🙂
Browse files

Disabled rsync step when version not updated

parent 3c65ddf2
Loading
Loading
Loading
Loading
Loading
+25 −12
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,7 +28,9 @@ 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/

else
    echo "Skipping rsync step as version not updated!"
fi
# 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