Merge pull request #396 from mwhudson/include-curtin

include curtin in snap
This commit is contained in:
Michael Hudson-Doyle 2018-11-21 10:34:44 +13:00 committed by GitHub
commit daba9990f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
/bin/dmesg -n 1 /bin/dmesg -n 1
export PATH=$SNAP/bin:$SNAP/usr/bin:$PATH
$SNAP/usr/bin/subiquity-loadkeys $SNAP/usr/bin/subiquity-loadkeys
setfont $SNAP/subiquity.psf setfont $SNAP/subiquity.psf
/sbin/agetty -n --noclear -l $SNAP/usr/bin/python3 -o $SNAP/usr/bin/subiquity tty1 $TERM /sbin/agetty -n --noclear -l $SNAP/usr/bin/python3 -o $SNAP/usr/bin/subiquity tty1 $TERM

View File

@ -19,6 +19,16 @@ apps:
restart-condition: always restart-condition: always
parts: parts:
curtin:
plugin: python
source-type: git
source: git://git.launchpad.net/curtin
source-branch: ubuntu/devel
requirements: requirements.txt
organize:
'lib/python*/site-packages/usr/lib/curtin': 'usr/lib/'
stage: [ "*", "-lib/python*/site-packages/_yaml.*.so" ]
stage-packages: [libc6]
subiquity: subiquity:
plugin: python plugin: python
build-packages: build-packages:
@ -53,11 +63,11 @@ parts:
plugin: dump plugin: dump
build-packages: build-packages:
- user-setup - user-setup
prepare: | override-build: |
echo "get passwd/user-default-groups" | \ echo "get passwd/user-default-groups" | \
debconf-communicate user-setup | \ debconf-communicate user-setup | \
cut -d ' ' -f 2- > users-and-groups cut -d ' ' -f 2- > $SNAPCRAFT_PART_INSTALL/users-and-groups
cp /usr/lib/user-setup/reserved-usernames . cp /usr/lib/user-setup/reserved-usernames $SNAPCRAFT_PART_INSTALL/
stage-packages: [libc6] stage-packages: [libc6]
stage: stage:
- users-and-groups - users-and-groups
@ -69,8 +79,8 @@ parts:
- locales - locales
- xkb-data-i18n - xkb-data-i18n
stage-packages: [libc6] stage-packages: [libc6]
prepare: | override-build: |
/usr/share/console-setup/kbdnames-maker /usr/share/console-setup/KeyboardNames.pl > kbdnames.txt /usr/share/console-setup/kbdnames-maker /usr/share/console-setup/KeyboardNames.pl > $SNAPCRAFT_PART_INSTALL/kbdnames.txt
stage: stage:
- kbdnames.txt - kbdnames.txt
font: font:

View File

@ -41,10 +41,6 @@ checks:
directory: directory:
- /proc - /proc
- /sys - /sys
exec:
file:
- /sbin/hdparm
- /usr/bin/curtin
''' '''

View File

@ -17,6 +17,7 @@ import datetime
import logging import logging
import os import os
import subprocess import subprocess
import sys
import urwid import urwid
import yaml import yaml
@ -86,10 +87,10 @@ class InstallProgressController(BaseController):
self.progress_view.show_complete(True) self.progress_view.show_complete(True)
self.default() self.default()
def _bg_run_command_logged(self, cmd, env): def _bg_run_command_logged(self, cmd):
cmd = ['systemd-cat', '--level-prefix=false', cmd = ['systemd-cat', '--level-prefix=false',
'--identifier=' + self._log_syslog_identifier] + cmd '--identifier=' + self._log_syslog_identifier] + cmd
return utils.run_command(cmd, env=env) return utils.run_command(cmd)
def _journal_event(self, event): def _journal_event(self, event):
if event['SYSLOG_IDENTIFIER'] == self._event_syslog_identifier: if event['SYSLOG_IDENTIFIER'] == self._event_syslog_identifier:
@ -154,7 +155,7 @@ class InstallProgressController(BaseController):
log.debug("Installprogress: this is the *REAL* thing") log.debug("Installprogress: this is the *REAL* thing")
config_location = os.path.join('/var/log/installer', config_location = os.path.join('/var/log/installer',
config_file_name) config_file_name)
curtin_cmd = ['curtin', '--showtrace', '-c', curtin_cmd = [sys.executable, '-m', 'curtin', '--showtrace', '-c',
config_location, 'install'] config_location, 'install']
ident = self._event_syslog_identifier ident = self._event_syslog_identifier
@ -183,11 +184,8 @@ class InstallProgressController(BaseController):
curtin_cmd = self._get_curtin_command() curtin_cmd = self._get_curtin_command()
log.debug('Curtin install cmd: {}'.format(curtin_cmd)) log.debug('Curtin install cmd: {}'.format(curtin_cmd))
env = os.environ.copy()
if 'SNAP' in env:
del env['SNAP']
self.run_in_bg( self.run_in_bg(
lambda: self._bg_run_command_logged(curtin_cmd, env), lambda: self._bg_run_command_logged(curtin_cmd),
self.curtin_install_completed) self.curtin_install_completed)
def curtin_install_completed(self, fut): def curtin_install_completed(self, fut):