tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

extend_fvm.py (806B)


      1 # Copyright 2018 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """Copies a FVM file and extends it by a specified amount.
      6 
      7 Arg #1: path to 'fvm'.
      8    #2: the path to the source fvm.blk.
      9    #3: the path that the extended FVM file will be written to.
     10    #4: the additional number of bytes to grow fvm.blk by."""
     11 
     12 import os
     13 import shutil
     14 import subprocess
     15 import sys
     16 
     17 def ExtendFVM(fvm_tool_path, src_path, dest_path, delta):
     18  old_size = os.path.getsize(src_path)
     19  new_size = old_size + int(delta)
     20  shutil.copyfile(src_path, dest_path)
     21  subprocess.check_call([fvm_tool_path, dest_path, 'extend', '--length',
     22                         str(new_size)])
     23  return 0
     24 
     25 if __name__ == '__main__':
     26  sys.exit(ExtendFVM(*sys.argv[1:]))