def install_grubby_if_necessary(path=None):
 installed_grubby = False
 if (path is None):
  if find_executable(GRUBBY_DEFAULT_USER_PATH):
   executable = GRUBBY_DEFAULT_USER_PATH
  else:
   executable = find_executable(GRUBBY_DEFAULT_SYSTEM_PATH)
 else:
  executable = find_executable(path)
 if (executable is None):
  log.info('Installing grubby because it was not found on this system')
  grubby = Grubby()
  path = grubby.grubby_install()
  installed_grubby = True
 else:
  grubby = Grubby(executable)
  current_version = grubby.get_grubby_version()
  if (current_version is None):
   log.error('Could not find version for grubby executable "%s"', executable)
   path = grubby.grubby_install()
   installed_grubby = True
  elif (current_version < GRUBBY_REQ_VERSION):
   log.info('Installing grubby because currently installed version (%s.%s) is not recent enough', current_version[0], current_version[1])
   path = grubby.grubby_install()
   installed_grubby = True
 if installed_grubby:
  grubby = Grubby(path)
  installed_version = grubby.get_grubby_version_raw()
  log.debug('Installed: %s', installed_version)

def install_grubby_if_necessary ( path = None ) : installed_grubby = False if ( path is None ) : if find_executable ( GRUBBY_DEFAULT_USER_PATH ) : executable = GRUBBY_DEFAULT_USER_PATH else : executable = find_executable ( GRUBBY_DEFAULT_SYSTEM_PATH ) else : executable = find_executable ( path ) if ( executable is None ) : log . info ( 'Installing grubby because it was not found on this system' ) grubby = Grubby ( ) path = grubby . grubby_install ( ) installed_grubby = True else : grubby = Grubby ( executable ) current_version = grubby . get_grubby_version ( ) if ( current_version is None ) : log . error ( 'Could not find version for grubby executable "%s"' , executable ) path = grubby . grubby_install ( ) installed_grubby = True elif ( current_version < GRUBBY_REQ_VERSION ) : log . info ( 'Installing grubby because currently installed version (%s.%s) is not recent enough' , current_version [ 0 ] , current_version [ 1 ] ) path = grubby . grubby_install ( ) installed_grubby = True if installed_grubby : grubby = Grubby ( path ) installed_version = grubby . get_grubby_version_raw ( ) log . debug ( 'Installed: %s' , installed_version )
installs grubby if its necessary on this system or if the required version is not sufficient for the needs of boottool .