## $Id: Makefile-files,v 1.1.4.2 2003/10/30 15:16:30 ensc Exp $  -*- makefile -*-

## Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
##  
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##  
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##  
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##  

sysv_XTRAS		=  sysv/rebootmgr.subst \
			   sysv/v_gated.subst \
			   sysv/v_httpd.subst \
			   sysv/v_named.subst \
			   sysv/v_portmap.subst \
			   sysv/v_sendmail.subst \
			   sysv/v_smb.subst \
			   sysv/v_sshd.subst \
			   sysv/v_xinetd.subst \
			   sysv/vservers.subst

sysv_GENSCRPTS		=  sysv/rebootmgr \
			   sysv/v_gated \
			   sysv/v_httpd \
			   sysv/v_named \
			   sysv/v_portmap \
			   sysv/v_sendmail \
			   sysv/v_smb \
			   sysv/v_sshd \
			   sysv/v_xinetd \
			   sysv/vservers

sysv_SCRPTS		=  $(sysv_GENSCRPTS)

sysv_CFG		=  sysv/vservers.conf


sysv/%:			sysv/%.subst
			@mkdir -p $$(dirname '$@')
			sed -e 's!/usr/lib/util-vserver!$(pkglibdir)!g; \
				s!^USR_SBIN=/usr/sbin$$!USR_SBIN=$(sbindir)!g; \
                                s!^VROOTDIR=/vservers$$!VROOTDIR=$(vserverdir)!g; \
			       ' '$<' >'$@.tmp'
			if cmp -s '$<' '$@.tmp'; then \
				cp -p '$<' '$@'; \
			else \
				mv -f '$@.tmp' '$@'; \
			fi
			-rm -f '$@.tmp'
			@chmod a-w '$@'
