summaryrefslogtreecommitdiffstats
path: root/anaconda
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2003-03-31 17:07:40 +0000
committerMike Fulbright <msf@redhat.com>2003-03-31 17:07:40 +0000
commit3b23e441617a59cab509d0283477a6bf3c6839a1 (patch)
tree2ab414dcfe683021f7522b0c90f0efae6808f435 /anaconda
parent289ce90e9d8bcc45a927b5ca8d54aff3d8c53c4b (diff)
downloadanaconda-3b23e441617a59cab509d0283477a6bf3c6839a1.tar.gz
anaconda-3b23e441617a59cab509d0283477a6bf3c6839a1.tar.xz
anaconda-3b23e441617a59cab509d0283477a6bf3c6839a1.zip
added vnc capability
Diffstat (limited to 'anaconda')
-rwxr-xr-xanaconda85
1 files changed, 83 insertions, 2 deletions
diff --git a/anaconda b/anaconda
index 8dcf084c0..25e904bcc 100755
--- a/anaconda
+++ b/anaconda
@@ -47,6 +47,74 @@ def startMiniWM(root='/'):
sys.exit (1)
return childpid
+
+# startup vnc X server
+def startVNCServer(vncpasswd=None, root='/'):
+
+ def set_vnc_password(root, passwd, passwd_file):
+ (pid, fd) = os.forkpty()
+
+ if not pid:
+ os.execv(root + "/usr/bin/vncpasswd", [root + "/usr/bin/vncpasswd", passwd_file])
+ sys.exit(1)
+
+ # read password prompt
+ os.read(fd, 1000)
+
+ # write password
+ os.write(fd, passwd + "\n")
+
+ # read challenge again, and newline
+ os.read(fd, 1000)
+ os.read(fd, 1000)
+
+ # write password again
+ os.write(fd, passwd + "\n")
+
+ # read remaining output
+ os.read(fd, 1000)
+
+ dup_log(_("Starting VNC"))
+
+ vncpid = os.fork()
+
+ if not vncpid:
+ args = [ root + "/usr/bin/Xvnc", ":1", "-nevershared",
+ "-depth", "16", "-geometry", "800x600" "-dontdisconnect"]
+
+ # set passwd if necessary
+ if vncpasswd is not None:
+ set_vnc_password(vncpasswd, "/tmp/vncpasswd_file")
+ args = args + ["-rfbauth", "/tmp/vncpasswd_file"]
+
+ tmplogFile = "/tmp/vncserver.log"
+ try:
+ err = os.open(tmplogFile, os.O_RDWR | os.O_CREAT)
+ if err < 0:
+ sys.stderr.write("error opening %s\n", tmplogFile)
+ else:
+ os.dup2(err, 2)
+ os.close(err)
+ except:
+ # oh well
+ pass
+
+ os.execv(args[0], args)
+ sys.exit (1)
+
+ if vncpasswd is None:
+ dup_log(_("\n\nWARNING!!! VNC server running with NO PASSWORD!"))
+ dup_log(_("You can use the vncpasswd=<password> boot option"))
+ dup_log(_("if you would like to secure the server.\n\n"))
+
+ dup_log(_("VNC server now running - please connect to install..."))
+
+
+dup_
+
+ os.environ["DISPLAY"]=":1"
+ doStartupX11Actions()
+
# function to handle X startup special issues for anaconda
def doStartupX11Actions():
@@ -178,7 +246,7 @@ try:
'testpath=', 'mountfs', 'traceonly', 'kickstart=',
'lang=', 'keymap=', 'kbdtype=', 'module=', 'class=',
'expert', 'serial', 'lowres', 'nofb', 'rescue', 'nomount',
- 'autostep', 'resolution=', 'skipddc'])
+ 'autostep', 'resolution=', 'skipddc', 'vnc', 'vncpasswd='])
except TypeError, msg:
sys.stderr.write("Error %s\n:" % msg)
sys.exit(-1)
@@ -242,6 +310,7 @@ progmode = None
customClass = None
kbd = None
ksfile = None
+vncpasswd = None
#
# parse off command line arguments
@@ -309,7 +378,11 @@ for n in args:
display_mode = 't'
elif (str == '--kbdtype'):
kbdtype = arg
-
+ elif (str == '--vnc'):
+ flags.usevnc = 1
+ elif (str == '--vncpasswd='):
+ vncpasswd = arg
+
# s390s don't have ttys
if iutil.getArch() == "s390":
logFile = "/tmp/anaconda-s390.log"
@@ -558,6 +631,14 @@ else: # s390 checks
display_mode = 't'
time.sleep(2)
+# if they want us to use VNC do that now
+if display_mode == 'g' and flags.usevnc:
+ # dont run vncpasswd if in test mode
+ if flags.test:
+ vncpasswd = None
+
+ startVNCServer(vncpasswd=vncpasswd)
+
if display_mode == 'g' and not os.environ.has_key('DISPLAY'):
import rhpl.monitor as monitor