File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / rc.subr
Revision 1.2.4.2: download - view: text, annotated - select for diffs - revision graph
Tue May 29 14:24:05 2012 UTC (12 years, 5 months ago) by misho
Branches: elwix1_6
Diff to: branchpoint 1.2: preferred, unified
fix build instructions
fix rc.subr installlist
fix fs

#
# ELWIX project build helper subroutines
#
# (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
#    by Michael Pounov <misho@elwix.org>
#
# $Id: rc.subr,v 1.2.4.2 2012/05/29 14:24:05 misho Exp $
#

### Dont edit this file !!!

CheckVer()
{
	[ -z "$1" -o ! -r "$1" ] && return 1

	cat $1 | awk '($1 == "ELWIX") { split($3, arr, ":"); printf("%s", arr[2]); }'
	return 0
}

SnitVer()
{
	install -d ${TOPDIR}

	V=$(CheckVer $1)

	if [ $? -ne 0 ]; then
# file not found
		return 1
	elif [ X"$V" != X"${VERSION}" ]; then
# different ELWIX version
		return 2
	fi

# already present file with same version
	return 0
}

# $1 = ELWIX install list config
# $2 = From World dir
# $3 = To Dest dir
InstallList()
{
	sed -nE -e 's/^ *([^ #]+) */\1/p' < $1 | tr ':' '\n' | 
		tar -C $2 -cvf - -T - | tar -C $3 -x -f -
}

# $1 = From dir
# $2 = To dir
InstallDir()
{
	cd $1
	pax -rw -pe -X . $2
	cd -
}

# $* = Program arguments for install tool
InstallProg()
{
	install -c $*
}

# $1 = file_pattern
# $2 = From dir
# $3 = To dir
InstallFiles()
{
	if [ -d "$2" ]; then
		cd $2
		find . -type f -name "$1" | 
			tar -cvf - -T - | tar -C $3 -xf -
		cd -
	fi
}

# $1 = Directory for clean
CleanCVS()
{
	find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1
	find $1 -type f -name .#\* -exec rm -f {} \; >/dev/null 2>&1
}


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>