diff --git a/salt.changes b/salt.changes index 61b466d..fcc0418 100644 --- a/salt.changes +++ b/salt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Oct 18 11:24:28 UTC 2013 - p.drouand@gmail.com + +- Don't support sysvinit and systemd for the same system; add conditionnal + macros to use systemd only on systems which support it and sysvinit + on other systems + ------------------------------------------------------------------- Thu Oct 17 18:27:23 UTC 2013 - aboe76@gmail.com diff --git a/salt.spec b/salt.spec index e41b0c7..df47994 100644 --- a/salt.spec +++ b/salt.spec @@ -62,7 +62,9 @@ Requires: python-Jinja2 Requires: python-PyYAML Requires: python-xml Requires(pre): %fillup_prereq +%if 0%{?suse_version} < 1210 Requires(pre): %insserv_prereq +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 @@ -95,8 +97,11 @@ Requires: dmidecode %endif %endif Recommends: python-halite -Requires(pre): %fillup_prereq +%if 0%{?suse_version} < 1210 Requires(pre): %insserv_prereq +%endif +Requires(pre): %fillup_prereq + %description master The Salt master is the central server to which all minions connect. @@ -111,8 +116,10 @@ Requires: python-pyzmq Requires: python-M2Crypto Requires: python-msgpack-python Requires: python-pycrypto -Requires(pre): %fillup_prereq +%if 0%{?suse_version} < 1210 Requires(pre): %insserv_prereq +%endif +Requires(pre): %fillup_prereq %description minion Salt minion is queried and controlled from the master. @@ -123,8 +130,10 @@ Summary: Syndic component for salt, a parallel remote execution system Group: System/Monitoring Requires: %{name} = %{version} Requires: %{name}-master = %{version} -Requires(pre): %fillup_prereq +%if 0%{?suse_version} < 1210 Requires(pre): %insserv_prereq +%endif +Requires(pre): %fillup_prereq %description syndic Salt syndic is the master-of-masters for salt @@ -136,8 +145,10 @@ Summary: Ssh component for salt, a parallel remote execution system Group: System/Monitoring Requires: %{name} = %{version} Recommends: sshpass -Requires(pre): %fillup_prereq +%if 0%{?suse_version} < 1210 Requires(pre): %insserv_prereq +%endif +Requires(pre): %fillup_prereq %description ssh Salt ssh is a master running without zmq. @@ -155,7 +166,9 @@ python setup.py install --prefix=%{_prefix} --root=%{buildroot} ## create missing directories mkdir -p %{buildroot}%{_sysconfdir}/salt/master.d mkdir -p %{buildroot}%{_sysconfdir}/salt/minion.d +%if 0%{?suse_version} < 1210 mkdir -p %{buildroot}%{_sysconfdir}/init.d +%endif mkdir -p %{buildroot}%{_localstatedir}/log/salt mkdir -p %{buildroot}/%{_sysconfdir}/logrotate.d/ mkdir -p %{buildroot}/%{_sbindir} @@ -164,18 +177,19 @@ mkdir -p %{buildroot}/srv/salt mkdir -p %{buildroot}/srv/pillar # ## install init scripts +%if 0%{?_unitdir:1} +install -Dpm 0644 %{SOURCE4} %{buildroot}%_unitdir/salt-master.service +install -Dpm 0644 %{SOURCE5} %{buildroot}%_unitdir/salt-syndic.service +install -Dpm 0644 %{SOURCE6} %{buildroot}%_unitdir/salt-minion.service +%else install -Dpm 0755 %{SOURCE1} %{buildroot}%{_initddir}/salt-master install -Dpm 0755 %{SOURCE2} %{buildroot}%{_initddir}/salt-syndic install -Dpm 0755 %{SOURCE3} %{buildroot}%{_initddir}/salt-minion ln -sf %{_initddir}/salt-master %{buildroot}%{_sbindir}/rcsalt-master ln -sf %{_initddir}/salt-syndic %{buildroot}%{_sbindir}/rcsalt-syndic ln -sf %{_initddir}/salt-minion %{buildroot}%{_sbindir}/rcsalt-minion - -%if 0%{?_unitdir:1} -install -Dpm 0644 %{SOURCE4} %{buildroot}%_unitdir/salt-master.service -install -Dpm 0644 %{SOURCE5} %{buildroot}%_unitdir/salt-syndic.service -install -Dpm 0644 %{SOURCE6} %{buildroot}%_unitdir/salt-minion.service %endif + # ## install config files install -Dpm 0644 conf/minion %{buildroot}%{_sysconfdir}/salt/minion @@ -191,61 +205,73 @@ install -Dpm 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2 %{__python} setup.py test --runtests-opts=-u %preun -n salt-syndic -%stop_on_removal salt-syndic %if 0%{?_unitdir:1} %service_del_preun salt-syndic.service +%else +%stop_on_removal salt-syndic %endif %post -n salt-syndic -%fillup_and_insserv %if 0%{?_unitdir:1} %service_add_post salt-syndic.service +%fillup_only +%else +%fillup_and_insserv %endif %postun -n salt-syndic -%restart_on_update salt-syndic %if 0%{?_unitdir:1} %service_del_postun salt-syndic.service -%endif +%else %insserv_cleanup +%restart_on_update salt-syndic +%endif %preun -n salt-master -%stop_on_removal salt-master %if 0%{?_unitdir:1} %service_del_preun salt-master.service +%else +%stop_on_removal salt-master %endif %post -n salt-master -%fillup_and_insserv %if 0%{?_unitdir:1} %service_add_post salt-master.service +%fillup_only +%else +%fillup_and_insserv %endif %postun -n salt-master -%restart_on_update salt-master %if 0%{?_unitdir:1} %service_del_postun salt-master.service -%endif +%else +%restart_on_update salt-master %insserv_cleanup +%endif %preun -n salt-minion -%stop_on_removal salt-minion %if 0%{?_unitdir:1} %service_del_preun salt-minion.service +%else +%stop_on_removal salt-minion %endif %post -n salt-minion -%fillup_and_insserv %if 0%{?_unitdir:1} %service_add_post salt-minion.service +%fillup_only +%else +%fillup_and_insserv %endif %postun -n salt-minion -%restart_on_update salt-minion %if 0%{?_unitdir:1} %service_del_postun salt-minion.service -%endif +%else %insserv_cleanup +%restart_on_update salt-minion +%endif %files -n salt-ssh %defattr(-,root,root) @@ -256,22 +282,24 @@ install -Dpm 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2 %defattr(-,root,root) %{_bindir}/salt-syndic %{_mandir}/man1/salt-syndic.1.gz -%{_sbindir}/rcsalt-syndic -%{_sysconfdir}/init.d/salt-syndic %if 0%{?_unitdir:1} %_unitdir/salt-syndic.service +%else +%{_sbindir}/rcsalt-syndic +%{_sysconfdir}/init.d/salt-syndic %endif %files -n salt-minion %defattr(-,root,root) %{_bindir}/salt-minion %{_mandir}/man1/salt-minion.1.gz -%{_sbindir}/rcsalt-minion -%config(noreplace) %{_sysconfdir}/init.d/salt-minion %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/salt/minion %{_sysconfdir}/salt/minion.d %if 0%{?_unitdir:1} %_unitdir/salt-minion.service +%else +%{_sbindir}/rcsalt-minion +%config(noreplace) %{_sysconfdir}/init.d/salt-minion %endif %files -n salt-master @@ -286,8 +314,6 @@ install -Dpm 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2 %{_mandir}/man1/salt-cp.1.gz %{_mandir}/man1/salt-key.1.gz %{_mandir}/man1/salt-run.1.gz -%{_sbindir}/rcsalt-master -%config(noreplace) %{_sysconfdir}/init.d/salt-master %config(noreplace) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/salt %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/salt/master %{_sysconfdir}/salt/master.d @@ -295,6 +321,9 @@ install -Dpm 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2 %dir /srv/pillar %if 0%{?_unitdir:1} %_unitdir/salt-master.service +%else +%{_sbindir}/rcsalt-master +%config(noreplace) %{_sysconfdir}/init.d/salt-master %endif %files