def __init__ (self): Replacement_Dict.__init__ (self) # Install user (root, whell, admin, etc) root_user = InstallUtil.get_installation_UID() root_group = InstallUtil.get_installation_GID() # Server user (www-data, server, nobody, etc) # # Unusual case: getgroups() might return []. We try to cover # the corner case by assuming a safety value of [0] (because # we haven't any other better option, actually). groups = os.getgroups() or [0] groups.sort() server_user = CTK.cfg.get_val ('server!user', str(os.getuid())) server_group = CTK.cfg.get_val ('server!group', str(groups[0])) # Directories app_root = CTK.cfg.get_val ('tmp!market!install!root') # Replacements self['web_user'] = server_user self['web_group'] = server_group self['root_user'] = root_user self['root_group'] = root_group self['app_root'] = app_root
def __init__ (self): Replacement_Dict.__init__ (self) # Install user (root, whell, admin, etc) root_user = InstallUtil.get_installation_UID() root_group = InstallUtil.get_installation_GID() # Server user (www-data, server, nobody, etc) # # Unusual case: getgroups() might return []. We try to cover # the corner case by assuming a safety value of [0] (because # we haven't any other better option, actually). groups = os.getgroups() or [0] groups.sort() server_user = CTK.cfg.get_val ('server!user', str(os.getuid())) server_group = CTK.cfg.get_val ('server!group', str(groups[0])) # Directories app_root = CTK.cfg.get_val ('tmp!market!install!root') # Replacements self['web_user'] = server_user self['web_group'] = server_group self['root_user'] = root_user self['root_group'] = root_group self['app_root'] = app_root
def promptInstall(): GlobalUtils.clear() initJson() for item in jsonInstall: print(item["app"] + "\n-----------------\nINSERT DESCRIPTION!\n") choice = raw_input("Do you want to mark\033[1m " + item["app"] + "\033[0m for install? (y/n)").lower() if choice in yes: mark(item["app"], item["repo"], item["command"]) if markedCommand: choice = raw_input("The following code will now run, are you sure (y/n) \n" + str(markedCommand)).lower() if choice in yes: for item in markedCommand: InstallUtil.call(item) if markedRepo: choice = raw_input("The following repositories will be added, are you sure? (y/n)\n\033[1m" + str(markedRepo) + "\033[0m").lower() if choice in yes: for item in markedRepo: InstallUtil.addRepository(item) InstallUtil.update() else: print("No external repositories are required!") choice = raw_input("Are you sure you want to install the following programs? -\n " + str(markedInstall)) if choice in yes: for item in markedInstall: InstallUtil.install(item) close_json()
def bulkInstall(): initJson() for item in jsonInstall: InstallUtil.forceAddRepository(item["repo"]) InstallUtil.update() for item in root: if item["command"]: InstallUtil.call(item["command"]) InstallUtil.forceInstall(item["app"]) close_json()
def replacement_cmd (command): # Install user (root, whell, admin, etc) root_user = InstallUtil.get_installation_UID() root_group = InstallUtil.get_installation_GID() # Server user (www-data, server, nobody, etc) server_user = CTK.cfg.get_val ('server!user', str(os.getuid())) server_group = CTK.cfg.get_val ('server!group', str(os.getgid())) # Directories app_root = CTK.cfg.get_val ('tmp!market!install!root') # Replacements command = command.replace('${web_user}', server_user) command = command.replace('${web_group}', server_group) command = command.replace('${root_user}', root_user) command = command.replace('${root_group}', root_group) command = command.replace('${app_root}', app_root) return command
def __safe_call__(self): # Ensure the current UID has enough priviledges if not InstallUtil.current_UID_is_admin() and 0: box = CTK.Box() box += CTK.RawHTML('<h2>%s</h2>' % (_(NO_ROOT_H1))) box += CTK.RawHTML('<p>%s</p>' % (_(NO_ROOT_P1))) box += CTK.RawHTML('<p>%s</p>' % (_(NO_ROOT_P2))) buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_('Cancel')) box += buttons return box.Render().toStr() # Check the rest of pre-requisites index = Distro.Index() app_id = CTK.cfg.get_val('tmp!market!install!app!application_id') app = index.get_package(app_id, 'software') inst = index.get_package(app_id, 'installation') if 'cherokee_min_ver' in inst: version = inst['cherokee_min_ver'] if version_cmp(VERSION, version) < 0: box = CTK.Box() box += CTK.RawHTML('<h2>%s</h2>' % (_(MIN_VER_H1))) box += CTK.RawHTML('<p>%s</p>' % (_(MIN_VER_P1) % (locals()))) buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_('Cancel')) box += buttons return box.Render().toStr() # Init the log file Install_Log.reset() Install_Log.log(".---------------------------------------------.") Install_Log.log("| PLEASE, DO NOT EDIT OR REMOVE THIS LOG FILE |") Install_Log.log("| |") Install_Log.log("| It contains useful information that |") Install_Log.log("| cherokee-admin might need in the future. |") Install_Log.log(".---------------------------------------------.") Install_Log.log("Retrieving package information...") # Check whether there are CTK.cfg changes to be saved changes = "01"[int(CTK.cfg.has_changed())] CTK.cfg['tmp!market!install!cfg_previous_changes'] = changes # Render a welcome message box = CTK.Box() box += CTK.RawHTML( js=CTK.DruidContent__JS_to_goto(box.id, URL_INSTALL_DOWNLOAD)) return box.Render().toStr()
def __safe_call__(self): # Ensure the current UID has enough priviledges if not InstallUtil.current_UID_is_admin() and 0: box = CTK.Box() box += CTK.RawHTML("<h2>%s</h2>" % (_(NO_ROOT_H1))) box += CTK.RawHTML("<p>%s</p>" % (_(NO_ROOT_P1))) box += CTK.RawHTML("<p>%s</p>" % (_(NO_ROOT_P2))) buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_("Cancel")) box += buttons return box.Render().toStr() # Check the rest of pre-requisites index = Distro.Index() app_id = CTK.cfg.get_val("tmp!market!install!app!application_id") app = index.get_package(app_id, "software") inst = index.get_package(app_id, "installation") if "cherokee_min_ver" in inst: version = inst["cherokee_min_ver"] if version_cmp(VERSION, version) < 0: box = CTK.Box() box += CTK.RawHTML("<h2>%s</h2>" % (_(MIN_VER_H1))) box += CTK.RawHTML("<p>%s</p>" % (_(MIN_VER_P1) % (locals()))) buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_("Cancel")) box += buttons return box.Render().toStr() # Init the log file Install_Log.reset() Install_Log.log(".---------------------------------------------.") Install_Log.log("| PLEASE, DO NOT EDIT OR REMOVE THIS LOG FILE |") Install_Log.log("| |") Install_Log.log("| It contains useful information that |") Install_Log.log("| cherokee-admin might need in the future. |") Install_Log.log(".---------------------------------------------.") Install_Log.log("Retrieving package information...") # Check whether there are CTK.cfg changes to be saved changes = "01"[int(CTK.cfg.has_changed())] CTK.cfg["tmp!market!install!cfg_previous_changes"] = changes # Render a welcome message box = CTK.Box() box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(box.id, URL_INSTALL_DOWNLOAD)) return box.Render().toStr()
def __init__ (self): Replacement_Dict.__init__ (self) # Install user (root, whell, admin, etc) root_user = InstallUtil.get_installation_UID() root_group = InstallUtil.get_installation_GID() # Server user (www-data, server, nobody, etc) groups = os.getgroups() groups.sort() server_user = CTK.cfg.get_val ('server!user', str(os.getuid())) server_group = CTK.cfg.get_val ('server!group', str(groups[0])) # Directories app_root = CTK.cfg.get_val ('tmp!market!install!root') # Replacements self['web_user'] = server_user self['web_group'] = server_group self['root_user'] = root_user self['root_group'] = root_group self['app_root'] = app_root
def __safe_call__ (self): # Ensure the current UID has enough priviledges if not InstallUtil.current_UID_is_admin(): box = CTK.Box() box += CTK.RawHTML ('<h2>%s</h2>' %(_(NO_ROOT_H1))) box += CTK.RawHTML ('<p>%s</p>' %(_(NO_ROOT_P1))) box += CTK.RawHTML ('<p>%s</p>' %(_(NO_ROOT_P2))) buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_('Cancel')) box += buttons return box.Render().toStr() # Init the log file Install_Log.reset() Install_Log.log (".---------------------------------------------.") Install_Log.log ("| PLEASE, DO NOT EDIT OR REMOVE THIS LOG FILE |") Install_Log.log ("| |") Install_Log.log ("| It contains useful information that |") Install_Log.log ("| cherokee-admin might need in the future. |") Install_Log.log (".---------------------------------------------.") Install_Log.log ("Retrieving package information...") # Check whether there are CTK.cfg changes to be saved changes = "01"[int(CTK.cfg.has_changed())] CTK.cfg['tmp!market!install!cfg_previous_changes'] = changes # Render a welcome message box = CTK.Box() box += CTK.RawHTML ('<h2>%s</h2>' %(_('Connecting to Cherokee Market'))) box += CTK.RawHTML ('<h1>%s</h1>' %(_('Retrieving package information…'))) box += CTK.RawHTML (js = CTK.DruidContent__JS_to_goto (box.id, URL_INSTALL_INIT_CHECK)) # Dialog buttons buttons = CTK.DruidButtonsPanel() buttons += CTK.DruidButton_Close(_('Cancel')) box += buttons return box.Render().toStr()