2 # spec file for package agl-xds-agent
5 %define _prefix /opt/AGL
6 %global debug_package %{nil}
12 Summary: XDS agent/client tool
13 Url: https://github.com/iotbzh/xds-agent.git
14 Source0: xds-agent_linux-amd64-v%{version}_2018-04-05_112625.zip
16 BuildRoot: %{_tmppath}/%{name}-%{version}-build
18 # currently embedded with xds
23 XDS-agent is an client tool that must run on your local machine when you use XDS
26 %setup -q -n xds-agent
31 mkdir -p %{?buildroot}%{_prefix}/xds/agent %{?buildroot}%{_bindir}
32 cp -r * %{?buildroot}%{_prefix}/xds/agent
33 rm -rf %{?buildroot}%{_prefix}/xds/agent/conf.d
34 ln -s ../xds/agent/xds-agent %{?buildroot}%{_bindir}/xds-agent
36 mkdir -p %{?buildroot}%{_userunitdir}
37 cp ./conf.d/usr/lib/systemd/user/xds-agent.service %{?buildroot}%{_userunitdir}
39 mkdir -p %{?buildroot}/%{_sysconfdir}/default
40 cp ./conf.d/etc/default/xds-agent %{?buildroot}/%{_sysconfdir}/default/
42 mkdir -p %{?buildroot}/%{_sysconfdir}/xds/agent
43 cp ./conf.d/etc/xds/agent/* %{?buildroot}/%{_sysconfdir}/xds/agent/
45 mkdir -p %{?buildroot}%{_sysconfdir}/profile.d
46 sed -e "s;@XDS_INSTALL_BIN_DIR@;%{_bindir};g" ./conf.d/etc/profile.d/xds-agent.sh > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
54 %dir %{_prefix}/xds/agent
55 %{_prefix}/xds/agent/*
57 %dir %{_sysconfdir}/xds
58 %dir %{_sysconfdir}/xds/agent
59 %config %{_sysconfdir}/default/xds-agent
60 %config %{_sysconfdir}/xds/agent/agent-config.json
61 %config %{_sysconfdir}/profile.d/%{name}.sh
63 %{_userunitdir}/xds-agent.service
66 if [ "$1" -ge 2 ]; then
67 if [ -f "${_sysconfdir}/xds-agent/config.json" ]; then
68 install -b -S .rpmsave ${_sysconfdir}/xds-agent/config.json ${_sysconfdir}/xds/agent/agent-config.json
74 if [ "$1" -ge 2 ]; then
75 rm -f %{_sysconfdir}/xds-agent/*.rpm*