File zypper-cron.spec of Package zypper-cron

# Copyright (c) 2013 Marcello Barnaba <vjt@openssl.it>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of Marcello Barnaba nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%define revision master

Name:           zypper-cron
Version:        0.0.1
Release:        0
Summary:        Simple tool to mail about pending package updates
Group:          System/Packages
License:        MIT
URL:            https://github.com/ifad/%{name}
Source0:        https://github.com/ifad/%{name}/archive/%{revision}.tar.gz
BuildArch:      noarch
Requires:       ruby
Requires:       rubygem-nokogiri
Requires:       rubygem-erubis
Requires:       cron

%description
ZyppyCron is inspired by apticron and porticron. It delivers root a daily
mailing with pending security updates, grouped by repository.

Built at IFAD, http://github.com/ifad/.

%prep
%setup -n %{name}-%{revision}

%build

%install

%define install_path %{_sbindir}/zypper-cron
%define cron_path    %{_sysconfdir}/cron.d

# Executable
%{__mkdir_p} %{buildroot}%{_sbindir}
%{__install} -p -m 0755 zypper-cron.rb %{buildroot}%{install_path}

# Cron job
mkdir -p %{buildroot}%{cron_path}
cat >%{buildroot}%{cron_path}/%{name} <<-EOF
# Run zypper-cron daily at 4AM.
0 4 * * * root %{install_path}
EOF

%files
%defattr(-,root,root,0755)
%doc README.md LICENSE
%{install_path}
%config(noreplace) %{cron_path}/%{name}

%changelog
openSUSE Build Service is sponsored by