文章目录

Zabbix RPM制作,spec文件参考

%define zabbix_agent_etc /etc/zabbix
%define zabbix_agent_bin /usr/local/zabbix_agent/bin
%define zabbix_agent_sbin /usr/local/zabbix_agent/sbin

Summary: zabbix agent
Name: zabbix_agent
Version: 1.8.6
Release: 0
#Source0: %{name}-%{version}.tar.gz
License: MIT
Group: Applications/Internet
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#for install
#BuildRequires:
# for /sbin/service
Requires(preun):    chkconfig, initscripts
Requires(postun):   initscripts

Source0:    %{name}d.conf
Source1:    zabbix_get
Source2:    zabbix_sender
Source3:    zabbix_agent
Source4:    zabbix_agentd
Source5:    zabbix_agentd.init

%description
zabbix_agent

%prep
%build
mkdir -p %{buildroot}%{zabbix_agent_etc}
mkdir -p %{buildroot}%{zabbix_agent_bin}
mkdir -p %{buildroot}%{zabbix_agent_sbin}

%install
%{__install} -p -m 0644 %{SOURCE0} %{buildroot}%{zabbix_agent_etc}
%{__install} -p -m 0644 %{SOURCE1} %{buildroot}%{zabbix_agent_bin}
%{__install} -p -m 0644 %{SOURCE2} %{buildroot}%{zabbix_agent_bin}
%{__install} -p -m 0644 %{SOURCE3} %{buildroot}%{zabbix_agent_sbin}
%{__install} -p -m 0755 %{SOURCE4} %{buildroot}%{zabbix_agent_sbin}
%{__install} -p -D -m 0755 %{SOURCE5} %{buildroot}%{_initrddir}/%{name}d

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{zabbix_agent_bin}/zabbix_get
%{zabbix_agent_bin}/zabbix_sender
%{zabbix_agent_sbin}/zabbix_agent
%{zabbix_agent_sbin}/zabbix_agentd
%dir %{zabbix_agent_etc}
%{zabbix_agent_etc}/%{name}d.conf
%{_initrddir}/%{name}d
文章目录