summaryrefslogtreecommitdiffstats
path: root/conf.d/packaging/rpm
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2018-05-15 17:18:06 +0200
committerRonan Le Martret <ronan.lemartret@iot.bzh>2018-05-15 17:30:52 +0200
commit72c9174cecdfbe4cde9baa71c0c02d0bee753224 (patch)
treed7a92e6a059398d1c98666052cbed826b2064139 /conf.d/packaging/rpm
parentf7993c2552f007f34bfbd1865951d9243923276e (diff)
Add packaging files
* it's easier to manage native build package. Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
Diffstat (limited to 'conf.d/packaging/rpm')
-rw-r--r--conf.d/packaging/rpm/agl-xds-agent.spec81
1 files changed, 81 insertions, 0 deletions
diff --git a/conf.d/packaging/rpm/agl-xds-agent.spec b/conf.d/packaging/rpm/agl-xds-agent.spec
new file mode 100644
index 0000000..b6e3fff
--- /dev/null
+++ b/conf.d/packaging/rpm/agl-xds-agent.spec
@@ -0,0 +1,81 @@
+#
+# spec file for package agl-xds-agent
+#
+
+%define _prefix /opt/AGL
+%global debug_package %{nil}
+
+Name: agl-xds-agent
+Version: 1.1.1
+Release: 0
+License: Apache-2.0
+Summary: XDS agent/client tool
+Url: https://github.com/iotbzh/xds-agent.git
+Source0: xds-agent_linux-amd64-v%{version}_2018-04-05_112625.zip
+BuildRequires: unzip
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+# 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}%{_userunitdir}/default.target.wants && ln -s ../xds-agent.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-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
+%dir %{_userunitdir}/default.target.wants
+%{_userunitdir}/default.target.wants/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