3 from __future__
import print_function
6 from zeroinstall
import zerostore
, SafeException
7 from zeroinstall
.zerostore
import cli
, manifest
9 # Make all system files world-readable, even if the default
10 # system umask is more strict.
13 # import logging; logging.getLogger().setLevel(logging.DEBUG)
16 if 'ENV_NOT_CLEARED' in os
.environ
:
17 raise SafeException("Environment not cleared. Check your sudoers file.")
18 if os
.environ
['HOME'] == 'Unclean':
19 raise SafeException("$HOME not set. Check your sudoers file has 'always_set_home' turned on for zeroinst.")
21 if len(sys
.argv
) != 2:
22 raise cli
.UsageError('Usage: %s DIGEST' % sys
.argv
[0])
23 required_digest
= sys
.argv
[1]
25 manifest_data
= open('.manifest', 'rb').read()
27 stores
= zerostore
.Stores()
29 manifest
.copy_tree_with_verify('.', '/var/cache/0install.net/implementations',
30 manifest_data
, required_digest
)
31 except (IOError, SafeException
) as ex
:
32 print(ex
, file=sys
.stderr
)