Esempio n. 1
0
def cleanup(code, log):
    if util.check_folder(os.path.join(util.get_script_path(), "tmp"), logger,
                         False, False):
        if not util.delete_folder(os.path.join(util.get_script_path(), "tmp"),
                                  logger, True):
            log.error("%s does exist and can not be deleted." %
                      os.path.join(util.get_script_path(), "tmp"))
            sys.exit(-1)
    sys.exit(code)
Esempio n. 2
0
def cleanup(code, log):
    if util.check_folder(os.path.join(util.get_script_path(), "tmp"), logger, False, False):
        if not util.delete_folder(os.path.join(util.get_script_path(), "tmp"), logger, True):
            log.error("%s does exist and can not be deleted." % os.path.join(util.get_script_path(), "tmp"))
            sys.exit(-1)
    sys.exit(code)
Esempio n. 3
0
        True).decode('utf-8').replace("\n", "")
    if result is None:
        logger.error("Error while running '%s'." %
                     "dpkg -l | grep '%s' | grep -E -o '%s'" %
                     (args.ide, supportedIDEs[args.ide][1]))
        sys.exit(-1)
    if result != version.group() and result != "":
        print("There is a newer version (%s) than installed (%s) available!" %
              (version.group(), result))
        sys.exit(1)
    if result == "":
        print("%s %s is not installed." % (args.ide, args.edition))
    sys.exit(0)

# Checking folders
if not util.check_folder(os.path.join(util.get_script_path(), "output"),
                         logger, False, True):
    if not util.create_folder(os.path.join(util.get_script_path(), "output")):
        logger.error("%s does not exist and can not be created." %
                     os.path.join(util.get_script_path(), "output"))
        sys.exit(-1)

if util.check_folder(os.path.join(util.get_script_path(), "tmp"), logger,
                     False, True):
    if not util.delete_folder(os.path.join(util.get_script_path(), "tmp"),
                              logger, True):
        logger.error("%s does exist and can not be deleted." %
                     os.path.join(util.get_script_path(), "tmp"))
        sys.exit(-1)

for folder in [
Esempio n. 4
0
if args.check:
    result = util.run_cmd("dpkg -l | grep '%s' | grep -E -o '%s' | cat" %
                          (args.ide, supportedIDEs[args.ide][1]), logger, True, True).decode('utf-8').replace("\n", "")
    if result is None:
        logger.error("Error while running '%s'." % "dpkg -l | grep '%s' | grep -E -o '%s'" %
                     (args.ide, supportedIDEs[args.ide][1]))
        sys.exit(-1)
    if result != version.group() and result != "":
        print("There is a newer version (%s) than installed (%s) available!" % (version.group(), result))
        sys.exit(1)
    if result == "":
        print("%s %s is not installed." % (args.ide, args.edition))
    sys.exit(0)

# Checking folders
if not util.check_folder(os.path.join(util.get_script_path(), "output"), logger, False, True):
    if not util.create_folder(os.path.join(util.get_script_path(), "output")):
        logger.error("%s does not exist and can not be created." % os.path.join(util.get_script_path(), "output"))
        sys.exit(-1)

if util.check_folder(os.path.join(util.get_script_path(), "tmp"), logger, False, True):
    if not util.delete_folder(os.path.join(util.get_script_path(), "tmp"), logger, True):
        logger.error("%s does exist and can not be deleted." % os.path.join(util.get_script_path(), "tmp"))
        sys.exit(-1)

for folder in [os.path.join(util.get_script_path(), "tmp"),
               os.path.join(util.get_script_path(), "tmp", "root", "usr", "share", "jetbrains", args.ide),
               os.path.join(util.get_script_path(), "tmp", "root", "usr", "share", "applications"),
               os.path.join(util.get_script_path(), "tmp", "root", "usr", "bin"),
               os.path.join(util.get_script_path(), "tmp", "root", "etc", args.ide),
               os.path.join(util.get_script_path(), "tmp", "root", "etc", "sysctl.d"),