DragonFly BSD
DragonFly submit List (threaded) for 2005-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

install + ln wrappers for installworld


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Sun, 3 Jul 2005 03:38:34 +0200

hey,

see attached files for a possible way to register installed files in
installworld. try it with the ln conversion patch and

make installworld INSTALL_LOG=path-to-logfile \
INSTALL=sh\ path-to-install-wrapper.sh \
LN=sh\ path-to-ln-wrapper.sh

with install_wrapper.sh you can as well install as non-root:
add an env var INSTALL_NO_ATTR=1.

please try and comment.

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
#!/bin/sh

logfile() {
	f=$1
	f=${f#./}
	expr "$1" : \\/ >/dev/null || f="`pwd`/$f"
	echo "$f" >> $INSTALL_LOG
}


param=
isdir=
while [ $# -ne 0 ]
do
	case "$1" in
	-[bCcdlMpSsv]*)
		expr "$1" : ".*d" >/dev/null && isdir=1
		param="$param '$1'"
		shift
		;;
	-[LBfgmo])
		if [ -n "$INSTALL_NO_ATTR" ]
		then
		else
			param="$param '$1' '$2'"
		fi
		shift; shift
		;;
	-[LBfgmo]*)
		if [ -n "$INSTALL_NO_ATTR" ]
		then
		else
			param="$param '$1'"
		fi
		shift
		;;
	*)
		break
		;;
	esac
done
	
if [ -n "$INSTALL_LOG" ]
then
	if [ $# -lt 2 -a -z "$isdir" ]
	then
		echo "install: too few arguments" >&2
		exit 1
	fi

	if [ -n "$isdir" ]
	then
		while [ $# -ne 0 ]
		do
			logfile "$1"
			param="$param '$1'"
			shift
		done
	elif [ $# -gt 2 -o -d "$2" ]
	then
		files=
		while [ $# -ne 1 ]
		do
			files="$files '$1'"
			shift
		done
		dir=$1
		if [ \! -d "$dir" ]
		then
			echo "install: multiple files need directory as destination" >&2
			exit 1
		fi
		eval set -- $files
		while [ $# -ne 0 ]
		do
			bn=`basename "$1"`
			logfile "$dir/$bn"
			param="$param '$1'"
			shift
		done
		param="$param '$dir'"
	else
		logfile "$2"
		param="$param '$1' '$2'"
	fi
else
	while [ $# -ne 0 ]
	do
		param="$param '$1'"
		shift
	done
fi

eval set -- $param
exec install "$@"
#!/bin/sh

logfile() {
	f=$1
	f=${f#./}
	expr "$1" : \\/ >/dev/null || f="`pwd`/$f"
	echo "$f" >> $INSTALL_LOG
}

nofollowsym=
param=
while [ $# -ne 0 ]
do
	case "$1" in
	-[fhinsv]*)
		expr "$!" : '.*[hn]' >/dev/null && nofollowsym=1
		param="$param '$1'"
		shift
		;;
	*)
		break
		;;
	esac
done
	
if [ -n "$INSTALL_LOG" ]
then
	if [ $# -eq 0 ]
	then
		echo "install: too few arguments" >&2
		exit 1
	fi

	if [ $# -eq 1 -o $# -gt 2 -o ( -d "$2" -a ( -z "$nofollowsym" -o \! -L "$2" ) ) ]
	then
		files="'$1'"
		shift
		while [ $# -gt 1 ]
		do
			files="$files '$1'"
			shift
		done
		if [ $# -eq 1 ]
		then
			dir=$1
		else
			dir=`pwd`
		fi
		if [ \! -d "$dir" ]
		then
			echo "ln: multiple files need directory as destination" >&2
			exit 1
		fi
		eval set -- $files
		while [ $# -ne 0 ]
		do
			bn=`basename "$1"`
			logfile "$dir/$bn"
			param="$param '$1'"
			shift
		done
		param="$param '$dir'"
	else
		logfile "$2"
		param="$param '$1' '$2'"
	fi
else
	while [ $# -ne 0 ]
	do
		param="$param '$1'"
		shift
	done
fi

eval set -- $param
exec ln "$@"

Attachment: pgp00003.pgp
Description: PGP signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]