Merge pull request #207 from CanonicalLtd/cyphermox/snap

Add snapcraft.yaml and some fixes for working as a snap.
This commit is contained in:
Michael Hudson-Doyle 2017-04-06 12:40:45 +12:00 committed by GitHub
commit ae5fee60c6
3 changed files with 58 additions and 6 deletions

41
snapcraft.yaml Normal file
View File

@ -0,0 +1,41 @@
name: subiquity
version: "0.0.35"
summary: Ubuntu installer
description: The Ubuntu server installer
confinement: classic
apps:
subiquity:
command: usr/bin/subiquity
console-conf:
command: usr/bin/console-conf
probert:
command: bin/probert
parts:
subiquity:
plugin: python
build-packages: [python-setuptools]
stage-packages: [curtin]
python-packages:
- urwid
- pyyaml
- pyudev
- attrs
source: https://github.com/CanonicalLtd/subiquity.git
source-branch: cyphermox/snap
source-type: git
wrappers:
plugin: dump
source: https://github.com/CanonicalLtd/subiquity.git
source-type: git
organize:
'bin/console-conf-tui': usr/bin/console-conf
'bin/subiquity-tui': usr/bin/subiquity
snap:
- usr/bin
probert:
plugin: python
build-packages: [python-setuptools, libnl-3-dev, libnl-genl-3-dev, libnl-route-3-dev]
source: https://github.com/CanonicalLtd/probert.git
source-type: git

View File

@ -25,7 +25,7 @@ log = logging.getLogger("subiquity.curtin")
TMPDIR = '/tmp'
CURTIN_SEARCH_PATH = ['/usr/local/curtin/bin', '/usr/bin']
CURTIN_INSTALL_PATH = ['/media/root-ro', '/']
CURTIN_INSTALL_PATH = ['/media/root-ro', '/rofs', '/']
CURTIN_INSTALL_LOG = '/tmp/subiquity-curtin-install.log'
CURTIN_POSTINSTALL_LOG = '/tmp/subiquity-curtin-postinstall.log'
CONF_PREFIX = os.path.join(TMPDIR, 'subiquity-config-')
@ -79,6 +79,9 @@ POST_INSTALL_LIST = [
(" 12_postinst_userdata: [curtin, in-target, --, sh, '-c',"
"\"/bin/echo -e '#cloud-config\\n\\n{hostinfo}\\nusers:\\n{users}' > "
"/var/lib/cloud/seed/nocloud-net/user-data\"]"),
(" 13_postinst_enable_cloud-init: [curtin, in-target, --, sh, '-c',"
'"/bin/echo -e policy: enabled '
'> /etc/cloud/ds-identify.cfg"]'),
]
POST_INSTALL = '\n' + "\n".join(POST_INSTALL_LIST) + '\n'
@ -91,7 +94,7 @@ def curtin_userinfo_to_config(userinfo):
' groups: admin\\n' + \
' lock-passwd: false\\n'
if 'ssh_import_id' in userinfo:
user_template += ' ssh-import-id: [{ssh_import_id}]\\n'
user_template += ' ssh-import-id: [ "{ssh_import_id}" ]\\n'
return user_template.format(**userinfo)

View File

@ -68,10 +68,18 @@ def environment_check(check):
for ftype, items in checks[check_type].items():
for i in items:
if not os.path.exists(i):
log.error('FAIL: {} is not found on the'
' filesystem'.format(i))
env_ok = False
continue
if 'SNAP' in os.environ:
log.warn("Adjusting path for snaps: {}".format(os.environ.get('SNAP')))
i = os.environ.get('SNAP') + i
if not os.path.exists(i):
env_ok = False
else:
env_ok = False
if not env_ok:
log.error('FAIL: {} is not found on the'
' filesystem'.format(i))
continue
if check_map[ftype](i) is False:
log.error('FAIL: {} is NOT of type: {}'.format(i, ftype))
env_ok = False