def _call_script_no_chroot( self, name, option_list, working_directory ): if not working_directory: working_directory = self.root_dir script_path = os.path.abspath( os.sep.join([self.root_dir, 'image', name]) ) if os.path.exists(script_path): bash_command = [ 'cd', working_directory, '&&', 'bash', '--norc', script_path, ' '.join(option_list) ] if log.getLogFlags().get('run-scripts-in-screen'): # Run scripts in a screen session if requested config_script = Command.call( ['screen', '-t', '-X', 'bash', '-c', ' '.join(bash_command)] ) else: # In standard mode run script through bash config_script = Command.call( ['bash', '-c', ' '.join(bash_command)] ) process = CommandProcess( command=config_script, log_topic='Calling ' + name + ' script' ) result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed( '{0} failed: {1}'.format(name, result.stderr) )
def _call_script(self, name, option_list=None): script_path = os.path.join(self.root_dir, 'image', name) if os.path.exists(script_path): options = option_list or [] if log.getLogFlags().get('run-scripts-in-screen'): # Run scripts in a screen session if requested command = ['screen', '-t', '-X', 'chroot', self.root_dir] else: # In standard mode run scripts without a terminal # associated to them command = ['chroot', self.root_dir] if not Path.access(script_path, os.X_OK): command.append('bash') command.append( os.path.join(defaults.IMAGE_METADATA_DIR, name) ) command.extend(options) profile = Profile(self.xml_state) caller_environment = copy.deepcopy(os.environ) caller_environment.update(profile.get_settings()) config_script = Command.call(command, caller_environment) process = CommandProcess( command=config_script, log_topic='Calling ' + name + ' script' ) result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed( '{0} failed: {1}'.format(name, result.stderr) )
def _call_script_no_chroot(self, name, option_list, working_directory): if not working_directory: working_directory = self.root_dir script_path = os.path.abspath( os.sep.join([self.root_dir, 'image', name])) if os.path.exists(script_path): bash_command = [ 'cd', working_directory, '&&', 'bash', '--norc', script_path, ' '.join(option_list) ] if log.getLogLevel() == logging.DEBUG and not \ Defaults.is_buildservice_worker(): # In debug mode run scripts in a screen session to # allow attaching and debugging config_script = Command.call([ 'screen', '-t', '-X', 'bash', '-c', ' '.join(bash_command) ]) else: # In standard mode run script through bash config_script = Command.call( ['bash', '-c', ' '.join(bash_command)]) process = CommandProcess(command=config_script, log_topic='Calling ' + name + ' script') result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed('{0} failed: {1}'.format( name, result.stderr))
def _call_script(self, name): if os.path.exists(self.root_dir + '/image/' + name): config_script = Command.call( ['chroot', self.root_dir, 'bash', '/image/' + name]) process = CommandProcess(command=config_script, log_topic='Calling ' + name + ' script') result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed('%s failed: %s' % (name, format(result.stderr)))
def _call_script(self, name): script_path = os.path.join(self.root_dir, 'image', name) if os.path.exists(script_path): command = ['chroot', self.root_dir] if not Path.access(script_path, os.X_OK): command += ['bash'] command += ['/image/' + name] config_script = Command.call(command) process = CommandProcess(command=config_script, log_topic='Calling ' + name + ' script') result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed('%s failed: %s' % (name, format(result.stderr)))
def _call_script_no_chroot(self, name, option_list, working_directory): if not working_directory: working_directory = self.root_dir script_path = os.path.abspath( os.sep.join([self.root_dir, 'image', name])) if os.path.exists(script_path): bash_command = [ 'cd', working_directory, '&&', 'bash', '--norc', script_path, ' '.join(option_list) ] config_script = Command.call( ['bash', '-c', ' '.join(bash_command)]) process = CommandProcess(command=config_script, log_topic='Calling ' + name + ' script') result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed('%s failed: %s' % (name, format(result.stderr)))
def _call_script(self, name, option_list=None): script_path = os.path.join(self.root_dir, 'image', name) if os.path.exists(script_path): options = option_list or [] command = ['chroot', self.root_dir] if not Path.access(script_path, os.X_OK): command.append('bash') command.append(os.path.join(defaults.IMAGE_METADATA_DIR, name)) command.extend(options) profile = Profile(self.xml_state) caller_environment = copy.deepcopy(os.environ) caller_environment.update(profile.get_settings()) config_script = Command.call(command, caller_environment) process = CommandProcess(command=config_script, log_topic='Calling ' + name + ' script') result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed('{0} failed: {1}'.format( name, result.stderr))