File: 0store-secure-add

package info (click to toggle)
zeroinstall-injector 0.34-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,048 kB
  • ctags: 1,236
  • sloc: python: 10,189; xml: 167; makefile: 34; sh: 16
file content (22 lines) | stat: -rwxr-xr-x 624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python
import sys, os
from zeroinstall import zerostore, SafeException
from zeroinstall.zerostore import cli, manifest

try:
	if 'ENV_NOT_CLEARED' in os.environ:
		raise SafeException("Environment not cleared. Check your sudoers file.")

	if len(sys.argv) != 2:
		raise cli.UsageError('Usage: %s DIGEST' % sys.argv[0])
	required_digest = sys.argv[1]

	manifest_data = file('.manifest').read()

	stores = zerostore.Stores()

	manifest.copy_tree_with_verify('.', stores.get_first_system_store().dir,
					manifest_data, required_digest)
except (IOError, SafeException), ex:
	print >>sys.stderr, ex
	sys.exit(1)