Massive refactoring for tasks system.
[zeroinstall/zeroinstall-rsl.git] / 0store-secure-add
blob0047fb3bfaeaa515f9f6574930141819b4e575e9
1 #!/usr/bin/env python
2 import sys, os
3 from zeroinstall import zerostore, SafeException
4 from zeroinstall.zerostore import cli, manifest
6 try:
7 if 'ENV_NOT_CLEARED' in os.environ:
8 raise SafeException("Environment not cleared. Check your sudoers file.")
10 if len(sys.argv) != 2:
11 raise cli.UsageError('Usage: %s DIGEST' % sys.argv[0])
12 required_digest = sys.argv[1]
14 manifest_data = file('.manifest').read()
16 stores = zerostore.Stores()
18 manifest.copy_tree_with_verify('.', stores.get_first_system_store().dir,
19 manifest_data, required_digest)
20 except (IOError, SafeException), ex:
21 print >>sys.stderr, ex
22 sys.exit(1)