diff --git a/install.sh b/install.sh index b146c1c..d1981d3 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -eval python3 preinstall +# eval python3 preinstall eval "pip install -r requirements.txt" eval python3 installer diff --git a/installer b/installer index 974ba62..ddd140d 100755 --- a/installer +++ b/installer @@ -216,6 +216,21 @@ class SystemInstaller: messages = messages + ["Log file written to " + log_file.__str__()] +class RequiredPackages: + def __init__(self, bins): + self.required = bins + self.to_be_installed = [] + self.locate() + + def locate(self): + for bin in self.required: + if os.path.isfile(bin[1]): + continue + else: + self.to_be_installed.append(bin[0]) + return self.to_be_installed + + config = Configuration().open_file() sysinstall = SystemInstaller() installer = sysinstall.bin @@ -350,6 +365,21 @@ if RequiredServices().db_server_found(req) is False: psql_cmd, ] +""" +Check existance of required binaries. +Attempt to acquire them if non existant +""" +package_list = [["gcc", "/usr/bin/gcc"]] + +packages, required_packages = "", RequiredPackages(package_list) +for package in required_packages.to_be_installed: + packages = packages + package + " " +try: + ret = run(["sudo", "pacman", "-S", packages[0:-1]], capture_output=True) + print(ret) +except Exception as e: + ret = run(["pacman", "-S", packages[0:-1]], capture_output=True) + print(ret) # Post install configurations sysinstall.make_nginx_config(install_answers)