Exemplo n.º 1
0
def uninstall(programName):
  print("Uninstalling "+programName)
  if dockerImages.isProgramsImageInstalled(programName):
    while not docker.runDocker(["rmi","subuser-"+programName]) == 0:
      if not raw_input("Once you have solved the problem either type [y] to continue, or [q] to exit: ") == 'y':
        sys.exit()
  if os.path.exists(paths.getExecutablePath(programName)):
    os.remove(paths.getExecutablePath(programName))

  registry.unregisterProgram(programName)
  programHomeDir=paths.getProgramHomeDirOnHost(programName)
  if os.path.exists(programHomeDir):
    print("The program has been uninstalled but it's home directory remains:")
    print(programHomeDir)
  print(programName+" uninstalled successfully.")
Exemplo n.º 2
0
def installExecutable(programName):
  redirect="""#!/bin/bash\nsubuser run {0} $@\n""".format(programName)
  executablePath=paths.getExecutablePath(programName)
  with open(executablePath, 'w') as file_f:
    file_f.write(redirect)
    st = os.stat(executablePath)
    os.chmod(executablePath, stat.S_IMODE(st.st_mode) | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
Exemplo n.º 3
0
def uninstall(programName):
    print("Uninstalling " + programName)
    if dockerImages.isProgramsImageInstalled(programName):
        while not docker.runDocker(["rmi", "subuser-" + programName]) == 0:
            if not raw_input(
                    "Once you have solved the problem either type [y] to continue, or [q] to exit: "
            ) == 'y':
                sys.exit()
    if os.path.exists(paths.getExecutablePath(programName)):
        os.remove(paths.getExecutablePath(programName))

    registry.unregisterProgram(programName)
    programHomeDir = paths.getProgramHomeDirOnHost(programName)
    if os.path.exists(programHomeDir):
        print(
            "The program has been uninstalled but it's home directory remains:"
        )
        print(programHomeDir)
    print(programName + " uninstalled successfully.")
Exemplo n.º 4
0
def installExecutable(programName):
  """
Install a trivial executable script into the PATH which launches the subser program.
  """
  redirect="""#!/bin/bash
subuser run """+programName+""" $@
"""
  executablePath=paths.getExecutablePath(programName)
  with open(executablePath, 'w') as file_f:
    file_f.write(redirect)
    st = os.stat(executablePath)
    os.chmod(executablePath, stat.S_IMODE(st.st_mode) | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)