salt.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. # Maintainer: Erik Johnson (https://github.com/terminalmage)
  2. #
  3. # This is a modified version of the spec file, which supports git builds. It
  4. # should be kept more or less up-to-date with upstream changes.
  5. #
  6. # Please contact the maintainer before submitting any pull requests for this
  7. # spec file.
  8. %if ! (0%{?rhel} >= 6 || 0%{?fedora} > 12)
  9. %global with_python26 1
  10. %define pybasever 2.6
  11. %define __python_ver 26
  12. %define __python %{_bindir}/python%{?pybasever}
  13. %endif
  14. %global include_tests 0
  15. %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
  16. %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
  17. %{!?pythonpath: %global pythonpath %(%{__python} -c "import os, sys; print(os.pathsep.join(x for x in sys.path if x))")}
  18. %global srcver REPLACE_ME
  19. Name: salt
  20. Version: REPLACE_ME
  21. Release: 1%{?dist}
  22. Summary: A parallel remote execution system
  23. Group: System Environment/Daemons
  24. License: ASL 2.0
  25. URL: http://saltstack.org/
  26. Source0: %{name}-%{srcver}.tar.gz
  27. Source1: %{name}-master
  28. Source2: %{name}-syndic
  29. Source3: %{name}-minion
  30. Source4: %{name}-api
  31. Source5: %{name}-master.service
  32. Source6: %{name}-syndic.service
  33. Source7: %{name}-minion.service
  34. Source8: %{name}-api.service
  35. Source9: README.fedora
  36. Source10: logrotate.salt
  37. Source11: salt.bash
  38. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  39. BuildArch: noarch
  40. %ifarch %{ix86} x86_64
  41. Requires: dmidecode
  42. %endif
  43. Requires: pciutils
  44. Requires: which
  45. Requires: yum-utils
  46. %if 0%{?with_python26}
  47. BuildRequires: python26-devel
  48. Requires: python26-crypto >= 2.6.1
  49. Requires: python26-jinja2
  50. Requires: python26-msgpack > 0.3
  51. Requires: python26-PyYAML
  52. Requires: python26-tornado >= 4.2.1
  53. Requires: python26-zmq
  54. Requires: python26-six
  55. %else
  56. %if ((0%{?rhel} >= 6 || 0%{?fedora} > 12) && 0%{?include_tests})
  57. BuildRequires: python-tornado >= 4.2.1
  58. BuildRequires: python-futures >= 2.0
  59. BuildRequires: python-crypto >= 2.6.1
  60. BuildRequires: python-jinja2
  61. BuildRequires: python-msgpack > 0.3
  62. BuildRequires: python-pip
  63. BuildRequires: python-zmq
  64. BuildRequires: PyYAML
  65. # this BR causes windows tests to happen
  66. # clearly, that's not desired
  67. # https://github.com/saltstack/salt/issues/3749
  68. BuildRequires: git
  69. BuildRequires: python-libcloud
  70. BuildRequires: python-six
  71. %endif
  72. BuildRequires: python-devel
  73. Requires: m2crypto
  74. Requires: python-crypto
  75. Requires: python-zmq
  76. Requires: python-jinja2
  77. Requires: PyYAML
  78. Requires: python-msgpack
  79. Requires: python-requests
  80. %endif
  81. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  82. Requires(post): chkconfig
  83. Requires(preun): chkconfig
  84. Requires(preun): initscripts
  85. Requires(postun): initscripts
  86. %else
  87. %if 0%{?systemd_preun:1}
  88. Requires(post): systemd-units
  89. Requires(preun): systemd-units
  90. Requires(postun): systemd-units
  91. %endif
  92. BuildRequires: systemd-units
  93. Requires: systemd-python
  94. %endif
  95. %description
  96. Salt is a distributed remote execution system used to execute commands and
  97. query data. It was developed in order to bring the best solutions found in
  98. the world of remote execution together and make them better, faster and more
  99. malleable. Salt accomplishes this via its ability to handle larger loads of
  100. information, and not just dozens, but hundreds or even thousands of individual
  101. servers, handle them quickly and through a simple and manageable interface.
  102. %package master
  103. Summary: Management component for salt, a parallel remote execution system
  104. Group: System Environment/Daemons
  105. Requires: %{name} = %{version}-%{release}
  106. %if (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  107. Requires: systemd-python
  108. %endif
  109. %description master
  110. The Salt master is the central server to which all minions connect.
  111. %package minion
  112. Summary: Client component for Salt, a parallel remote execution system
  113. Group: System Environment/Daemons
  114. Requires: %{name} = %{version}-%{release}
  115. %description minion
  116. The Salt minion is the agent component of Salt. It listens for instructions
  117. from the master, runs jobs, and returns results back to the master.
  118. %package syndic
  119. Summary: Master-of-master component for Salt, a parallel remote execution system
  120. Group: System Environment/Daemons
  121. Requires: %{name}-master = %{version}-%{release}
  122. %description syndic
  123. The Salt syndic is a master daemon which can receive instruction from a
  124. higher-level master, allowing for tiered organization of your Salt
  125. infrastructure.
  126. %package api
  127. Summary: REST API for Salt, a parallel remote execution system
  128. Group: System administration tools
  129. Requires: %{name}-master = %{version}-%{release}
  130. %if 0%{?with_python26}
  131. Requires: python26-cherrypy
  132. %else
  133. Requires: python-cherrypy
  134. %endif
  135. %description api
  136. salt-api provides a REST interface to the Salt master.
  137. %package cloud
  138. Summary: Cloud provisioner for Salt, a parallel remote execution system
  139. Group: System administration tools
  140. Requires: %{name}-master = %{version}-%{release}
  141. %if 0%{?with_python26}
  142. Requires: python26-libcloud
  143. %else
  144. Requires: python-libcloud
  145. %endif
  146. %description cloud
  147. The salt-cloud tool provisions new cloud VMs, installs salt-minion on them, and
  148. adds them to the master's collection of controllable minions.
  149. %package ssh
  150. Summary: Agentless SSH-based version of Salt, a parallel remote execution system
  151. Group: System administration tools
  152. Requires: %{name} = %{version}-%{release}
  153. %description ssh
  154. The salt-ssh tool can run remote execution functions and states without the use
  155. of an agent (salt-minion) service.
  156. %prep
  157. %setup -n %{name}-%{srcver}
  158. %build
  159. %install
  160. rm -rf %{buildroot}
  161. %{__python} setup.py install -O1 --root %{buildroot}
  162. # Add some directories
  163. install -d -m 0755 %{buildroot}%{_var}/log/salt
  164. touch %{buildroot}%{_var}/log/salt/minion
  165. touch %{buildroot}%{_var}/log/salt/master
  166. install -d -m 0755 %{buildroot}%{_var}/cache/salt
  167. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt
  168. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/master.d
  169. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/minion.d
  170. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/pki
  171. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/pki/master
  172. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/pki/minion
  173. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.conf.d
  174. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.deploy.d
  175. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.maps.d
  176. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.profiles.d
  177. install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.providers.d
  178. # Add the config files
  179. install -p -m 0640 conf/minion %{buildroot}%{_sysconfdir}/salt/minion
  180. install -p -m 0640 conf/master %{buildroot}%{_sysconfdir}/salt/master
  181. install -p -m 0640 conf/cloud %{buildroot}%{_sysconfdir}/salt/cloud
  182. install -p -m 0640 conf/roster %{buildroot}%{_sysconfdir}/salt/roster
  183. install -p -m 0640 conf/proxy %{buildroot}%{_sysconfdir}/salt/proxy
  184. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  185. mkdir -p %{buildroot}%{_initrddir}
  186. install -p %{SOURCE1} %{buildroot}%{_initrddir}/
  187. install -p %{SOURCE2} %{buildroot}%{_initrddir}/
  188. install -p %{SOURCE3} %{buildroot}%{_initrddir}/
  189. install -p %{SOURCE4} %{buildroot}%{_initrddir}/
  190. %else
  191. mkdir -p %{buildroot}%{_unitdir}
  192. install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/
  193. install -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/
  194. install -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/
  195. install -p -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/
  196. %endif
  197. # Force python2.6 on EPEL6
  198. # https://github.com/saltstack/salt/issues/22003
  199. %if 0%{?rhel} == 6
  200. sed -i 's#/usr/bin/python#/usr/bin/python2.6#g' %{buildroot}%{_bindir}/salt*
  201. sed -i 's#/usr/bin/python#/usr/bin/python2.6#g' %{buildroot}%{_initrddir}/salt*
  202. %endif
  203. install -p %{SOURCE9} .
  204. # Logrotate
  205. mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/
  206. install -p %{SOURCE10} %{buildroot}%{_sysconfdir}/logrotate.d/salt
  207. # Bash completion
  208. mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
  209. install -p -m 0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/bash_completion.d/salt.bash
  210. %clean
  211. rm -rf %{buildroot}
  212. %files
  213. %defattr(-,root,root,-)
  214. %doc LICENSE
  215. %doc %{_mandir}/man1/spm.1.*
  216. %{python_sitelib}/%{name}/*
  217. %{python_sitelib}/%{name}-*-py?.?.egg-info
  218. %{_sysconfdir}/logrotate.d/salt
  219. %{_sysconfdir}/bash_completion.d/salt.bash
  220. %{_var}/cache/salt
  221. %{_var}/log/salt
  222. %doc README.fedora
  223. %{_bindir}/spm
  224. %config(noreplace) %{_sysconfdir}/salt/
  225. %config(noreplace) %{_sysconfdir}/salt/pki
  226. %files master
  227. %defattr(-,root,root)
  228. %doc %{_mandir}/man7/salt.7.*
  229. %doc %{_mandir}/man1/salt-cp.1.*
  230. %doc %{_mandir}/man1/salt-key.1.*
  231. %doc %{_mandir}/man1/salt-master.1.*
  232. %doc %{_mandir}/man1/salt-run.1.*
  233. %doc %{_mandir}/man1/salt-unity.1.*
  234. %{_bindir}/salt
  235. %{_bindir}/salt-cp
  236. %{_bindir}/salt-key
  237. %{_bindir}/salt-master
  238. %{_bindir}/salt-run
  239. %{_bindir}/salt-unity
  240. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  241. %attr(0755, root, root) %{_initrddir}/salt-master
  242. %else
  243. %{_unitdir}/salt-master.service
  244. %endif
  245. %config(noreplace) %{_sysconfdir}/salt/master
  246. %config(noreplace) %{_sysconfdir}/salt/master.d
  247. %config(noreplace) %{_sysconfdir}/salt/pki/master
  248. %config(noreplace) %{_var}/log/salt/master
  249. %files minion
  250. %defattr(-,root,root)
  251. %doc %{_mandir}/man1/salt-call.1.*
  252. %doc %{_mandir}/man1/salt-minion.1.*
  253. %doc %{_mandir}/man1/salt-proxy.1.*
  254. %{_bindir}/salt-minion
  255. %{_bindir}/salt-call
  256. %{_bindir}/salt-proxy
  257. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  258. %attr(0755, root, root) %{_initrddir}/salt-minion
  259. %else
  260. %{_unitdir}/salt-minion.service
  261. %endif
  262. %config(noreplace) %{_sysconfdir}/salt/minion
  263. %config(noreplace) %{_sysconfdir}/salt/proxy
  264. %config(noreplace) %{_sysconfdir}/salt/minion.d
  265. %config(noreplace) %{_sysconfdir}/salt/pki/minion
  266. %config(noreplace) %{_var}/log/salt/minion
  267. %files syndic
  268. %doc %{_mandir}/man1/salt-syndic.1.*
  269. %{_bindir}/salt-syndic
  270. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  271. %attr(0755, root, root) %{_initrddir}/salt-syndic
  272. %else
  273. %{_unitdir}/salt-syndic.service
  274. %endif
  275. %files api
  276. %defattr(-,root,root)
  277. %doc %{_mandir}/man1/salt-api.1.*
  278. %{_bindir}/salt-api
  279. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  280. %attr(0755, root, root) %{_initrddir}/salt-api
  281. %else
  282. %{_unitdir}/salt-api.service
  283. %endif
  284. %files cloud
  285. %doc %{_mandir}/man1/salt-cloud.1.*
  286. %{_bindir}/salt-cloud
  287. %{_sysconfdir}/salt/cloud.conf.d
  288. %{_sysconfdir}/salt/cloud.deploy.d
  289. %{_sysconfdir}/salt/cloud.maps.d
  290. %{_sysconfdir}/salt/cloud.profiles.d
  291. %{_sysconfdir}/salt/cloud.providers.d
  292. %config(noreplace) %{_sysconfdir}/salt/cloud
  293. %files ssh
  294. %doc %{_mandir}/man1/salt-ssh.1.*
  295. %{_bindir}/salt-ssh
  296. %config(noreplace) %{_sysconfdir}/salt/roster
  297. # less than RHEL 8 / Fedora 16
  298. # not sure if RHEL 7 will use systemd yet
  299. %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
  300. %preun master
  301. if [ $1 -eq 0 ] ; then
  302. /sbin/service salt-master stop >/dev/null 2>&1
  303. /sbin/chkconfig --del salt-master
  304. fi
  305. %preun syndic
  306. if [ $1 -eq 0 ] ; then
  307. /sbin/service salt-syndic stop >/dev/null 2>&1
  308. /sbin/chkconfig --del salt-syndic
  309. fi
  310. %preun minion
  311. if [ $1 -eq 0 ] ; then
  312. /sbin/service salt-minion stop >/dev/null 2>&1
  313. /sbin/chkconfig --del salt-minion
  314. fi
  315. %post master
  316. /sbin/chkconfig --add salt-master
  317. %post minion
  318. /sbin/chkconfig --add salt-minion
  319. %postun master
  320. if [ "$1" -ge "1" ] ; then
  321. /sbin/service salt-master condrestart >/dev/null 2>&1 || :
  322. fi
  323. %postun syndic
  324. if [ "$1" -ge "1" ] ; then
  325. /sbin/service salt-syndic condrestart >/dev/null 2>&1 || :
  326. fi
  327. %postun minion
  328. if [ "$1" -ge "1" ] ; then
  329. /sbin/service salt-minion condrestart >/dev/null 2>&1 || :
  330. fi
  331. %else
  332. %preun master
  333. %if 0%{?systemd_preun:1}
  334. %systemd_preun salt-master.service
  335. %else
  336. if [ $1 -eq 0 ] ; then
  337. # Package removal, not upgrade
  338. /bin/systemctl --no-reload disable salt-master.service > /dev/null 2>&1 || :
  339. /bin/systemctl stop salt-master.service > /dev/null 2>&1 || :
  340. fi
  341. %endif
  342. %preun syndic
  343. %if 0%{?systemd_preun:1}
  344. %systemd_preun salt-syndic.service
  345. %else
  346. if [ $1 -eq 0 ] ; then
  347. # Package removal, not upgrade
  348. /bin/systemctl --no-reload disable salt-syndic.service > /dev/null 2>&1 || :
  349. /bin/systemctl stop salt-syndic.service > /dev/null 2>&1 || :
  350. fi
  351. %endif
  352. %preun minion
  353. %if 0%{?systemd_preun:1}
  354. %systemd_preun salt-minion.service
  355. %else
  356. if [ $1 -eq 0 ] ; then
  357. # Package removal, not upgrade
  358. /bin/systemctl --no-reload disable salt-minion.service > /dev/null 2>&1 || :
  359. /bin/systemctl stop salt-minion.service > /dev/null 2>&1 || :
  360. fi
  361. %endif
  362. %post master
  363. %if 0%{?systemd_post:1}
  364. %systemd_post salt-master.service
  365. %else
  366. /bin/systemctl daemon-reload &>/dev/null || :
  367. %endif
  368. %post minion
  369. %if 0%{?systemd_post:1}
  370. %systemd_post salt-minion.service
  371. %else
  372. /bin/systemctl daemon-reload &>/dev/null || :
  373. %endif
  374. %postun master
  375. %if 0%{?systemd_post:1}
  376. %systemd_postun salt-master.service
  377. %else
  378. /bin/systemctl daemon-reload &>/dev/null
  379. [ $1 -gt 0 ] && /bin/systemctl try-restart salt-master.service &>/dev/null || :
  380. %endif
  381. %postun syndic
  382. %if 0%{?systemd_post:1}
  383. %systemd_postun salt-syndic.service
  384. %else
  385. /bin/systemctl daemon-reload &>/dev/null
  386. [ $1 -gt 0 ] && /bin/systemctl try-restart salt-syndic.service &>/dev/null || :
  387. %endif
  388. %postun minion
  389. %if 0%{?systemd_post:1}
  390. %systemd_postun salt-minion.service
  391. %else
  392. /bin/systemctl daemon-reload &>/dev/null
  393. [ $1 -gt 0 ] && /bin/systemctl try-restart salt-minion.service &>/dev/null || :
  394. %endif
  395. %endif