usr/src/cmd/system-config/__init__.py
changeset 1717 10cb4d15a248
parent 1672 6e0bd17ca3f5
child 1731 ddf2ef5c94ee
equal deleted inserted replaced
1716:0cea9255024f 1717:10cb4d15a248
    23 #
    23 #
    24 
    24 
    25 
    25 
    26 '''System Configuration Interactive (SCI) Tool'''
    26 '''System Configuration Interactive (SCI) Tool'''
    27 
    27 
    28 
       
    29 import gettext
    28 import gettext
    30 import atexit
    29 import atexit
    31 import curses
    30 import curses
    32 import locale
    31 import locale
    33 import logging
    32 import logging
   173 # default locations
   172 # default locations
   174 DEFAULT_SC_PROFILE = "sc_profile.xml"
   173 DEFAULT_SC_PROFILE = "sc_profile.xml"
   175 DEFAULT_SC_LOCATION = os.path.join(VOLATILE_PATH, "profile",
   174 DEFAULT_SC_LOCATION = os.path.join(VOLATILE_PATH, "profile",
   176                                    DEFAULT_SC_PROFILE)
   175                                    DEFAULT_SC_PROFILE)
   177 
   176 
   178 DEFAULT_LOG_LOCATION = "/var/tmp/install/sysconfig.log"
   177 DEFAULT_LOG_LOC = os.path.join(VOLATILE_PATH, "sysconfig/sysconfig.log")
   179 DEFAULT_LOG_LEVEL = "info"
   178 DEFAULT_LOG_LEVEL = "info"
   180 LOG_FORMAT = ("%(asctime)s - %(levelname)-8s: "
   179 LOG_FORMAT = ("%(asctime)s - %(levelname)-8s: "
   181               "%(filename)s:%(lineno)d %(message)s")
   180               "%(filename)s:%(lineno)d %(message)s")
   182 LOGGER = None
   181 LOGGER = None
   183 XSLT_FILE = os.environ.get('SC_XSLT',
   182 XSLT_FILE = os.environ.get('SC_XSLT',
   981                           "into FILE.\t\t[default: %default]"),
   980                           "into FILE.\t\t[default: %default]"),
   982                           default=DEFAULT_SC_LOCATION)
   981                           default=DEFAULT_SC_LOCATION)
   983         parser.add_option("-l", "--log-location", dest="logname",
   982         parser.add_option("-l", "--log-location", dest="logname",
   984                           help=_("Set log location to FILE "
   983                           help=_("Set log location to FILE "
   985                           "(default: %default)"),
   984                           "(default: %default)"),
   986                           metavar="FILE", default=DEFAULT_LOG_LOCATION)
   985                           metavar="FILE", default=DEFAULT_LOG_LOC)
   987         parser.add_option("-v", "--log-level", dest="log_level",
   986         parser.add_option("-v", "--log-level", dest="log_level",
   988                           default=DEFAULT_LOG_LEVEL,
   987                           default=DEFAULT_LOG_LEVEL,
   989                           help=_("Set log verbosity to LEVEL. In order of "
   988                           help=_("Set log verbosity to LEVEL. In order of "
   990                           "increasing verbosity, valid values are 'error' "
   989                           "increasing verbosity, valid values are 'error' "
   991                           "'warn' 'info' 'debug' or 'input'\n[default:"
   990                           "'warn' 'info' 'debug' or 'input'\n[default:"
  1073             return True
  1072             return True
  1074 
  1073 
  1075 
  1074 
  1076 def _prepare_engine(options):
  1075 def _prepare_engine(options):
  1077     '''Initialize the InstallEngine'''
  1076     '''Initialize the InstallEngine'''
  1078     InstallEngine(default_log=options.logname, loglevel=options.log_level,
  1077     InstallEngine(options.logname, loglevel=options.log_level,
  1079                   debug=options.debug)
  1078                   debug=options.debug, exclusive_rw=options.exclusive_rw)
  1080 
  1079 
  1081     logger = logging.getLogger(INSTALL_LOGGER_NAME)
  1080     logger = logging.getLogger(INSTALL_LOGGER_NAME)
  1082 
  1081 
  1083     # Don't set the global LOGGER until we're certain that logging
  1082     # Don't set the global LOGGER until we're certain that logging
  1084     # is up and running, so the main() except clause can figure out
  1083     # is up and running, so the main() except clause can figure out
  1130     (options, sub_cmd) = _parse_options(sys.argv[1:])
  1129     (options, sub_cmd) = _parse_options(sys.argv[1:])
  1131 
  1130 
  1132     if sub_cmd[0] == CONFIGURE or sub_cmd[0] == UNCONFIGURE:
  1131     if sub_cmd[0] == CONFIGURE or sub_cmd[0] == UNCONFIGURE:
  1133         do_unconfigure(sub_cmd[0], options)
  1132         do_unconfigure(sub_cmd[0], options)
  1134     elif sub_cmd[0] == CREATE_PROFILE:
  1133     elif sub_cmd[0] == CREATE_PROFILE:
       
  1134         # Set the exclusive read write flag to true
       
  1135         options.exclusive_rw = True
  1135         do_create_profile(options)
  1136         do_create_profile(options)
  1136 
  1137 
  1137     sys.exit(SU_OK)
  1138     sys.exit(SU_OK)
  1138 
  1139 
  1139 if __name__ == '__main__':
  1140 if __name__ == '__main__':