#!	/bin/ash

case $0 in
ps|*/ps)
	for i in /proc/[0-9]*/; do
		read stat < $i/stat
		set -- $stat
		echo "$1	$2"
	done
	;;
lilo|*/lilo)
	if [ ! -x /target/sbin/lilo ];then
		echo "
You must mount your root filesystem under /target and the base system
must be installed to be able to run lilo. 
To mount your root filesystem use: \"mount <partition> /target\"
where <partition> is the device name of the partition where your root
filesystem is. Or use the \"Mount a Previously-Initialized Partition\"
option in the installation system's main menu."
		exit 1
	fi
	LD_LIBRARY_PATH=/target/lib:/target/usr/lib /target/sbin/lilo -r /target
	;;
uname|*/uname)
	if [ $# -gt 0 ]; then
		case $1 in
		-r|--release)
			set -- `cat /proc/version`
			echo $3
			;;
		-s|--sysname)
			echo "Linux"
			;;
		esac
	else
		echo "Linux"
	fi
	;;
emacs|*/emacs)
	echo "Emacs and vi are available in Debian, but wouldn't fit on the
installation floppies. Please type \"ae\" to invoke a tiny, but
easy-to-learn editor. As soon as you have your system installed, you may
install the \"emacs\" package, and/or the \"vim\" or \"nvi\" packages.
\"vim\" and \"nvi\" each provide a different version of \"vi\"."
	;;
vi|*/vi)
	ae -f /etc/ae/ae2vi.rc "$@"
	;;
mformat|*/mformat)
	;;
lsmod|*/lsmod)
	echo "Module         Pages    Used by"
	cat /proc/modules
	;;
grep|*/grep|fgrep|*/fgrep)
	if [ ! -x /bin/sed ];then
		echo "
The drivers disk (the utilities there in) must be installed to be able to
run $0."
                exit 1
        fi
	R="$1"
	shift
	if [ $R = "-q" ]; then
		R="$1"
		shift
		O=$(sed "/$R/P" -n "$@")
		if [ -z "$O" ]; then
			exit 1;
		fi
	elif [ $R = "-v" ]; then
		R="$1"
		shift
		sed "/$R/\!P" -n "$@"
	else
		sed "/$R/P" -n "$@"
	fi
	;;
*)
	echo "no function defined for $0"
	exit 1
esac
exit 0
