Пример #1
0
    print zip_file + " was downloaded"
    return zip_file


if __name__ == "__main__":
    # Check to make sure we're root. We need to be able to create symlinks and other things
    if (os.getuid() is not 0):
        exit("Cannot run script without root permissions. Please run this script as root.")
    # Download jmeter .tgz file.
    jmeter_tar_file = download_jmeter()
    setup_core.extract_tar(jmeter_tar_file)
    # extracted_tar_directory = os.path.splitext(jmeter_tar_file)[0]
    extracted_tar_directory = setup_core.base_filename(jmeter_tar_file)
    # Download plugin .zip file
    plugin_zip_file = download_plugin()
    setup_core.extract_zip(plugin_zip_file, extracted_tar_directory)
    print "".join([plugin_zip_file, " was extracted to ", extracted_tar_directory])
    # Move to /usr/local
    print "Moving to /usr/local/"
    installed_directory = "/usr/local/" + extracted_tar_directory
    if (os.path.exists(installed_directory)):
        print "(Removing previous installation with identical folder name)"
        shutil.rmtree(installed_directory)
    shutil.move(extracted_tar_directory, installed_directory)
    # Creating/Updating symlink
    symlink_directory = "/opt/jmeter"
    if (os.path.islink(symlink_directory)):
        print "Updating symlink: " + symlink_directory
        os.unlink(symlink_directory)
    else:
        print "Creating symlink: " + symlink_directory
Пример #2
0

def install_plugin(plugin_url, plugin_identifier):
    "".join(["/opt/eclipse/"])
    os.system()
    pass


if __name__ == "__main__":
    # Check to make sure we're root. We need to be able to create symlinks and other things
    # if (os.getuid() is not 0):
    #     exit("Cannot run script without root permissions. Please run this script as root.")
    eclipse_archive_file = download_eclipse()
    eclipse_folder_name = setup_core.base_filename(eclipse_archive_file)
    if ".zip" in eclipse_archive_file:
        setup_core.extract_zip(eclipse_archive_file)
    elif ".tar" in eclipse_archive_file:
        setup_core.extract_tar(eclipse_archive_file)
    installed_directory = "/usr/local/" + eclipse_folder_name
    print "Moving to ", installed_directory
    if os.path.exists(installed_directory):
        print "(Removing previous installation with identical folder name)"
    shutil.move("eclipse", installed_directory)
    symlink_directory = "/opt/eclipse"
    if os.path.islink(symlink_directory):
        print "Updating symlink: " + symlink_directory
        os.unlink(symlink_directory)
    else:
        print "Creating symlink: " + symlink_directory
    os.symlink(installed_directory, symlink_directory)