3 from zeroinstall
import zerostore
, SafeException
4 from zeroinstall
.zerostore
import cli
, manifest
6 # import logging; logging.getLogger().setLevel(logging.DEBUG)
9 if 'ENV_NOT_CLEARED' in os
.environ
:
10 raise SafeException("Environment not cleared. Check your sudoers file.")
11 if os
.environ
['HOME'] == 'Unclean':
12 raise SafeException("$HOME not set. Check your sudoers file has 'always_set_home' turned on for zeroinst.")
14 if len(sys
.argv
) != 2:
15 raise cli
.UsageError('Usage: %s DIGEST' % sys
.argv
[0])
16 required_digest
= sys
.argv
[1]
18 manifest_data
= file('.manifest', 'rb').read()
20 stores
= zerostore
.Stores()
22 manifest
.copy_tree_with_verify('.', '/var/cache/0install.net/implementations',
23 manifest_data
, required_digest
)
24 except (IOError, SafeException
), ex
:
25 print >>sys
.stderr
, ex