--- rpms/nextcloud/contribs9/nextcloud.spec 2018/12/21 03:15:09 1.6 +++ rpms/nextcloud/contribs9/nextcloud.spec 2019/01/08 02:49:07 1.8 @@ -1,5 +1,5 @@ %define version 15.0.0 -%define release 2 +%define release 4 %define apache_serverroot /usr/share %define apache_confdir /etc/httpd/conf.d @@ -47,6 +47,7 @@ Requires: php71-php-ldap Requires: php71-php-mysqlnd #rh-php71-php-pdo_mysql +Conflicts: nextcloud < 15 %description Nextcloud files and configuration. @@ -56,6 +57,37 @@ nc_dir: %{nc_dir} nc_data_dir: %{nc_data_dir} nc_config_dir: %{nc_config_dir} +%pre +# true if $1 is greater than or equal $2 +verlte() { + [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] +} + +verlt() { + [ "$1" = "$2" ] && return 1 || verlte $1 $2 +} +# if there is already an installed version +if [ -f /usr/share/nextcloud/version.php ] +then + echo "version.php found, already installed" + # get version number + installedver=`php -r 'require("/usr/share/nextcloud/version.php"); print "$OC_VersionString";'`; + majvers=`echo %{version} | cut -d. -f1` + majcurvers=`echo $installedver | cut -d. -f1` + echo "and the version is $installedver" + # we should fail with exit 1 if + # installed version > rpm version + if ( verlte $installedver %{version} ) + then + echo "Installed version has been upgraded and is most recent than this rpm" + exit 1 + elif [ $(($majvers-1)) > $majcurvers  ] + then # installed version < rpm version -1 + echo "can not upgrade from $installedver to %{version}, please do a manual update with intermediate version" + exit 1 + fi +fi + %install rm -rf %{buildroot} @@ -84,6 +116,7 @@ cp %{SOURCE1} %{buildroot}/etc/httpd/con %attr(0775,%{nc_user},%{nc_group}) %{nc_data_dir} %attr(0775,%{nc_user},%{nc_group}) %{nc_config_dir} %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/lib +%attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/ocm-provider %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/core %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/settings %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/3rdparty @@ -92,6 +125,7 @@ cp %{SOURCE1} %{buildroot}/etc/httpd/con %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/ocs* %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/*.php %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/AUTHORS +%attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/COPYING %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/index.html %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/robots.txt %attr(0644,%{nc_user},%{nc_group}) %{nc_dir}/.htaccess @@ -103,7 +137,12 @@ cp %{SOURCE1} %{buildroot}/etc/httpd/con %changelog -* Fri Dec 21 2018 Jean-Philipe Pialasse 15.0.0-2.sme +* Mon Jan 07 2019 Jean-Philipe Pialasse 15.0.0-4.sme +- prevent rpm to upgrade if webupdate has been used [SME: 10670] + and rpm version is < to on disk version + or if rppm version is more than one major release greater + +* Fri Dec 21 2018 Jean-Philipe Pialasse 15.0.0-3.sme - Update to release 15.0.0 [SME: 10669] * Wed Dec 19 2018 Jean-Philipe Pialasse 13.0.1-5.sme