@@ -5,11 +5,11 @@ socket="/tmp/virtiofs.sock"
55rootfs=" "
66kernel=" $rootfs /boot/vmlinuz"
77initram=" $rootfs /boot/initrd.img"
8+ cmdline=" rw console=ttyS0 reboot=k panic=1 root=vroot rootfstype=virtiofs rootdelay=30"
89
910user=" user"
1011pass=" pass"
1112name=" cloud"
12- init=" /sbin/init"
1313
1414fspid=0
1515
@@ -21,10 +21,11 @@ fail() {
2121usage () {
2222 echo " "
2323 echo " Usage: $0 [OPTIONS]"
24- echo " -r, --rootfs Path to the root filesystem image (required)"
25- echo " -u, --user Username for the system (optional)"
26- echo " -p, --pass Password for the user (optional)"
27- echo " -n, --name Hostname for the system (optional)"
24+ echo " --rootfs Path to the root filesystem image (required)"
25+ echo " --user Username for the system (optional)"
26+ echo " --pass Password for the user (optional)"
27+ echo " --name Hostname for the system (optional)"
28+ echo " --init Entrypoint for the system (optional)"
2829 echo " "
2930 exit 1
3031}
@@ -56,7 +57,9 @@ handle_options() {
5657 shift
5758 ;;
5859 --init)
59- init=" $2 "
60+ if [ ! -z " $2 " ]; then
61+ cmdline=" $cmdline init=$2 "
62+ fi
6063 shift
6164 ;;
6265 * )
@@ -129,7 +132,7 @@ run_hypervisor() {
129132 --initramfs " ${initram} " \
130133 --fs tag=vroot,socket=" ${socket} " \
131134 --disk path=" ${cidata} " \
132- --cmdline " rw console=ttyS0 reboot=k panic=1 root=vroot rootfstype=virtiofs rootdelay=30 init= ${init }" \
135+ --cmdline " ${cmdline }" \
133136 --serial tty \
134137 --console off
135138}
0 commit comments