#!/bin/bash
for x in $(cat /proc/cmdline); do
    case $x in
	ip=*)
	/usr/lib/klibc/bin/ipconfig -d ${x#ip=}
	;;
	mirror=*)
	export MIRROR=${x#mirror=}
	;;
	dist=*)
	export DIST=${x#dist=}
	;;
	arch=*)
	export ARCH=${x#arch=}
	;;
	imagesize=*)
	export FSSIZE=${x#imagesize=}
	;;
	noinstall)
	exit 0
	;;
    esac
done

mount -t tmpfs none /var/log
mount -t tmpfs none /tmp

export TARGET=/dev/hda
export ARCH=${ARCH-amd64}
export IP=$(ifconfig eth0 | sed -n 's/.*inet addr:\([0-9\.]*\).*/\1/p')
export HOSTNAME=$(hostname)

# args passed through environment rather than as 7 positional args
/usr/sbin/sipb-xen-create-image

busybox poweroff
exit 0
