def main(): product_name = sys.argv[1] buildid = sys.argv[2] platform = sys.argv[3] update_dir = sys.argv[4] update_config = sys.argv[5] config = parse_config(update_config) upload_url = replace_variables_in_string(config.upload_url, channel=config.channel, buildid=buildid, platform=platform) target_url, target_dir = upload_url.split(':') command = "ssh %s 'mkdir -p %s'"%(target_url, target_dir) print(command) subprocess.call(command, shell=True) for file in os.listdir(update_dir): if file.endswith('.mar'): subprocess.call(['scp', convert_to_unix(os.path.join(update_dir, file)), upload_url])
def main(): product_name = sys.argv[1] buildid = sys.argv[2] platform = sys.argv[3] update_dir = sys.argv[4] update_config = sys.argv[5] config = parse_config(update_config) upload_url = replace_variables_in_string(config.upload_url, channel=config.channel, buildid=buildid, platform=platform) target_url, target_dir = upload_url.split(':') command = "ssh %s 'mkdir -p %s'" % (target_url, target_dir) print(command) subprocess.call(command, shell=True) for file in os.listdir(update_dir): if file.endswith('.mar'): subprocess.call([ 'scp', convert_to_unix(os.path.join(update_dir, file)), upload_url ])
import sys import hashlib import os import subprocess import errno import json from config import parse_config from uncompress_mar import extract_mar from tools import get_file_info, get_hash from signing import sign_mar_file from path import UpdaterPath, mkdir_p, convert_to_unix, convert_to_native BUF_SIZE = 1024 current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__))) class InvalidFileException(Exception): def __init__(self, *args, **kwargs): super().__init__(self, *args, **kwargs) def download_file(filepath, url, hash_string): with open(filepath, "wb") as f: response = requests.get(url, stream=True) if not response.ok: return for block in response.iter_content(1024):
import sys import hashlib import os import subprocess import errno import json from config import parse_config from uncompress_mar import extract_mar from tools import get_file_info, get_hash from signing import sign_mar_file from path import UpdaterPath, mkdir_p, convert_to_unix, convert_to_native BUF_SIZE = 1024 current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__))) class InvalidFileException(Exception): def __init__(self, *args, **kwargs): super().__init__(self, *args, **kwargs) def download_file(filepath, url, hash_string): with open(filepath, "wb") as f: response = requests.get(url, stream=True) if not response.ok: return for block in response.iter_content(1024): f.write(block)