packaging: backup commands.properties as it does not exist in new rpms In case of rpms, the commands.properties file is bundled at /usr/share/cloudstack-management/webapps/client/WEB-INF/classes/commands.properties
In case of a rpm upgrade, new rpms won't ship with commands.properties file. For existing installations this copies the commands.properties file to /etc/cloudstack/management Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/07dcac73 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/07dcac73 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/07dcac73 Branch: refs/heads/master Commit: 07dcac7373054f7af057756f752afe66fb459589 Parents: 1770f3c Author: Rohit Yadav <[email protected]> Authored: Thu May 19 09:56:46 2016 +0530 Committer: Rohit Yadav <[email protected]> Committed: Thu May 19 09:56:46 2016 +0530 ---------------------------------------------------------------------- packaging/centos63/cloud.spec | 7 +++++++ packaging/centos7/cloud.spec | 7 +++++++ packaging/fedora20/cloud.spec | 7 +++++++ packaging/fedora21/cloud.spec | 7 +++++++ 4 files changed, 28 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07dcac73/packaging/centos63/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index 25970ea..7ead806 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -396,6 +396,13 @@ if [ -d "%{_sysconfdir}/cloud" ] ; then mv %{_sysconfdir}/cloud %{_sysconfdir}/cloud.rpmsave fi +# in case of upgrade to 4.9+ copy commands.properties if not exists in /etc/cloudstack/management/ +if [ "$1" == "2" ] ; then + if [ -f "%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties" ] && [ ! -f "%{_sysconfdir}/%{name}/management/commands.properties" ] ; then + cp -p %{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties %{_sysconfdir}/%{name}/management/commands.properties + fi +fi + %post management if [ "$1" == "1" ] ; then /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07dcac73/packaging/centos7/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec index 68cc048..917db09 100644 --- a/packaging/centos7/cloud.spec +++ b/packaging/centos7/cloud.spec @@ -352,6 +352,13 @@ id cloud > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged us rm -rf %{_localstatedir}/cache/cloudstack +# in case of upgrade to 4.9+ copy commands.properties if not exists in /etc/cloudstack/management/ +if [ "$1" == "2" ] ; then + if [ -f "%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties" ] && [ ! -f "%{_sysconfdir}/%{name}/management/commands.properties" ] ; then + cp -p %{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties %{_sysconfdir}/%{name}/management/commands.properties + fi +fi + %post management if [ "$1" == "1" ] ; then /usr/bin/systemctl on cloudstack-management > /dev/null 2>&1 || true http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07dcac73/packaging/fedora20/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/fedora20/cloud.spec b/packaging/fedora20/cloud.spec index b1d11b1..084472b 100644 --- a/packaging/fedora20/cloud.spec +++ b/packaging/fedora20/cloud.spec @@ -395,6 +395,13 @@ if [ -d "%{_sysconfdir}/cloud" ] ; then mv %{_sysconfdir}/cloud %{_sysconfdir}/cloud.rpmsave fi +# in case of upgrade to 4.9+ copy commands.properties if not exists in /etc/cloudstack/management/ +if [ "$1" == "2" ] ; then + if [ -f "%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties" ] && [ ! -f "%{_sysconfdir}/%{name}/management/commands.properties" ] ; then + cp -p %{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties %{_sysconfdir}/%{name}/management/commands.properties + fi +fi + %post management if [ "$1" == "1" ] ; then /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07dcac73/packaging/fedora21/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/fedora21/cloud.spec b/packaging/fedora21/cloud.spec index 561452e..dbf761f 100644 --- a/packaging/fedora21/cloud.spec +++ b/packaging/fedora21/cloud.spec @@ -395,6 +395,13 @@ if [ -d "%{_sysconfdir}/cloud" ] ; then mv %{_sysconfdir}/cloud %{_sysconfdir}/cloud.rpmsave fi +# in case of upgrade to 4.9+ copy commands.properties if not exists in /etc/cloudstack/management/ +if [ "$1" == "2" ] ; then + if [ -f "%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties" ] && [ ! -f "%{_sysconfdir}/%{name}/management/commands.properties" ] ; then + cp -p %{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties %{_sysconfdir}/%{name}/management/commands.properties + fi +fi + %post management if [ "$1" == "1" ] ; then /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true
