File hostinfo.spec of Package hostinfo.10384

#
# spec file for package hostinfo
#
# Copyright (c) 2019 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:           hostinfo
Summary:        Gathers basic server information
License:        GPL-2.0
Group:          System/Monitoring
Url:            https://github.com/g23guy/hostinfo
Version:        1.0.1
Release:        0
Source:         %{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Requires:       cron
Requires:       sed

%description
A script that displays current system information to help 
identify a host and it's resources.

Authors:
--------
    Jason Record <jrecord@suse.com>
 
 
%prep
%setup -q

%build
gzip -9f man/*8

%install
pwd;ls -la
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc
install -d $RPM_BUILD_ROOT/etc/cron.daily
install -d $RPM_BUILD_ROOT/usr/sbin
install -d $RPM_BUILD_ROOT/usr/share/man/man8
install -d $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
install -d $RPM_BUILD_ROOT/var/spool/%{name}
install -m 644 conf/hostinforc $RPM_BUILD_ROOT/etc
install -m 444 man/COPYING.GPLv2 $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
install -m 755 bin/hostinfo $RPM_BUILD_ROOT/usr/sbin
install -m 755 bin/hostinfo-refresh $RPM_BUILD_ROOT/etc/cron.daily
install -m 644 man/*.8.gz $RPM_BUILD_ROOT/usr/share/man/man8

%files
%defattr(-,root,root)
/usr/sbin/*
%config /etc/*
/etc/cron.daily/*
/usr/share/man/man8/*
%dir %attr(0700,root,root) /var/spool/%{name}
%dir /usr/share/doc/packages/%{name}
%doc /usr/share/doc/packages/%{name}/*

%post
echo '[[ -s /var/spool/hostinfo/root-motd ]] && cat /var/spool/hostinfo/root-motd' >> /root/.profile
echo "Run hostinfo" > /var/spool/hostinfo/root-motd

%preun
rm -f /var/spool/hostinfo/root-motd

%postun
if [[ -e /root/.profile ]]
then
	sed -i -e '/\/var\/spool\/hostinfo\/root-motd/d' /root/.profile
	if [[ ! -s /root/.profile ]]
	then
		rm -f /root/.profile
	fi
fi

%changelog
openSUSE Build Service is sponsored by