示例#1
0
def start_x11(xtimeout):
    """Start the X server for the Anaconda GUI."""

    # Start Xorg and wait for it become ready
    util.startX(["Xorg", "-br", "-logfile", "/tmp/X.log",
                 ":%s" % constants.X_DISPLAY_NUMBER, "vt6", "-s", "1440", "-ac",
                 "-nolisten", "tcp", "-dpi", "96",
                 "-noreset"],
                output_redirect=subprocess.DEVNULL, timeout=xtimeout)
示例#2
0
def start_x11(xtimeout):
    """Start the X server for the Anaconda GUI."""

    # Start Xorg and wait for it become ready
    util.startX(["Xorg", "-br", "-logfile", "/tmp/X.log",
                 ":%s" % constants.X_DISPLAY_NUMBER, "vt6", "-s", "1440", "-ac",
                 "-nolisten", "tcp", "-dpi", "96",
                 "-noreset"],
                output_redirect=subprocess.DEVNULL, timeout=xtimeout)
示例#3
0
文件: vnc.py 项目: rvykydal/anaconda
    def startServer(self):
        self.log.info(_("Starting VNC..."))
        network.wait_for_connectivity()

        # Lets call it from here for now.
        try:
            self.initialize()
        except (socket.herror, dbus.DBusException, ValueError) as e:
            stdoutLog.critical("Could not initialize the VNC server: %s", e)
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        if self.password and (len(self.password) < 6 or len(self.password) > 8):
            self.changeVNCPasswdWindow()

        if not self.password:
            SecurityTypes = "None"
            rfbauth = "0"
        else:
            SecurityTypes = "VncAuth"
            rfbauth = self.pw_file
            # Create the password file.
            self.setVNCPassword()

        # Lets start the xvnc.
        xvnccommand = [XVNC_BINARY_NAME, ":%s" % constants.X_DISPLAY_NUMBER,
                       "-depth", "16", "-br",
                       "IdleTimeout=0", "-auth", "/dev/null", "-once",
                       "DisconnectClients=false", "desktop=%s" % (self.desktop,),
                       "SecurityTypes=%s" % SecurityTypes, "rfbauth=%s" % rfbauth]

        try:
            util.startX(xvnccommand, output_redirect=self.openlogfile(), timeout=self.timeout)
        except OSError:
            stdoutLog.critical("Could not start the VNC server.  Aborting.")
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        self.log.info(_("The VNC server is now running."))

        # Lets tell the user what we are going to do.
        if self.vncconnecthost != "":
            self.log.warning(_("\n\nYou chose to connect to a listening vncviewer. \n"
                               "This does not require a password to be set.  If you \n"
                               "set a password, it will be used in case the connection \n"
                               "to the vncviewer is unsuccessful\n\n"))
        elif self.password == "":
            self.log.warning(_("\n\nWARNING!!! VNC server running with NO PASSWORD!\n"
                               "You can use the vncpassword=PASSWORD boot option\n"
                               "if you would like to secure the server.\n\n"))
        elif self.password != "":
            self.log.warning(_("\n\nYou chose to execute vnc with a password. \n\n"))
        else:
            self.log.warning(_("\n\nUnknown Error.  Aborting. \n\n"))
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        # Lets try to configure the vnc server to whatever the user specified
        if self.vncconnecthost != "":
            connected = self.connectToView()
            if not connected:
                self.VNCListen()
        else:
            self.VNCListen()

        # Start vncconfig for copy/paste
        self.startVncConfig()
示例#4
0
    def startServer(self):
        self.log.info(_("Starting VNC..."))
        network.wait_for_connectivity()

        # Lets call it from here for now.
        try:
            self.initialize()
        except (socket.herror, dbus.DBusException, ValueError) as e:
            stdoutLog.critical("Could not initialize the VNC server: %s", e)
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        if self.password and (len(self.password) < 6
                              or len(self.password) > 8):
            self.changeVNCPasswdWindow()

        if not self.password:
            SecurityTypes = "None"
            rfbauth = "0"
        else:
            SecurityTypes = "VncAuth"
            rfbauth = self.pw_file
            # Create the password file.
            self.setVNCPassword()

        # Lets start the xvnc.
        xvnccommand = [
            XVNC_BINARY_NAME,
            ":%s" % constants.X_DISPLAY_NUMBER, "-depth", "16", "-br",
            "IdleTimeout=0", "-auth", "/dev/null", "-once",
            "DisconnectClients=false",
            "desktop=%s" % (self.desktop, ),
            "SecurityTypes=%s" % SecurityTypes,
            "rfbauth=%s" % rfbauth
        ]

        try:
            util.startX(xvnccommand,
                        output_redirect=self.openlogfile(),
                        timeout=self.timeout)
        except OSError:
            stdoutLog.critical("Could not start the VNC server.  Aborting.")
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        self.log.info(_("The VNC server is now running."))

        # Lets tell the user what we are going to do.
        if self.vncconnecthost != "":
            self.log.warning(
                _("\n\nYou chose to connect to a listening vncviewer. \n"
                  "This does not require a password to be set.  If you \n"
                  "set a password, it will be used in case the connection \n"
                  "to the vncviewer is unsuccessful\n\n"))
        elif self.password == "":
            self.log.warning(
                _("\n\nWARNING!!! VNC server running with NO PASSWORD!\n"
                  "You can use the vncpassword=PASSWORD boot option\n"
                  "if you would like to secure the server.\n\n"))
        elif self.password != "":
            self.log.warning(
                _("\n\nYou chose to execute vnc with a password. \n\n"))
        else:
            self.log.warning(_("\n\nUnknown Error.  Aborting. \n\n"))
            util.ipmi_abort(scripts=self.anaconda.ksdata.scripts)
            sys.exit(1)

        # Lets try to configure the vnc server to whatever the user specified
        if self.vncconnecthost != "":
            connected = self.connectToView()
            if not connected:
                self.VNCListen()
        else:
            self.VNCListen()

        # Start vncconfig for copy/paste
        self.startVncConfig()