File google-startup-scripts.spec of Package google-startup-scripts.1533

#
# spec file for package google-startup-scripts
#
# Copyright (c) 2015 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-startup-scripts
Version:        1.2.10
Release:        0
Summary:        GCE start up tools
License:        Apache-2.0
Group:          System/Daemons
Url:            https://github.com/GoogleCloudPlatform/compute-image-packages
Source0:        %{name}-%{version}.tar.bz2
Source1:        google.suse
Source2:        google-startup-scripts.suse
Patch0:         google-startup-scripts_disable_console_log.diff
%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%endif
%{?systemd_requires}
%if 0%{?suse_version} < 1140
Requires:       insserv
Requires:       sysvinit
%endif
Requires:       rsyslog
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildArch:      noarch

%description
Google Startup Scripts - Scripts and configuration files that setup a Linux-based image to work smoothly with GCE.

%prep
%setup -q
%patch0 -p1

%build

%install
%{__mkdir} -p %{buildroot}/%{_sysconfdir}
%{__mkdir} -p %{buildroot}/usr
cp -r etc/rsyslog.d %{buildroot}/%{_sysconfdir}
cp -r etc/sysctl.d %{buildroot}/%{_sysconfdir}
cp -r usr/share %{buildroot}/usr
%if 0%{?suse_version} > 1140
    %{__mkdir} -p %{buildroot}/%{_unitdir}
    %{__mkdir} -p %{buildroot}/%{_sbindir}
    cp usr/lib/systemd/system/* %{buildroot}/%{_unitdir}
    pushd %{buildroot}/%{_sbindir}
    ln -s service rcgoogle
    ln -s service rcgoogle-startup-scripts
    popd
    %if 0%{?suse_version} > 1220
        cp -r lib/udev %{buildroot}/usr/lib
    %else
        cp -r lib/udev %{buildroot}/lib
    %endif
%else
    %{__mkdir} -p %{buildroot}/%{_initrddir}
    %{__mkdir} -p %{buildroot}/%{_sbindir}
    %{__mkdir} -p %{buildroot}/lib
    cp -r lib/udev %{buildroot}/lib
    cp %{SOURCE1} %{buildroot}/%{_initrddir}/google
    cp %{SOURCE2} %{buildroot}/%{_initrddir}/google-startup-scripts
    ln -s ../../%{_initrddir}/google %{buildroot}%{_sbindir}/rcgoogle
    ln -s ../../%{_initrddir}/google-startup-scripts %{buildroot}%{_sbindir}/rcgoogle-startup-scripts
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%if 0%{?suse_version} > 1140
    %service_del_preun google.service
    %service_del_preun google-startup-scripts.service
%else
    %stop_on_removal
%endif

%pre
%if 0%{?suse_version} > 1140
    %service_add_pre google.service
    %service_add_pre google-startup-scripts.service
%endif

%post
%if 0%{?suse_version} > 1140
    %service_add_post google.service
    %service_add_post google-startup-scripts.service
%endif

%postun
%if 0%{?suse_version} > 1140
    %service_del_postun google.service
    %service_del_postun google-startup-scripts.service
%else
    %insserv_cleanup
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE
%{_datadir}/google/*
%{_sbindir}/rcgoogle
%{_sbindir}/rcgoogle-startup-scripts
%dir %{_datadir}/google
%dir %{_datadir}/google/boto
%dir /etc/rsyslog.d
%if 0%{?suse_version} > 1140
%{_unitdir}/google.service
%{_unitdir}/google-startup-scripts.service
%else
%attr(0755,root,root) %{_initrddir}/google
%attr(0755,root,root) %{_initrddir}/google-startup-scripts
%dir /lib/udev
%dir /lib/udev/rules.d
%dir %{_sysconfdir}/sysctl.d
%endif
%if 0%{?suse_version} > 1220
/usr/lib/udev/rules.d/*
%else
/lib/udev/rules.d/*
%endif
%config %{_sysconfdir}/rsyslog.d/90-google.conf
%config %{_sysconfdir}/sysctl.d/11-gce-network-security.conf

%changelog
openSUSE Build Service is sponsored by