Update/fix rpm and deb packaging
[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 BuildRequires:  unzip
16 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
17 Group:          Development/Tools/Debuggers
18
19 # for now still embedded with xds
20 # Requires:       syncthing
21
22 %description
23 xds-server is a web server that allows user to remotely cross build applications.
24
25 %prep
26 %setup -q -n xds-server
27
28 %build
29
30 %install
31 mkdir -p %{?buildroot}%{_prefix}/xds/server %{?buildroot}%{_bindir}
32 cp -r * %{?buildroot}%{_prefix}/xds/server/
33 rm -rf %{?buildroot}%{_prefix}/xds/server/conf.d
34 ln -s ../xds/server/xds-server        %{?buildroot}%{_bindir}/xds-server
35 ln -s ../xds/server/syncthing         %{?buildroot}%{_bindir}/syncthing
36 ln -s ../xds/server/syncthing-inotify %{?buildroot}%{_bindir}/syncthing-inotify
37 mkdir -p %{?buildroot}%{_userunitdir}
38 cp ./conf.d/usr/lib/systemd/user/xds-server.service %{?buildroot}%{_userunitdir}
39 mkdir -p %{?buildroot}/%{_sysconfdir}/default
40 cp ./conf.d/etc/default/xds-server %{?buildroot}/%{_sysconfdir}/default/
41 mkdir -p %{?buildroot}/%{_sysconfdir}/xds/server
42 cp ./conf.d/etc/xds/server/* %{?buildroot}/%{_sysconfdir}/xds/server/
43 mkdir -p %{?buildroot}%{_userunitdir}/default.target.wants && ln -s ../xds-server.service %{?buildroot}%{_userunitdir}/default.target.wants/
44 mkdir -p %{?buildroot}%{_sysconfdir}/profile.d
45 sed -e "s;@XDS_INSTALL_BIN_DIR@;%{_bindir};g" ./conf.d/etc/profile.d/xds-server.sh > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
46
47 %files
48 %defattr(-,root,root)
49 %dir %{_prefix}
50 %dir %{_bindir}
51 %dir %{_prefix}/xds
52 %dir %{_prefix}/xds/server
53 %{_prefix}/xds/server/*
54 %{_bindir}/xds-server
55 %{_bindir}/syncthing
56 %{_bindir}/syncthing-inotify
57 %dir %{_sysconfdir}/xds
58 %dir %{_sysconfdir}/xds/server
59 %config %{_sysconfdir}/default/xds-server
60 %config %{_sysconfdir}/xds/server/*
61 %config %{_sysconfdir}/profile.d/%{name}.sh
62 %dir %{_userunitdir}
63 %{_userunitdir}/xds-server.service
64 %dir %{_userunitdir}/default.target.wants
65 %{_userunitdir}/default.target.wants/xds-server.service
66
67
68 %post
69 if [ "$1" -ge 2 ]; then
70   if [ -f "${_sysconfdir}/xds-server/config.json" ]; then
71     install -b -S .rpmsave ${_sysconfdir}/xds-server/config.json ${_sysconfdir}/xds/server/server-config.json
72   fi
73 fi
74 exit 0
75
76 %preun
77 if [ "$1" -ge 2 ]; then
78   rm -f %{_sysconfdir}/xds-server/*.rpm*
79 fi
80 exit 0