rpms/ladvd/devel ladvd.init, NONE, 1.1 ladvd.spec, NONE, 1.1 ladvd.sysconfig, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Andreas Thienemann ixs at fedoraproject.org
Wed Oct 29 07:01:13 UTC 2008


Author: ixs

Update of /cvs/pkgs/rpms/ladvd/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12679

Modified Files:
	.cvsignore sources 
Added Files:
	ladvd.init ladvd.spec ladvd.sysconfig 
Log Message:
* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-2
- Added SElinux support package
- Added patch to make it build on EL-4
- Added separate ladvd user



--- NEW FILE ladvd.init ---
#!/bin/bash
#
# ladvd        Startup script for the cdp/lldp sender
#
# chkconfig: - 85 15
# description: ladvd uses cdp / lldp frames to inform switches \
#              about connected hosts, which simplifies ethernet \
#              switch management.
# processname: ladvd
# pidfile: /var/run/ladvd.pid
#
### BEGIN INIT INFO
# Provides: ladvd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Short-Description: start and stop cdp/lldp sender
# Description: ladvd uses cdp / lldp frames to inform switches
#  about connected hosts, which simplifies ethernet
#  switch management.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

[ "${NETWORKING}" = "yes" ] || exit 0

[ -r /etc/sysconfig/ladvd ] && . /etc/sysconfig/ladvd

ARGS=""

[ "$CDP" != "yes" ] && [ "$LLDP" != "yes" ] && \
        echo "Need at least CDP or LDP activated" && \
        exit 1

[ "$CDP" == "yes" ] && ARGS=$ARGS" -c"
[ "$LLDP" == "yes" ] && ARGS=$ARGS" -l"
[ "$MGMT" != "" ] && ARGS=$ARGS" -m $MGMT"
[ "$COUNTRY" != "" ] && ARGS=$ARGS" -C $COUNTRY"
[ "$LOCATION" != "" ] && ARGS=$ARGS" -L $LOCATION"

start() 
{
	[ -z "$ARGS" ] && exit 6

        echo -n $"Starting ladvd: "
        daemon /usr/sbin/ladvd $ARGS $LADVDARGS
	RETVAL=$?
        echo
	[ $RETVAL = 0 ] && touch /var/lock/subsys/ladvd
	return $RETVAL
}

stop() 
{
        echo -n $"Shutting down ladvd: "
	killproc ladvd
	RETVAL=$?
	rm -f  /var/lock/subsys/ladvd
        echo
	return $RETVAL
}

[ -f /usr/sbin/ladvd ] || exit 0

# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  force-reload|restart|reload)
	stop
	start
	;;
  try-restart|condrestart)
	[ -e /var/lock/subsys/ladvd ] && (stop; start)
	;;
  status)
  	status ladvd
	RETVAL=$?
	;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
        exit 3
esac

exit $RETVAL


--- NEW FILE ladvd.spec ---
%global uid 47
%global username ladvd
%global homedir /tmp
%global gecos CDP/LLDP sender for unix

%define selinux_variants mls strict targeted
%global selinux_policyver %(%{__sed} -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp || echo 0.0.0)
%define modulename ladvd

Name:           ladvd
Version:        0.6.1
Release:        2%{?dist}
Summary:        CDP/LLDP sender for unix

Group:          Applications/Internet
License:        ISC
URL:            http://www.blinkenlights.nl/software/ladvd/
Source0:        http://www.blinkenlights.nl/software/ladvd/ladvd-%{version}.tar.gz
Source1:        ladvd.sysconfig
Source2:        ladvd.init
Source3:        %{modulename}.te
Source4:        %{modulename}.fc
Source5:        %{modulename}.if
Patch0:         ladvd-0.6.1-bonding.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%bcond_without	fedora
BuildRequires:	fedora-usermgmt-devel
%{?FE_USERADD_REQ}

Provides:	group(%username) = %uid
Provides:	user(%username)  = %uid

Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service


