def check_env(self): # check for root user euid = os.geteuid() # check for package manager (apt) aptitude = cmdutils.which("/usr/bin/apt-get") and cmdutils.which("/usr/bin/aptitude") if euid != 0: print(messages.FATAL.NOT_ROOT) self._exit(1) if not aptitude: print(messages.WARN.FOR_DEBIAN)
def check_env(self): # check for root user euid = os.geteuid() # check for package manager (apt) aptitude = cmdutils.which('/usr/bin/apt-get') and \ cmdutils.which('/usr/bin/aptitude') if euid != 0: print(messages.FATAL.NOT_ROOT) self._exit(1) if not aptitude: print(messages.WARN.FOR_DEBIAN)
def install(self): if os.path.exists('/etc/npmanager.conf'): print(messages.FATAL.ALREADY_INSTALLED) sys.exit(0) self.packages['nginx'].select() self.packages['php'].select() self.packages['mariadb'].select() time.sleep(1) pyapt = cmdutils.which('/usr/bin/add-apt-repository') if not pyapt: print(messages.INFO.INSTALL_PYAPT) self.packages.get('pyapt').execute() self.packages.get('nginx').execute() self.packages.get('php').execute() self.packages.get('mariadb').execute() self.packages.get('pma').execute() with open('/etc/npmanager.conf', 'w') as fd: fd.write('\n')
def install(self): if os.path.exists("/etc/npmanager.conf"): print(messages.FATAL.ALREADY_INSTALLED) sys.exit(0) self.packages["nginx"].select() self.packages["php"].select() self.packages["mariadb"].select() time.sleep(1) pyapt = cmdutils.which("/usr/bin/add-apt-repository") if not pyapt: print(messages.INFO.INSTALL_PYAPT) self.packages.get("pyapt").execute() self.packages.get("nginx").execute() self.packages.get("php").execute() self.packages.get("mariadb").execute() self.packages.get("pma").execute() with open("/etc/npmanager.conf", "w") as fd: fd.write("\n")