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