p2v: Don't run X in non-GUI mode.

Even in non-GUI mode we were starting up the X server in the virt-p2v
ISO.  This is a waste of time and resources, so don't do it.
This commit is contained in:
Richard W.M. Jones
2016-06-17 12:26:48 +01:00
parent 784d8bd894
commit 3c7c63e1dc

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# (C) Copyright 2014 Red Hat Inc.
# (C) Copyright 2014-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,13 +18,22 @@
# This normally runs from systemd which deals with logging.
# To save one script, invoke self again to run the window manager
# and virt-p2v.
if [ "$1" = "run" ]; then
cd /
metacity &
nm-applet &
# Are we running in GUI or non-GUI mode? This is controlled by the
# presence of "p2v.server" on the kernel command line.
cmdline=$(</proc/cmdline)
if [[ $cmdline == *p2v.server=* ]]; then
# Non-GUI mode, don't run X. Just run virt-p2v directly.
exec @libexecdir@/virt-p2v --iso
else
xinit "$0" run
# GUI mode. Run xinit to start X. To save one script, we invoke
# self again to run the window manager and virt-p2v.
if [ "$1" = "run" ]; then
cd /
metacity &
nm-applet &
exec @libexecdir@/virt-p2v --iso
else
xinit "$0" run
fi
fi