#! /bin/sh
# UML - Script to run User-Mode Linux sessions
# Copyright (C) 2009 Matous Jan Fialka,
# Released under the terms of The MIT License
UML_RCFILE=${UML_RCFILE-$HOME/.umlrc}
UML_RCPATH=${UML_RCPATH-$HOME/.uml}
UML_RTPATH=${UML_RTPATH-$HOME/.uml/runtime}
UML_KERNEL=${UML_KERNEL-/usr/src/linux/vmlinux}
UML_APPEND=${UML_APPEND}
APPEND=
APPEND()
{
APPEND="$@"
}
if test "$1" = '--help'
then
echo "Usage: ${0##*\/} --help | [--dry-run] [--help] [options]"
exit 0
fi
__DRY_RUN__=${__DRY_RUN__-0}
case "$*" in *--dry-run*)
while test "$1" = '--dry-run'
do
shift 1
done
__DRY_RUN__=1
esac
if test -r $UML_RCFILE
then
source $UML_RCFILE
fi
if test $# -gt 0
then
if test -r $UML_RCPATH/$1
then
source $UML_RCPATH/$1
shift 1
else
echo "Error: no such file or directory $UML_RCPATH/$1" 1>&2
exit 1
fi
fi
kernel=${kernel-$UML_KERNEL}
if ! test -e $kernel
then
echo "Error: no such file or directory $kernel" 1>&2
exit 2
fi
if ! test -x $kernel
then
echo "Error: can not execute file $kernel" 1>&2
exit 3
fi
if ! test $__DRY_RUN__ -eq 0
then
kernel="echo $kernel"
fi
uml_dir=${uml_dir-$UML_RTPATH}
if ! test -e $uml_dir
then
if ! mkdir -p $uml_dir 2>/dev/null
then
echo "Error: can not create $uml_dir" 1>&2
exit 4
fi
fi
if ! test -d $uml_dir
then
echo "Error: not a directory $uml_dir" 1>&2
exit 5
fi
case "$*" in *--help*)
${kernel} --help
exit $?
esac
${kernel} \
${UML_APPEND} \
${iomem+iomem=$iomem} \
${mem+mem=$mem} \
${debug+debug=$debug} \
${root+root=$root} \
${umid+umid=$umid} \
${initrd+initrd=$initrd} \
${con+con=$con} \
${con0+con0=$con0} \
${con1+con1=$con1} \
${con2+con2=$con2} \
${con3+con3=$con3} \
${con4+con4=$con4} \
${con5+con5=$con5} \
${con6+con6=$con6} \
${con7+con7=$con7} \
${con8+con8=$con8} \
${con9+con9=$con9} \
${ssl0+ssl0=$ssl0} \
${ssl1+ssl1=$ssl1} \
${ssl2+ssl2=$ssl2} \
${ssl3+ssl3=$ssl3} \
${ssl4+ssl4=$ssl4} \
${ssl5+ssl5=$ssl5} \
${ssl6+ssl6=$ssl6} \
${ssl7+ssl7=$ssl7} \
${ssl8+ssl8=$ssl8} \
${ssl9+ssl9=$ssl9} \
${eth0+eth0=$eth0} \
${eth1+eth1=$eth1} \
${eth2+eth2=$eth2} \
${eth3+eth3=$eth3} \
${eth4+eth4=$eth4} \
${eth5+eth5=$eth5} \
${eth6+eth6=$eth6} \
${eth7+eth7=$eth7} \
${eth8+eth8=$eth8} \
${eth9+eth9=$eth9} \
${mconsole+mconsole=$mconsole} \
${udb+udb} \
${ubd0+ubd0=$ubd0} \
${ubd1+ubd1=$ubd1} \
${ubd2+ubd2=$ubd2} \
${ubd3+ubd3=$ubd3} \
${ubd4+ubd4=$ubd4} \
${ubd5+ubd5=$ubd5} \
${ubd6+ubd6=$ubd6} \
${ubd7+ubd7=$ubd7} \
${ubd0d+ubd0d=$ubd0d} \
${ubd1d+ubd1d=$ubd1d} \
${ubd2d+ubd2d=$ubd2d} \
${ubd3d+ubd3d=$ubd3d} \
${ubd4d+ubd4d=$ubd4d} \
${ubd5d+ubd5d=$ubd5d} \
${ubd6d+ubd6d=$ubd6d} \
${ubd7d+ubd7d=$ubd7d} \
${ubd0r+ubd0r=$ubd0r} \
${ubd1r+ubd1r=$ubd1r} \
${ubd2r+ubd2r=$ubd2r} \
${ubd3r+ubd3r=$ubd3r} \
${ubd4r+ubd4r=$ubd4r} \
${ubd5r+ubd5r=$ubd5r} \
${ubd6r+ubd6r=$ubd6r} \
${ubd7r+ubd7r=$ubd7r} \
${ubd0s+ubd0s=$ubd0s} \
${ubd1s+ubd1s=$ubd1s} \
${ubd2s+ubd2s=$ubd2s} \
${ubd3s+ubd3s=$ubd3s} \
${ubd4s+ubd4s=$ubd4s} \
${ubd5s+ubd5s=$ubd5s} \
${ubd6s+ubd6s=$ubd6s} \
${ubd7s+ubd7s=$ubd7s} \
${ubd0c+ubd0c=$ubd0c} \
${ubd1c+ubd1c=$ubd1c} \
${ubd2c+ubd2c=$ubd2c} \
${ubd3c+ubd3c=$ubd3c} \
${ubd4c+ubd4c=$ubd4c} \
${ubd5c+ubd5c=$ubd5c} \
${ubd6c+ubd6c=$ubd6c} \
${ubd7c+ubd7c=$ubd7c} \
${ubda+ubda=$ubda} \
${ubdb+ubdb=$ubdb} \
${ubdc+ubdc=$ubdc} \
${ubdd+ubdd=$ubdd} \
${ubde+ubde=$ubde} \
${ubdf+ubdf=$ubdf} \
${ubdg+ubdg=$ubdg} \
${ubdh+ubdh=$ubdh} \
${ubdi+ubdi=$ubdi} \
${ubdj+ubdj=$ubdj} \
${ubdk+ubdk=$ubdk} \
${ubdl+ubdl=$ubdl} \
${ubdm+ubdm=$ubdm} \
${ubdn+ubdn=$ubdn} \
${ubdo+ubdo=$ubdo} \
${ubdp+ubdp=$ubdp} \
${fake_ide+fake_ide=$fake_ide} \
${mixer+mixer=$mixer} \
${dsp+dsp=$dsp} \
${xterm+xterm=$xterm} \
${aio+aio=$aio} \
${noptraceldt+noptraceldt} \
${noptracefaultinfo+noptracefaultinfo} \
${noprocmm+noprocmm} \
${nosysemu+nosysemu} \
${mode+mode=$mode} \
${skas0+skas0} \
${uml_dir+uml_dir=$uml_dir} \
${hostfs+hostfs=$hostfs} \
${APPEND} \
${@//--dry-run}