From: Franck Bui Date: Thu, 28 Feb 2019 09:55:22 +0000 (+0100) Subject: rpm: drop use of $FIRST_ARG X-Git-Tag: v14.1.1~60^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=926433f5d45e557c42f050b43798ba29dc495e02;p=ceph.git rpm: drop use of $FIRST_ARG The use of $FIRST_ARG was probably required because the SUSE-specific %service_* rpm macros were playing tricks on the shell positional parameters. This is bad practice and error-prone, so let's assume that no macros should do that anymore and hence it's safe to assume that positional parameters remain unchanged after any rpm macro call. Thanks to Franck Bui for providing this patch. Signed-off-by: Nathan Cutler --- diff --git a/ceph.spec.in b/ceph.spec.in index e9c0a9d8c2e3..207f045e4286 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -1312,7 +1312,6 @@ fi %postun base /sbin/ldconfig -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph.target @@ -1320,7 +1319,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1453,7 +1452,6 @@ fi %endif %postun mds -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-mds@\*.service ceph-mds.target @@ -1461,7 +1459,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-mds@\*.service ceph-mds.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1528,7 +1526,6 @@ fi %endif %postun mgr -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-mgr@\*.service ceph-mgr.target @@ -1536,7 +1533,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-mgr@\*.service ceph-mgr.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1643,7 +1640,6 @@ fi %endif %postun mon -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-mon@\*.service ceph-mon.target @@ -1651,7 +1647,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-mon@\*.service ceph-mon.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1702,7 +1698,6 @@ fi %endif %postun -n rbd-mirror -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-rbd-mirror@\*.service ceph-rbd-mirror.target @@ -1710,7 +1705,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-rbd-mirror@\*.service ceph-rbd-mirror.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1758,7 +1753,6 @@ fi %endif %postun radosgw -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-radosgw@\*.service ceph-radosgw.target @@ -1766,7 +1760,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-radosgw@\*.service ceph-radosgw.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph @@ -1826,7 +1820,6 @@ fi %endif %postun osd -test -n "$FIRST_ARG" || FIRST_ARG=$1 %if 0%{?suse_version} DISABLE_RESTART_ON_UPDATE="yes" %service_del_postun ceph-osd@\*.service ceph-volume@\*.service ceph-osd.target @@ -1834,7 +1827,7 @@ DISABLE_RESTART_ON_UPDATE="yes" %if 0%{?fedora} || 0%{?rhel} %systemd_postun ceph-osd@\*.service ceph-volume@\*.service ceph-osd.target %endif -if [ $FIRST_ARG -ge 1 ] ; then +if [ $1 -ge 1 ] ; then # Restart on upgrade, but only if "CEPH_AUTO_RESTART_ON_UPGRADE" is set to # "yes". In any case: if units are not running, do not touch them. SYSCONF_CEPH=%{_sysconfdir}/sysconfig/ceph