3 # - https://github.com/draios/sysdig/wiki/How-to-Install-Sysdig-from-the-Source-Code
6 %bcond_without kernel # kernel modules
7 %bcond_without userspace # userspace packages
8 %bcond_without dkms # DKMS package
9 %bcond_without luajit # use plain lua5.1 instead of luajit
11 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
12 %{error:kernel and userspace cannot be built at the same time on PLD builders}
16 %if %{without userspace}
18 # nothing to be placed to debuginfo package
19 %define _enable_debug_packages 0
24 Summary: sysdig, a system-level exploration and troubleshooting tool
25 Summary(pl.UTF-8): sysdig - narzędzie do przeglądu i rozwiązywania problemów na poziomie systemowym
26 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
28 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
30 Group: Applications/System
31 #Source0Download: https://github.com/draios/sysdig/releases
32 Source0: https://github.com/draios/sysdig/archive/%{version}/%{pname}-%{version}.tar.gz
33 # Source0-md5: a8658daee5277d2a3a0bbb8381fb020f
34 Patch0: buildflags.patch
35 Patch1: %{pname}-linux4.patch
36 URL: http://www.sysdig.org/
37 BuildRequires: rpmbuild(macros) >= 1.701
38 BuildRequires: cmake >= 2.8.2
39 BuildRequires: curl-devel >= 7.45.0
40 BuildRequires: jq-devel >= 1.5
41 BuildRequires: jsoncpp-devel
42 BuildRequires: libb64-devel >= 1.2.1
43 BuildRequires: libstdc++-devel >= 6:4.4
44 %{!?with_luajit:BuildRequires: lua5.1-devel >= 5.1}
45 %{?with_luajit:BuildRequires: luajit-devel >= 2.0.3}
46 BuildRequires: ncurses-devel >= 5.9
47 BuildRequires: openssl-devel >= 1.0.2
48 BuildRequires: zlib-devel >= 1.2.8
49 %{!?with_luajit:BuildConflicts: luajit-devel}
50 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
52 ExclusiveArch: %{ix86} %{x8664}
54 ExclusiveArch: %{ix86} %{x8664} x32
56 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 %{expand:%%global name %{pname}}
61 %define zshdir %{_datadir}/zsh/site-functions
64 Sysdig instruments your physical and virtual machines at the OS level
65 by installing into the Linux kernel and capturing system calls and
66 other OS events. Then, using sysdig's command line interface, you can
67 filter and decode these events in order to extract useful information.
68 Sysdig can be used to inspect systems live in real-time, or to
69 generate trace files that can be analyzed at a later stage.
71 %description -l pl.UTF-8
72 Sysdig obsługuje maszyny fizyczne i wirtualne na poziomie systemu
73 operacyjnego, instalując się w jądrze Linuksa i przechwytując
74 wywołania systemowe oraz inne zdarzenia systemu. Następnie, przy
75 użyciu interfejsu linii poleceń sysdiga można odfiltrować i zdekodować
76 te zdarzenia, aby wydobyć z nich przydatne informacje. Sysdiga można
77 używać do dozorowania systemów w czasie rzeczywistym albo generowania
78 plików śladów do późniejszej analizy.
80 %package -n dkms-%{name}
81 Summary: DKMS-ready driver for sysdig
82 Summary(pl.UTF-8): Sterownik sysdiga zgodny z DKMS
85 Requires(pre,post): dkms >= 2.1.0.0
86 %if "%{_rpmversion}" >= "5"
90 %description -n dkms-%{name}
91 This package contains a DKMS-ready driver for sysdig.
93 %description -n dkms-%{name} -l pl.UTF-8
94 Ten pakiet zawiera sterownik sysdiga w postaci zgodnej z DKMS.
96 %package -n bash-completion-%{name}
97 Summary: bash-completion for sysdig command
98 Summary(pl.UTF-8): Bashowe dopełnianie składni polecenia sysdig
99 Group: Applications/Shells
100 Requires: %{name} = %{version}-%{rel}
101 Requires: bash-completion
102 %if "%{_rpmversion}" >= "5"
106 %description -n bash-completion-%{name}
107 bash-completion for sysdig command.
109 %description -n bash-completion-%{name} -l pl.UTF-8
110 Bashowe dopełnianie składni polecenia sysdig.
112 %package -n zsh-completion-%{name}
113 Summary: zsh-completion for sysdig command
114 Summary(pl.UTF-8): Dopełnianie składni polecenia sysdig w powłoce zsh
115 Group: Applications/Shells
116 Requires: %{name} = %{version}-%{rel}
117 %if "%{_rpmversion}" >= "5"
121 %description -n zsh-completion-%{name}
122 zsh-completion for sysdig command.
124 %description -n zsh-completion-%{name} -l pl.UTF-8
125 Dopełnianie składni polecenia sysdig w powłoce zsh.
127 %define kernel_pkg()\
128 %package -n kernel%{_alt_kernel}-misc-%{pname}\
129 Summary: Linux driver for sysdig\
130 Summary(pl.UTF-8): Sterownik jądra Linuksa dla sysdiga\
131 Release: %{rel}@%{_kernel_ver_str}\
133 Requires(post,postun): /sbin/depmod\
134 %requires_releq_kernel\
135 Requires(postun): %releq_kernel\
137 %description -n kernel%{_alt_kernel}-misc-%{pname}\
138 This is sysdig-probe module for Linux.\
140 %description -n kernel%{_alt_kernel}-misc-%{pname} -l pl.UTF-8\
141 Ten pakiet zawiera moduł sysdig-probe for jądra Linuksa.\
144 %files -n kernel%{_alt_kernel}-misc-%{pname}\
145 %defattr(644,root,root,755)\
146 /lib/modules/%{_kernel_ver}/misc/*.ko*\
149 %post -n kernel%{_alt_kernel}-misc-%{pname}\
150 %depmod %{_kernel_ver}\
152 %postun -n kernel%{_alt_kernel}-misc-%{pname}\
153 %depmod %{_kernel_ver}\
156 %define build_kernel_pkg()\
157 %build_kernel_modules -C driver -m sysdig-probe\
158 %install_kernel_modules -D installed -m driver/sysdig-probe -d misc\
161 %{?with_kernel:%{expand:%create_kernel_packages}}
164 %setup -q -n %{pname}-%{version}
172 -DDIR_ETC=%{_sysconfdir} \
173 -DSYSDIG_VERSION=%{version}-%{rel} \
175 -DUSE_BUNDLED_B64=OFF \
176 -DUSE_BUNDLED_CURL=OFF \
177 -DUSE_BUNDLED_JQ=OFF \
178 -DUSE_BUNDLED_JSONCPP=OFF \
179 -DUSE_BUNDLED_LUAJIT=OFF \
180 -DUSE_BUNDLED_NCURSES=OFF \
181 -DUSE_BUNDLED_OPENSSL=OFF \
182 -DUSE_BUNDLED_ZLIB=OFF
186 cp -f build/driver/Makefile.dkms driver/Makefile
187 %{expand:%build_kernel_packages}
190 %if %{with userspace}
195 rm -rf $RPM_BUILD_ROOT
197 %if %{with userspace}
198 %{__make} -C build install \
199 DESTDIR=$RPM_BUILD_ROOT
201 # already installed as %{zshdir}/_sysdig
202 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zsh/vendor-completions/_sysdig
206 install -d $RPM_BUILD_ROOT
207 cp -a installed/* $RPM_BUILD_ROOT
211 rm -rf $RPM_BUILD_ROOT
213 %post -n dkms-%{name}
214 %{_sbindir}/dkms add -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade && \
215 %{_sbindir}/dkms build -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade && \
216 %{_sbindir}/dkms install -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade || :
218 %preun -n dkms-%{name}
219 %{_sbindir}/dkms remove -m %{name} -v %{version}-%{rel} --rpm_safe_upgrade --all || :
221 %if %{with userspace}
223 %defattr(644,root,root,755)
225 %attr(755,root,root) %{_bindir}/csysdig
226 %attr(755,root,root) %{_bindir}/sysdig
227 %attr(755,root,root) %{_bindir}/sysdig-probe-loader
228 %{_mandir}/man8/csysdig.8*
229 %{_mandir}/man8/sysdig.8*
232 %files -n bash-completion-%{name}
233 %defattr(644,root,root,755)
234 /etc/bash_completion.d/sysdig
236 %files -n zsh-completion-%{name}
237 %defattr(644,root,root,755)
242 %files -n dkms-%{name}
243 %defattr(644,root,root,755)
244 %{_usrsrc}/%{name}-%{version}-%{rel}