Security fix: hard-code /var/cache/0install.net/implementations in 0store-secure-add
[zeroinstall.git] / 0store-secure-add
blobcff307da8b135eb64b48344a32dc781f3f8177c3
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('.', '/var/cache/0install.net/implementations',
19 manifest_data, required_digest)
20 except (IOError, SafeException), ex:
21 print >>sys.stderr, ex
22 sys.exit(1)