yaws.spec

Krzysztof Goliński krzysztof.golinski w gmail.com
Pią, 23 Paź 2009, 23:25:39 CEST


Witam,

Popełniłem speca dla yaws (http://yaws.hyber.org/) i szukam
developera, który go wrzuci na CVS. Yaws był wpisany na listę
PLD-specs-TODO. Jest to serwer HTTP, który ma doskonale radzić sobie z
dynamicznymi treściami. Dopisałem do niego inita, a właściwie
przerobiłem, stworzyłem też usera i grupę yaws. Nie jestem też
przekonany, czy działa na niższych uprawnieniach (yaws) a nie roota.
Nie mogłem się nigdzie dogrzebać/wywnioskować co to zapewnia. Serwer
po uruchomieniu (service yaws start) działa bez problemu - można go
sprawdzić na http://127.0.0.1. Nie poradziłem sobie też z dwiema
rzeczami, są opisane na początku speca.

Pozdrawiam,
Krzysztof Goliński
-------------- następna część ---------
# $Revision:$, $Date:$

# TODO: don't add yaws.pdf to doc. I don't know why. See -> install source2 and %doc in %file
# TODO: daemon script has problem with "stop" operation - ID problem

# Conditional build:
%bcond_without	pamauth		# disable pam auth
%bcond_without	sendfile	# disable use of sendfile system call

Summary:	Yaws HTTP webserver
Summary(pl.UTF-8):	serwer HTTP Yaws
Name:		yaws
Version:	1.84
Release:	1
License:	BSD
Group:		Networking/Daemons/HTTP
Source0:	http://yaws.hyber.org/download/%{name}-%{version}.tar.gz
# Source0-md5:	f98108809fb127e8be0fb80b552a58dd
Source1:	%{name}.init
Source2:	http://yaws.hyber.org/%{name}.pdf
URL:		http://yaws.hyber.org/
BuildRequires:	erlang
Requires(pre):	/usr/sbin/groupadd
Requires(pre):	/usr/sbin/useradd
Requires:	/sbin/chkconfig
Requires:	erlang
Requires:	rc-scripts
#Conflicts:	apache
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description
Yaws is a HTTP high perfomance 1.1 webserver particularly well suited
for dynamic-content webapplications. Yaws is entirely written in
Erlang furthermore it is a multithreaded webserver where one Erlang
light weight process is used to handle each client.

%description -l pl.UTF-8
Yaws jest wysoce wydajnym serwerem HTTP, dobrze radzącym sobie z
dynamicznymi treściami, tworzonymi przez aplikacje webowe. Yaws jest
całkowicie napisany w języku Erlang, ponadto jest wielowątkowym
serwerem, gdzie jeden lekki proces jest używany do obsługi każdego
klienta.

%clean
rm -rf $RPM_BUILD_ROOT

%prep
%setup -q

%pre
%groupadd -g 103  yaws
%useradd -u 103 -r -d /home/services/yaws -s /bin/false -c "Yaws HTTP user" -g yaws yaws

%post
/sbin/chkconfig --add yaws
%service yaws start

%preun
if [ "$1" = "0" ]; then
         %service yaws stop
         /sbin/chkconfig --del yaws
fi

%build
%configure \
%{!?with_sendfile: --disable-sendfile} \
%{!?with_pamauth:  --disable-pam} \
	 --localstatedir=/home/services/yaws

%{__make}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/var/yaws
install -d $RPM_BUILD_ROOT/var/log/yaws
install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

%{__make} install \
	DESTDIR=$RPM_BUILD_ROOT

install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/yaws
install %{SOURCE2} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/yaws.pdf

%files
%defattr(644,root,root,755)
%attr(755,root,root)%{_bindir}/yaws
#%doc ChangeLog LICENSE yaws.pdf # don't add yaws.pdf to doc. I don't known why.
%doc ChangeLog LICENSE
%dir /var/yaws
#/var/yaws/*
%dir /var/log/yaws
%dir %{_sysconfdir}/yaws
%attr(754,root,root) /etc/rc.d/init.d/yaws
%{_sysconfdir}/yaws/*
%{_pkgconfigdir}/yaws.pc
%{_mandir}/man1/yaws.1*
%{_mandir}/man5/yaws.conf.5*
%{_mandir}/man5/yaws_api.5*
/home/services/yaws/*
%dir %{_libdir}/yaws/ebin
%dir %{_libdir}/yaws/include
%dir %{_libdir}/yaws/priv
%dir %{_libdir}/yaws/priv/lib
%{_libdir}/yaws/ebin/.empty
%{_libdir}/yaws/ebin/*.beam
%{_libdir}/yaws/ebin/*.app
%{_libdir}/yaws/include/*.hrl
%{?with_pamauth: %{_libdir}/yaws/priv/lib/epam}
%{_libdir}/yaws/priv/lib/*.so
%{_libdir}/yaws/priv/*.xsd

%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
* %{date} PLD Team <feedback w pld-linux.org>
All persons listed below can be reached at <cvs_login>@pld-linux.org

$Log:$
-------------- następna część ---------
#!/bin/bash
#
# yaws	yaws (Yaws Web Server daemon)
#
# config: /etc/etc/yaws.conf
#
# chkconfig: 2345 65 35
#
# description: yaws - Erlang enabled http server

# Source function library.

. /etc/rc.d/init.d/functions

yaws=/usr/bin/yaws
prog=yaws
#
# Default yawsid is "default". If you change this to another ID,
# be sure to also uncomment the yawsid_opts line just below.
#
yawsid=default
#yawsid_opts="--id $yawsid"
conf="--conf /etc/yaws/yaws.conf"
LOCK_FILE=/var/lock/subsys/yaws

start() {
	if [ ! -f $LOCK_FILE ]; then
		msg_starting yaws
		daemon $yaws ${yawsid_opts} --daemon --heart ${conf}
        	RETVAL=$?
        	[ $RETVAL -eq  0 ] && touch $LOCK_FILE
        	return $RETVAL
	else
		msg_already_running yaws
	fi
}

stop() {
	if [ -f $LOCK_FILE ]; then
		str=`$yaws ${yawsid_opts} --stop`
		if [ "$str" = "stopping yaws with id=$yawsid" ]; then
	    		msg_stopping yaws
	    		RETVAL=0
		else
			echo $str
			RETVAL=1
		fi
		rm -f $LOCK_FILE /var/run/yaws.pid
	else 
		msg_not_running yaws
	fi
}


reload() {
	echo -n $"Reloading $prog: "
	r=`$yaws ${yawsid_opts} --hup` 
	RETVAL=$?
	echo $r
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        $yaws -S
	RETVAL=$?
	;;
  restart)
	stop
	start
	;;
  condrestart)
	if [ -f /tmp/yaws.ctl ] ; then
		stop
		start
	fi
	;;
  reload)
        reload
	;;
  help)
	$yaws -?
	;;
  *)
	echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|help}"
	exit 1
esac

exit $RETVAL


Więcej informacji o liście dyskusyjnej pld-devel-pl