aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/packaging/rpm/agl-xds-server.spec
blob: ee59be1f982fc5ee724393726b480ff4e14523e2 (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
79
80
#
# spec file for package agl-xds-server
#

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

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

# for now still embedded with xds
# Requires:       syncthing

%description
xds-server is a web server that allows user to remotely cross build applications.

%prep
%setup -q -n xds-server

%build

%install
mkdir -p %{?buildroot}%{_prefix}/xds/server %{?buildroot}%{_bindir}
cp -r * %{?buildroot}%{_prefix}/xds/server/
rm -rf %{?buildroot}%{_prefix}/xds/server/conf.d
ln -s ../xds/server/xds-server        %{?buildroot}%{_bindir}/xds-server
ln -s ../xds/server/syncthing         %{?buildroot}%{_bindir}/syncthing
ln -s ../xds/server/syncthing-inotify %{?buildroot}%{_bindir}/syncthing-inotify
mkdir -p %{?buildroot}%{_userunitdir}
cp ./conf.d/usr/lib/systemd/user/xds-server.service %{?buildroot}%{_userunitdir}
mkdir -p %{?buildroot}/%{_sysconfdir}/default
cp ./conf.d/etc/default/xds-server %{?buildroot}/%{_sysconfdir}/default/
mkdir -p %{?buildroot}/%{_sysconfdir}/xds/server
cp ./conf.d/etc/xds/server/* %{?buildroot}/%{_sysconfdir}/xds/server/
mkdir -p %{?buildroot}%{_userunitdir}/default.target.wants && ln -s ../xds-server.service %{?buildroot}%{_userunitdir}/default.target.wants/
mkdir -p %{?buildroot}%{_sysconfdir}/profile.d
sed -e "s;@XDS_INSTALL_BIN_DIR@;%{_bindir};g" ./conf.d/etc/profile.d/xds-server.sh > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh

%files
%defattr(-,root,root)
%dir %{_prefix}
%dir %{_bindir}
%dir %{_prefix}/xds
%dir %{_prefix}/xds/server
%{_prefix}/xds/server/*
%{_bindir}/xds-server
%{_bindir}/syncthing
%{_bindir}/syncthing-inotify
%dir %{_sysconfdir}/xds
%dir %{_sysconfdir}/xds/server
%config %{_sysconfdir}/default/xds-server
%config %{_sysconfdir}/xds/server/*
%config %{_sysconfdir}/profile.d/%{name}.sh
%dir %{_userunitdir}
%{_userunitdir}/xds-server.service
%dir %{_userunitdir}/default.target.wants
%{_userunitdir}/default.target.wants/xds-server.service


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

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