summaryrefslogtreecommitdiffstats
path: root/conf.d/packaging/rpm/agl-xds-agent.spec
blob: 66373c42a3d3dc4a8f2810ed3397fb07a911418c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# spec file for package agl-xds-agent
#

%define _prefix /opt/AGL
%global debug_package %{nil}

Name:           agl-xds-agent
Version:        0.0.0
Release:        0
License:        Apache-2.0
Summary:        XDS agent/client tool
Url:            https://gerrit.automotivelinux.org/gerrit/p/src/xds/xds-agent.git
Source0:        xds-agent_linux-amd64-%{version}.zip
BuildRequires:  unzip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Group:          Development/Tools/Debuggers

# currently embedded with xds
# Requires:       syncthing


%description
XDS-agent is an client tool that must run on your local machine when you use XDS

%prep
%setup -q -n xds-agent

%build

%install
mkdir -p %{?buildroot}%{_prefix}/xds/agent %{?buildroot}%{_bindir}
cp -r * %{?buildroot}%{_prefix}/xds/agent
rm -rf %{?buildroot}%{_prefix}/xds/agent/conf.d
ln -s ../xds/agent/xds-agent %{?buildroot}%{_bindir}/xds-agent

mkdir -p %{?buildroot}%{_userunitdir}
cp ./conf.d/usr/lib/systemd/user/xds-agent.service %{?buildroot}%{_userunitdir}

mkdir -p %{?buildroot}/%{_sysconfdir}/default
cp ./conf.d/etc/default/xds-agent %{?buildroot}/%{_sysconfdir}/default/

mkdir -p %{?buildroot}/%{_sysconfdir}/xds/agent
cp ./conf.d/etc/xds/agent/* %{?buildroot}/%{_sysconfdir}/xds/agent/

mkdir -p %{?buildroot}%{_sysconfdir}/profile.d
sed -e "s;@XDS_INSTALL_BIN_DIR@;%{_bindir};g" ./conf.d/etc/profile.d/xds-agent.sh > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh


%files
%defattr(-,root,root)
%dir %{_prefix}
%dir %{_bindir}
%dir %{_prefix}/xds
%dir %{_prefix}/xds/agent
%{_prefix}/xds/agent/*
%{_bindir}/xds-agent
%dir %{_sysconfdir}/xds
%dir %{_sysconfdir}/xds/agent
%config %{_sysconfdir}/default/xds-agent
%config %{_sysconfdir}/xds/agent/agent-config.json
%config %{_sysconfdir}/profile.d/%{name}.sh
%dir %{_userunitdir}
%{_userunitdir}/xds-agent.service

%post
if [ "$1" -ge 2 ]; then
  if [ -f "${_sysconfdir}/xds-agent/config.json" ]; then
    install -b -S .rpmsave ${_sysconfdir}/xds-agent/config.json ${_sysconfdir}/xds/agent/agent-config.json
  fi
fi
exit 0

%preun
if [ "$1" -ge 2 ]; then
  rm -f %{_sysconfdir}/xds-agent/*.rpm*
fi
exit 0