예제 #1
0
파일: up.py 프로젝트: rrader/pstor
def up(**args):
    if pstor.mounted():
        raise exceptions.PstorException("Already up")

    password = args['pass']
    if not password:
        password = getpass.getpass()

    for remote in os.listdir('.pstor/remotes'):
        remote = get_remote_by_name(remote)
        print remote.name() + "... ",
        sys.stdout.flush()
        remote.up()
        print "UP"

    cwd = os.getcwd()
    print "EncFS... ",
    sys.stdout.flush()
    sh.encfs(os.path.join(cwd,'.pstor/encrypted'),
             os.path.join(cwd,'files'),
             extpass="******" % password)
    print "UP"
예제 #2
0
파일: init.py 프로젝트: rrader/pstor
def init(**args):
    if os.path.isdir(".pstor"):
        raise exceptions.PstorException("Already initialized.")
    else:
        password = args['pass']
        if not password and not args['exists']:
            password = getpass.getpass()

        os.mkdir(".pstor")
        os.mkdir(".pstor/remotes")
        os.mkdir(".pstor/encrypted")
        os.mkdir("files")

        cwd = os.getcwd()
        if not args['exists']:
            sh.encfs(os.path.join(cwd,'.pstor/encrypted'),
                     os.path.join(cwd,'files'),
                     paranoia=True, extpass="******" % password)
            sleep(1)
            sh.fusermount('-u', 'files')

        # sh.cp(sh.glob(os.path.join(cwd,'.pstor/data/*')), cwd, symbolic_link=True, recursive=True)

        print "Now you can add remote for this pstore with\n $ pstor remote --add"