@@ -435,10 +435,8 @@ if [ "$1" == "2" ] ; then
435435fi
436436
437437%post management
438- if [ " $1 " == " 1" ] ; then
439- /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true
440- /sbin/chkconfig --level 345 cloudstack-management on > /dev/null 2>&1 || true
441- fi
438+ /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true
439+ /sbin/chkconfig --level 345 cloudstack-management on > /dev/null 2>&1 || true
442440
443441grep -s -q "db.cloud.driver= jdbc:mysql" "%{_sysconfdir }/%{name }/management/db.properties" || sed -i -e "\$adb.cloud.driver= jdbc:mysql" "%{_sysconfdir }/%{name }/management/db.properties"
444442grep -s -q "db.usage.driver= jdbc:mysql" "%{_sysconfdir }/%{name }/management/db.properties" || sed -i -e "\$adb.usage.driver= jdbc:mysql" "%{_sysconfdir }/%{name }/management/db.properties"
@@ -523,18 +521,19 @@ if [ -d "%{_sysconfdir}/cloud" ] ; then
523521fi
524522
525523%post agent
526- if [ " $1 " == " 1 " ] ; then
524+ if [ " $1 " == " 2 " ] ; then
527525 echo " Running %{_bindir}/%{name}-agent-upgrade to update bridge name for upgrade from CloudStack 4.0.x (and before) to CloudStack 4.1 (and later)"
528526 %{_bindir}/%{name}-agent-upgrade
529- if [ ! -d %{_sysconfdir}/libvirt/hooks ] ; then
530- mkdir %{_sysconfdir}/libvirt/hooks
531- fi
532- cp -a ${RPM_BUILD_ROOT} %{_datadir}/%{name}-agent/lib/libvirtqemuhook %{_sysconfdir}/libvirt/hooks/qemu
533- /sbin/service libvirtd restart
534- /sbin/chkconfig --add cloudstack-agent > /dev/null 2>&1 || true
535- /sbin/chkconfig --level 345 cloudstack-agent on > /dev/null 2>&1 || true
536527fi
537528
529+ if [ ! -d %{_sysconfdir }/libvirt/hooks ] ; then
530+ mkdir %{_sysconfdir }/libvirt/hooks
531+ fi
532+ cp -a ${RPM_BUILD_ROOT}%{_datadir }/%{name }-agent/lib/libvirtqemuhook %{_sysconfdir }/libvirt/hooks/qemu
533+ /sbin/service libvirtd restart
534+ /sbin/chkconfig --add cloudstack-agent > /dev/null 2> &1 || true
535+ /sbin/chkconfig --level 345 cloudstack-agent on > /dev/null 2> &1 || true
536+
538537# if saved configs from upgrade exist, copy them over
539538if [ -f "%{_sysconfdir }/cloud.rpmsave/agent/agent.properties" ]; then
540539 mv %{_sysconfdir }/%{name }/agent/agent.properties %{_sysconfdir }/%{name }/agent/agent.properties.rpmnew
0 commit comments