packaging: add dependency to jq
[src/xds/xds-server.git] / conf.d / packaging / rpm / agl-xds-server.spec
1 #
2 # spec file for package agl-xds-server
3 #
4
5 %define _prefix /opt/AGL
6 %global debug_package %{nil}
7
8 Name:           agl-xds-server
9 Version:        0.0.0
10 Release:        0
11 License:        Apache-2.0
12 Summary:        XDS-server
13 Url:            https://gerrit.automotivelinux.org/gerrit/p/src/xds/xds-server.git
14 Source0:        xds-server_linux-amd64-%{version}.zip
15 Source1:        rpmlintrc
16 BuildRequires:  unzip
17 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
18 Group:          Development/Tools/Debuggers
19
20 # for now still embedded with xds
21 # Requires:       jq syncthing
22 Requires:       jq
23
24 %description
25 xds-server is a web server that allows user to remotely cross build applications.
26
27 %prep
28 %setup -q -n xds-server
29
30 %build
31
32 %install
33 mkdir -p %{?buildroot}%{_prefix}/xds/server %{?buildroot}%{_bindir}
34 cp -r * %{?buildroot}%{_prefix}/xds/server/
35 rm -rf %{?buildroot}%{_prefix}/xds/server/conf.d
36 ln -s ../xds/server/xds-server        %{?buildroot}%{_bindir}/xds-server
37 ln -s ../xds/server/syncthing         %{?buildroot}%{_bindir}/syncthing
38 ln -s ../xds/server/syncthing-inotify %{?buildroot}%{_bindir}/syncthing-inotify
39 mkdir -p %{?buildroot}%{_userunitdir}
40 cp ./conf.d/usr/lib/systemd/user/xds-server.service %{?buildroot}%{_userunitdir}
41 mkdir -p %{?buildroot}/%{_sysconfdir}/default
42 cp ./conf.d/etc/default/xds-server %{?buildroot}/%{_sysconfdir}/default/
43 mkdir -p %{?buildroot}/%{_sysconfdir}/xds/server
44 cp ./conf.d/etc/xds/server/* %{?buildroot}/%{_sysconfdir}/xds/server/
45 mkdir -p %{?buildroot}%{_userunitdir}/default.target.wants && ln -s ../xds-server.service %{?buildroot}%{_userunitdir}/default.target.wants/
46 mkdir -p %{?buildroot}%{_sysconfdir}/profile.d
47 sed -e "s;@XDS_INSTALL_BIN_DIR@;%{_bindir};g" ./conf.d/etc/profile.d/xds-server.sh > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
48
49 %files
50 %defattr(-,root,root)
51 %dir %{_prefix}
52 %dir %{_bindir}
53 %dir %{_prefix}/xds
54 %dir %{_prefix}/xds/server
55 %{_prefix}/xds/server/*
56 %{_bindir}/xds-server
57 %{_bindir}/syncthing
58 %{_bindir}/syncthing-inotify
59 %dir %{_sysconfdir}/xds
60 %dir %{_sysconfdir}/xds/server
61 %config %{_sysconfdir}/default/xds-server
62 %config %{_sysconfdir}/xds/server/*
63 %config %{_sysconfdir}/profile.d/%{name}.sh
64 %dir %{_userunitdir}
65 %{_userunitdir}/xds-server.service
66 %dir %{_userunitdir}/default.target.wants
67 %{_userunitdir}/default.target.wants/xds-server.service
68
69
70 %post
71 if [ "$1" -ge 2 ]; then
72   if [ -f "${_sysconfdir}/xds-server/config.json" ]; then
73     install -b -S .rpmsave ${_sysconfdir}/xds-server/config.json ${_sysconfdir}/xds/server/server-config.json
74   fi
75 fi
76 exit 0
77
78 %preun
79 if [ "$1" -ge 2 ]; then
80   rm -f %{_sysconfdir}/xds-server/*.rpm*
81 fi
82 exit 0