Beispiel #1
0
def mount(volume, where, pw=None, validator=os.path.isdir, timeout=15):
    dictionary = { 'app': APP, 'volume': volume, 'where': where }
    out(utils.replacekeys('Mounting ${volume} at ${where} ...', dictionary))
    if pw is None:
      cmd = utils.replacekeys(COMMANDS['mount'], dictionary)
    else:
      dictionary.update({'pw': pw})
      cmd = utils.replacekeys(COMMANDS['mountpw'], dictionary)
    os.system(cmd)
    return wait(lambda: validator(where), timeout)
Beispiel #2
0
def call(argv):
    parser = argparse.ArgumentParser(prog='truecrypt')
    subparsers = parser.add_subparsers(dest='cmd')
    for key, cmd in COMMANDS.items():
      subparser = subparsers.add_parser(key)
      for arg in re.findall(r"\$\{([A-Za-z0-9_]+)\}", cmd)[1:]:
        subparser.add_argument(arg)
    try:
      args = vars(parser.parse_args(argv))
    except SystemExit:
      return
    cmd = args.pop('cmd')
    args['app'] = APP
    os.system(utils.replacekeys(COMMANDS[cmd], args))
Beispiel #3
0
def dismountall():
    dictionary = { 'app': APP }
    out('Dismounting all ...')
    os.system(utils.replacekeys(COMMANDS['dismountall'], dictionary))
Beispiel #4
0
def dismount(where):
    dictionary = { 'app': APP, 'where': where }
    out(utils.replacekeys('Dismounting ${where} ...', dictionary))
    os.system(utils.replacekeys(COMMANDS['dismount'], dictionary))
Beispiel #5
0
def automount(volume):
    dictionary = { 'app': APP, 'volume': volume }
    out(utils.replacekeys('Mounting ${volume} ...', dictionary))
    os.system(utils.replacekeys(COMMANDS['automount'], dictionary))