summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xanaconda46
-rw-r--r--vnc.py118
2 files changed, 148 insertions, 16 deletions
diff --git a/anaconda b/anaconda
index ef96cf3b4..2559e268f 100755
--- a/anaconda
+++ b/anaconda
@@ -429,6 +429,7 @@ progmode = 'install' # 'rescue', or 'install'
method = None # URL representation of install method
logFile = None # may be a file object or a file name
display_mode = None
+graphical_failed = 0
# should we ever try to probe for X stuff? this will give us a convenient
@@ -665,6 +666,7 @@ if (debug):
import isys
import instdata
import floppy
+import vnc
if not isHeadless:
import xsetup
@@ -877,21 +879,12 @@ else: # s390/iSeries checks
flags.usevnc):
dup_log("DISPLAY variable not set. Starting text mode!")
display_mode = 't'
+ graphical_failed = 1
time.sleep(2)
-# if they want us to use VNC do that now
-if display_mode == 'g' and flags.usevnc:
- # dont run vncpassword if in test mode
- if flags.test:
- vncpassword = None
-
- startVNCServer(vncpassword=vncpassword,
- vncconnecthost=vncconnecthost,
- vncconnectport=vncconnectport)
-
# if DISPLAY not set either vnc server failed to start or we're not
# running on a redirected X display, so start local X server
-if display_mode == 'g' and not os.environ.has_key('DISPLAY'):
+if display_mode == 'g' and not os.environ.has_key('DISPLAY') and not flags.usevnc:
import rhpl.monitor as monitor
# if no monitor probed lets guess based on runres
@@ -917,17 +910,37 @@ if display_mode == 'g' and not os.environ.has_key('DISPLAY'):
else:
xlogfile = None
- xsetup_failed = xserver.startXServer(videohw, monitorhw, mousehw, kbd,
- runres,
- xStartedCB=doStartupX11Actions,
- xQuitCB=doShutdownX11Actions,
- logfile=xlogfile)
+ xsetup_failed = xserver.startXServer(videohw, monitorhw, mousehw, kbd,
+ runres,
+ xStartedCB=doStartupX11Actions,
+ xQuitCB=doShutdownX11Actions,
+ logfile=xlogfile)
if xsetup_failed:
dup_log(" X startup failed, falling back to text mode")
display_mode = 't'
+ graphical_failed = 1
time.sleep(2)
+if display_mode == 't' and graphical_failed:
+ ret = vnc.askVncWindow()
+ if ret != -1:
+ display_mode = 'g'
+ flags.usevnc = 1
+ if ret is not None:
+ vncpassword = ret
+
+# if they want us to use VNC do that now
+if display_mode == 'g' and flags.usevnc:
+ # dont run vncpassword if in test mode
+ if flags.test:
+ vncpassword = None
+
+ startVNCServer(vncpassword=vncpassword,
+ vncconnecthost=vncconnecthost,
+ vncconnectport=vncconnectport)
+
+
#
# read in anaconda configuration file
#
@@ -969,6 +982,7 @@ if (display_mode == 'g'):
from gui import InstallInterface
except Exception, e:
+ log("Exception starting GUI installer: %s" %(e,))
# if we're not going to really go into GUI mode, we need to get
# back to vc1 where the text install is going to pop up.
if not x_already_set:
diff --git a/vnc.py b/vnc.py
new file mode 100644
index 000000000..f9cc174d1
--- /dev/null
+++ b/vnc.py
@@ -0,0 +1,118 @@
+#
+# vnc.py: VNC related installer functionality
+#
+# Copyright 2004 Red Hat, Inc.
+#
+# Jeremy Katz <katzj@redhat.com>
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+import os, sys, string
+from snack import *
+from constants_text import *
+from rhpl.translate import _, N_
+
+def radiocb(*args):
+ pass
+
+# return -1 to use text mode, None for no vncpass, or vncpass otherwise
+def askVncWindow():
+ screen = SnackScreen()
+ vncpass = None
+ vncconnect = 0
+
+ STEP_MESSAGE = 0
+ STEP_PASS = 1
+ STEP_DONE = 3
+ step = 0
+ while step < STEP_DONE:
+ if step == STEP_MESSAGE:
+ button = ButtonChoiceWindow(screen, _("Unable to Start X"),
+ _("X was unable to start on your "
+ "machine. Would you like to "
+ "start VNC to connect to "
+ "this computer from another "
+ "computer and perform a "
+ "graphical install or continue "
+ "with a text mode install?"),
+ buttons = [ _("Use text mode"),
+ _("Start VNC") ])
+
+ if button == string.lower (_("Use text mode")):
+ screen.finish()
+ return -1
+ else:
+ step = STEP_PASS
+ continue
+
+ if step == STEP_PASS:
+ grid = GridFormHelp(screen, _("VNC Configuration"),
+ "vnc", 1, 10)
+
+ bb = ButtonBar(screen, (TEXT_OK_BUTTON,
+ (_("No password"), "nopass"),
+ TEXT_BACK_BUTTON))
+
+ text = _("A password will prevent unauthorized listeners "
+ "connecting and monitoring your installation progress. "
+ "Please enter a password to be used for the installation")
+ grid.add(TextboxReflowed(40, text), 0, 0, (0, 0, 0, 1))
+
+ entry1 = Entry (16, password = 1)
+ entry2 = Entry (16, password = 1)
+ passgrid = Grid (2, 2)
+ passgrid.setField (Label (_("Password:")), 0, 0, (0, 0, 1, 0), anchorLeft = 1)
+ passgrid.setField (Label (_("Password (confirm):")), 0, 1, (0, 0, 1, 0), anchorLeft = 1)
+ passgrid.setField (entry1, 1, 0)
+ passgrid.setField (entry2, 1, 1)
+ grid.add (passgrid, 0, 1, (0, 0, 0, 1))
+
+ grid.add(bb, 0, 8, (0, 1, 1, 0), growx = 1)
+
+ while 1:
+ res = grid.run()
+ rc = bb.buttonPressed(res)
+
+ if rc == TEXT_BACK_CHECK:
+ screen.popWindow()
+ step = STEP_MESSAGE
+ break
+ elif rc == "nopass":
+ screen.finish()
+ return None
+ else:
+ pw = entry1.value()
+ cf = entry2.value()
+ if pw != cf:
+ ButtonChoiceWindow(screen, _("Password Mismatch"),
+ _("The passwords you entered were "
+ "different. Please try again."),
+ buttons = [ TEXT_OK_BUTTON ],
+ width = 50)
+ elif len(pw) < 6:
+ ButtonChoiceWindow(screen, _("Password Length"),
+ _("The password must be at least "
+ "six characters long."),
+ buttons = [ TEXT_OK_BUTTON ],
+ width = 50)
+ else:
+ screen.finish()
+ return pw
+
+ entry1.set("")
+ entry2.set("")
+ continue
+ continue
+
+ screen.finish()
+ return -1
+
+
+if __name__ == "__main__":
+ askVncWindow()