����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 216.73.216.238 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /snap/core20/current/usr/share/subiquity/console_conf/cmd/ |
Upload File : |
#!/usr/bin/env python3 # Copyright 2015 Canonical, Ltd. # # 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 # the Free Software Foundation, version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import argparse import sys import os import logging from subiquitycore.log import setup_logger from subiquitycore import __version__ as VERSION from console_conf.core import ConsoleConf, RecoveryChooser class ClickAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): namespace.scripts.append("c(" + repr(values) + ")") def parse_options(argv): parser = argparse.ArgumentParser( description=( 'console-conf - Pre-Ownership Configuration for Ubuntu Core'), prog='console-conf') parser.add_argument('--dry-run', action='store_true', dest='dry_run', help='menu-only, do not call installer function') parser.add_argument('--serial', action='store_true', dest='run_on_serial', help='Run the installer over serial console.') parser.add_argument('--ascii', action='store_true', dest='ascii', help='Run the installer in ascii mode.') parser.add_argument('--machine-config', metavar='CONFIG', dest='machine_config', help="Don't Probe. Use probe data file") parser.add_argument('--screens', action='append', dest='screens', default=[]) parser.add_argument('--script', metavar="SCRIPT", action='append', dest='scripts', default=[], help=('Execute SCRIPT in a namespace containing view ' 'helpers and "ui"')) parser.add_argument('--click', metavar="PAT", action=ClickAction, help='Synthesize a click on a button matching PAT') parser.add_argument('--answers') parser.add_argument('--recovery-chooser-mode', action='store_true', dest='chooser_systems', help=('Run as a recovery chooser interacting with the ' 'calling process over stdin/stdout streams')) return parser.parse_args(argv) LOGDIR = "/var/log/console-conf/" def main(): opts = parse_options(sys.argv[1:]) global LOGDIR if opts.dry_run: LOGDIR = ".subiquity" setup_logger(dir=LOGDIR) logger = logging.getLogger('console_conf') logger.info("Starting console-conf v{}".format(VERSION)) logger.info("Arguments passed: {}".format(sys.argv)) if opts.chooser_systems: # when running as a chooser, the stdin/stdout streams are set up by the # process that runs us, attempt to restore the tty in/out by looking at # stderr chooser_input, chooser_output = restore_std_streams_from(sys.stderr) interface = RecoveryChooser(opts, chooser_input, chooser_output) else: interface = ConsoleConf(opts) interface.run() def restore_std_streams_from(from_file): """ Attempt to restore the original sys.std{in,out} streams by inspecting the tty that stderr is hooked up to. Returns the chooser input/output streams. """ tty = os.ttyname(from_file.fileno()) # we have tty now chooser_input, chooser_output = sys.stdin, sys.stdout sys.stdin = open(tty, 'r') sys.stdout = open(tty, 'w') return chooser_input, chooser_output if __name__ == '__main__': sys.exit(main())