File google-daemon.spec of Package google-daemon.3436

#
# spec file for package google-daemon
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           google-daemon
Version:        1.3.2
Release:        0
Summary:        VM management inside GCE
License:        Apache-2.0
Group:          System/Daemons
Url:            https://github.com/GoogleCloudPlatform/compute-image-packages
Source0:        %{name}-%{version}.tar.bz2
Source1:        google-address-manager.suse
Source2:        google-accounts-manager.suse
%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%endif
%{?systemd_requires}
%if 0%{?suse_version} < 1140
Requires:       insserv
Requires:       sysvinit
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildArch:      noarch

%description
Google Daemon - A service that manages user accounts,
maintains ssh login keys, and syncs public endpoint IP addresses.

%prep
%setup -q

%build

%install
%{__mkdir} -p %{buildroot}/usr
%{__mkdir} -p %{buildroot}%{_sbindir}
cp -r usr/share %{buildroot}/usr
%if 0%{?suse_version} > 1140
    %{__mkdir} -p %{buildroot}/%{_unitdir}
    cp usr/lib/systemd/system/google-address-manager.service %{buildroot}/%{_unitdir}
    cp usr/lib/systemd/system/google-accounts-manager.service %{buildroot}/%{_unitdir}
    pushd %{buildroot}%{_sbindir}
    ln -s service rcgoogle-address-manager
    ln -s service rcgoogle-accounts-manager
    popd
%else
  %{__mkdir} -p %{buildroot}/%{_initddir}
  cp %{SOURCE1} %{buildroot}/%{_initddir}/google-address-manager
  cp %{SOURCE2} %{buildroot}/%{_initddir}/google-accounts-manager
  ln -s ../../%{_initrddir}/google-address-manager %{buildroot}%{_sbindir}/rcgoogle-address-manager
  ln -s ../../%{_initrddir}/google-accounts-manager %{buildroot}%{_sbindir}/rcgoogle-accounts-manager
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%if 0%{?suse_version} > 1140
    %service_del_preun google-address-manager.service
    %service_del_preun google-accounts-manager.service
%else
    %stop_on_removal
%endif

%pre
%if 0%{?suse_version} > 1140
    %service_add_pre google-address-manager.service
    %service_add_pre google-accounts-manager.service
%endif

%post
%if 0%{?suse_version} > 1140
    %service_add_post google-address-manager.service
    %service_add_post google-accounts-manager.service
%endif

%postun
%if 0%{?suse_version} > 1140
    %service_del_postun google-address-manager.service
    %service_del_postun google-accounts-manager.service
%else
    %insserv_cleanup
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE README.md
%{_datadir}/google/google_daemon/*
%{_sbindir}/rcgoogle-address-manager
%{_sbindir}/rcgoogle-accounts-manager
%dir %{_datadir}/google
%dir %{_datadir}/google/google_daemon
%if 0%{?suse_version} > 1140
%{_unitdir}/google-address-manager.service
%{_unitdir}/google-accounts-manager.service
%else
%attr(0755,root,root) %{_initddir}/google-address-manager
%attr(0755,root,root) %{_initddir}/google-accounts-manager
%endif

%changelog
openSUSE Build Service is sponsored by