#!/bin/sh
CMDLINE=/proc/cmdline
for item in $(cat $CMDLINE); do
	var="${item%=*}"
	
	# BOOT_IMAGE is added by syslinux.
	if [ "$var" = "BOOT_IMAGE" ]; then
		continue
	fi
	
	# init is not generally useful to pass on.
	if [ "$var" = init ]; then
		continue
	fi

	# ks is only useful to kickseed in the first stage.
	if [ "$var" = ks ]; then
		continue
	fi

	# We don't believe that vga= is needed to display a console any more
	# now that we've switched to 640x400 by default, and it breaks
	# suspend/resume. People can always type it in again at the
	# installed boot loader if need be.
	if [ "$var" = vga ]; then
		continue
	fi

	# Skip debconf variables.
	varnoslash="${var##*/*}"
	if [ "$varnoslash" = "" ]; then
		continue
	fi
	
	# Skip module-specific variables.
	varnodot="${var##*.*}"
	if [ "$varnodot" = "" ]; then
		continue
	fi
	
	if [ "$item" = "--" ]; then
		inuser=1
		collect=""
	elif [ "$inuser" ]; then
		if [ -z "$collect" ]; then
			collect="$item"
		else
			collect="$collect $item"
		fi
	fi
done

# Include default parameters.
RET=`debconf-get debian-installer/add-kernel-opts || true`
if [ "$RET" ]; then
        collect="$collect $RET"
fi

for word in $collect; do
	echo "$word"
done
