diff options
author | B Stack <bgstack15@gmail.com> | 2019-07-06 22:11:04 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-07-06 22:11:04 -0400 |
commit | 9ccb5ef5c45e6febe636ded3ada7d3d518bdfa5a (patch) | |
tree | 58290394adc3d172b4dbb5eb45078321b654009e | |
parent | add apt: list, list available, list installed (diff) | |
download | ssp-9ccb5ef5c45e6febe636ded3ada7d3d518bdfa5a.tar.gz ssp-9ccb5ef5c45e6febe636ded3ada7d3d518bdfa5a.tar.bz2 ssp-9ccb5ef5c45e6febe636ded3ada7d3d518bdfa5a.zip |
-rwxr-xr-x | ssp | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -143,8 +143,27 @@ def install_(action, pkg_mgr, args, repos, assume): # if regex.match(str(line)): # print(line.decode('UTF-8','backslashreplace')) elif pkg_mgr == "apt": - eprint("install_ for " + pkg_mgr + "not yet implemented.") - sys.exit(1) + # because apt does not have a --disablerepo mechanism, we will only allow arguments that are listed from this repo. + command_array=["apt-get","install"] + final_list=[] + allowed_list = list_("list", pkg_mgr, args, repos) + for item in args: + if item in allowed_list: + final_list.append(item) + else: + # a package that is not in the specially-approved repo, so... + print("Package not found:",item) + #print(final_list) + for item in final_list: + command_array.append(item) + #print(command_array) + try: + __completedprocess = subprocess.run(command_array) + except subprocess.CalledProcessError as e: + #print(str(e.output)) + pass + if __completedprocess.stdout is not None: + print(__completedprocess.stdout) # wrap around yum remove [*], def remove_(pkg_mgr, args, repos, assume): |