%description 
ladvd uses cdp / lldp frames to inform switches about connected hosts, which
simplifies ethernet switch management. Every 30 seconds it will transmit CDP/
LLDP packets reflecting the current system state. Interfaces (bridge, bonding,
wireless), capabilities (bridging, forwarding, wireless) and addresses (IPv4,
IPv6) are detected dynamically.


%package selinux
Summary:        SELinux policy module supporting %{name}
Group:          System Environment/Base
BuildRequires:  checkpolicy, selinux-policy-devel, hardlink
%if "%{selinux_policyver}" != ""
Requires:       selinux-policy >= %{selinux_policyver}
%endif
Requires:       %{name} = %{version}-%{release}
Requires(post):   /usr/sbin/semodule, /sbin/restorecon
Requires(postun): /usr/sbin/semodule, /sbin/restorecon


%description selinux
SELinux policy module supporting %{name}


%prep
%setup -q
%patch0 -p0 -b .bonding
mkdir SELinux
cp -p %{SOURCE3} %{SOURCE4} %{SOURCE5} SELinux

%build
%configure \
        --with-user=%username \
        --with-pid-dir=%{_localstatedir}/run
make %{?_smp_mflags}

cd SELinux
for selinuxvariant in %{selinux_variants}
do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
cd -


%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm -rf %{buildroot}%{_docdir}/ladvd
install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}

cd SELinux
for selinuxvariant in %{selinux_variants}
do
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 %{modulename}.pp.${selinuxvariant} \
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
done
cd -

/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux


%clean
rm -rf %{buildroot}


%pre
%__fe_groupadd %uid -r %username &>/dev/null || :
%__fe_useradd  %uid -r -s /sbin/nologin -d %homedir -M          \
-c '%gecos' -g %username %username &>/dev/null || :


%post
/sbin/chkconfig --add %{name}


%preun
if [ $1 = 0 ]; then
        /sbin/service %{name} stop >/dev/null 2>&1
        /sbin/chkconfig --del %{name}
fi


%postun
if [ "$1" -ge "1" ]; then
        /sbin/service %{name} condrestart >/dev/null 2>&1
fi
%__fe_userdel  %username &>/dev/null || :
%__fe_groupdel %username &>/dev/null || :


%post selinux
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
done
/sbin/restorecon %{_localstatedir}/cache/myapp || :

%postun selinux
if [ $1 -eq 0 ] ; then
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
done
[ -d %{_localstatedir}/cache/myapp ]  && \
/sbin/restorecon -R %{_localstatedir}/cache/myapp &> /dev/null || :
fi


%files
%defattr(-,root,root,-)
%doc doc/ChangeLog doc/README LICENSE TODO
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_initrddir}/%{name}
%{_sbindir}/ladvd
%{_mandir}/man8/ladvd.8*


%files selinux
%defattr(-,root,root,0755)
%doc SELinux/*
%{_datadir}/selinux/*/%{modulename}.pp


%changelog
* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-2
- Added SElinux support package
- Added patch to make it build on EL-4
- Added separate ladvd user

* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-1
- Initial package


--- NEW FILE ladvd.sysconfig ---
# Cisco Discovery Protocol
CDP=no

# Link Layer Discovery Protocol
LLDP=no

# Management adress for unnumbered interfaces
# Can be specified for IPv4 and IPv6
MGMT=

# Two-letter ISO 3166 country code
# (required for LLDP location support)
COUNTRY=

# The physical location of the server
LOCATION=

# Other arguments to ladvd
LADVDARGS=


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/ladvd/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	27 Oct 2008 04:19:28 -0000	1.1
+++ .cvsignore	29 Oct 2008 07:00:43 -0000	1.2
@@ -0,0 +1 @@
+ladvd-0.6.1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/ladvd/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	27 Oct 2008 04:19:28 -0000	1.1
+++ sources	29 Oct 2008 07:00:43 -0000	1.2
@@ -0,0 +1 @@
+90989dec5200d6cab48dc7a6cff3cbe6  ladvd-0.6.1.tar.gz




More information about the scm-commits mailing list