Name:           netoik-home
Version:        %(make version)
Release:        1%{?dist}
Summary:        Netoik home page

License:        GPLv3
URL:            https://www.netoik.io
Source0:        %{name}-%{version}.tar.gz

BuildArch:      x86_64
BuildRequires:  make
Requires:       netoik-api

%description
Netoik home page

%prep
%autosetup -v

%install
%make_install

%post
ln --symbolic %{_var}/netoik-api/captcha %{_var}/www/%{name}/assets/img/captcha

%preun
[ $1 -eq 0 ] && rm %{_var}/www/%{name}/assets/img/captcha

%files
%define bootstrap_version %(make bootstrap_version)
%define fontawesome_version %(make fontawesome_version)
%define jquery_version %(make jquery_version)
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/netoik.io.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/samuel-campos.fr.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/www.netoik.io.conf
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/www.samuel-campos.fr.conf
%attr(755, root, root) %dir %{_var}/www/%{name}
%attr(644, root, root)      %{_var}/www/%{name}/*.{html,ico}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/bootstrap-%{bootstrap_version}
%attr(644, root, root)      %{_var}/www/%{name}/assets/bootstrap-%{bootstrap_version}/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/css
%attr(644, root, root)      %{_var}/www/%{name}/assets/css/*.css
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/docs
%attr(644, root, root)      %{_var}/www/%{name}/assets/docs/*.pdf
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/fontawesome-%{fontawesome_version}
%attr(644, root, root)      %{_var}/www/%{name}/assets/fontawesome-%{fontawesome_version}/*.{js,css}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/googleapis
%attr(644, root, root)      %{_var}/www/%{name}/assets/googleapis/roboto
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/img
%attr(644, root, root)      %{_var}/www/%{name}/assets/img/*.{png,svg}
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/img/services
%attr(644, root, root)      %{_var}/www/%{name}/assets/img/services/*.svg
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/jquery-%(make jquery_version)
%attr(644, root, root)      %{_var}/www/%{name}/assets/jquery-%{jquery_version}/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/assets/js
%attr(644, root, root)      %{_var}/www/%{name}/assets/js/*.js
%attr(755, root, root) %dir %{_var}/www/%{name}/share
%attr(755, root, root) %dir %{_var}/www/%{name}/share/cg
%attr(644, root, root)      %{_var}/www/%{name}/share/cg/index.html
%attr(755, root, root) %dir %{_var}/www/%{name}/share/in
%attr(644, root, root)      %{_var}/www/%{name}/share/in/index.html
