Ejemplo n.º 1
0
def cisco79xx_install_locale(xfile, user_locale, create_7905font_file):
    signed_path = xfile.path
    
    # 1. Unsign
    signed_f = open(signed_path, 'rb')
    (unsigned_fd, unsigned_path) = tempfile.mkstemp()
    unsigned_f = os.fdopen(unsigned_fd, 'wb')
    try:
        unsign_from_fileobj(signed_f, unsigned_f)
    finally:
        signed_f.close()
        unsigned_f.close()
    # 2. Extract the first tar
    untar_dir1 = fetchfw.tgz_extract_all('79xx_lang1', unsigned_path)
    # 3. Find the second tar and extract it
    tar_path2 = glob.glob(os.path.join(untar_dir1, '*.tar'))[0]
    untar_dir2 = fetchfw.tar_extract_all('79xx_lang2', tar_path2)
    # 4. Copy the file into tftpboot
    src_base_dir = os.path.join(untar_dir2, 'usr', 'local', 'cm', 'tftp')
    src_dir = user_locale
    dest_dir = user_locale
    locale_path = os.path.join(fetchfw.TFTP_PATH, 'Cisco/i18n', dest_dir)
    distutils.dir_util.copy_tree(os.path.join(src_base_dir, src_dir),
                                 locale_path)
    # 5. Create an empty 7905-font.xml
    if create_7905font_file:
        path_7905font = os.path.join(locale_path, '7905-font.xml')
        if not os.path.isfile(path_7905font):
            f = open(path_7905font, 'w')
            try:
                f.write('<Glyphs></Glyphs>\n')
            finally:
                f.close()
Ejemplo n.º 2
0
def digium_install(firmware):
    xfile = firmware.remote_files[0]
    tgz_path = fetchfw.tgz_extract_all("digium_fw", xfile.path)
    fw_dst_dir = fetchfw.KFW_PATH
    
    for fw_file in os.listdir(tgz_path):
        fw_src_path = os.path.join(tgz_path, fw_file)
        fw_dst_path = os.path.join(fw_dst_dir, fw_file)
        shutil.copy2(fw_src_path, fw_dst_path)
Ejemplo n.º 3
0
def sangoma_echocan_install(firmware):
    xfile = firmware.remote_files[0]
    tgz_path = fetchfw.tgz_extract_all("sangoma_echocan", xfile.path)
    
    fetchfw.makedirs(SANGOMA_ECHOCAN_PATH)
    
    for root, dirs, files, in os.walk(tgz_path):
        for fw_file in files:
            if fw_file[-4:] == ".ima":
                fw_src_path = os.path.join(tgz_path, root, fw_file)
                shutil.copy2(fw_src_path, SANGOMA_ECHOCAN_PATH)