diff --git a/run-build b/run-build index e7379659..19153955 100755 --- a/run-build +++ b/run-build @@ -77,6 +77,7 @@ class ImageBuildRoot(object): # Optional mounts dependent on existence on the host optional_mounts = [ config['build']['sysconfdir'], + '/ostree/repo', ] # Include local settings directory if provided @@ -179,9 +180,9 @@ class ImageBuildRoot(object): # Really mount the directories for path in to_mount: - self.mount(path) + self.mount(path, read_only=(path == '/ostree/repo')) - def mount(self, path, target=None): + def mount(self, path, target=None, read_only=False): """Bind mount path in the build directory""" if not os.path.isabs(path): raise eib.ImageBuildError('Buildroot mount path', path, @@ -206,6 +207,8 @@ class ImageBuildRoot(object): with open(mount_path, 'w'): pass subprocess.check_call(['mount', '--bind', path, mount_path]) + if read_only: + subprocess.check_call(['mount', '-o', 'remount,bind,ro', path, mount_path]) def __enter__(self): return self diff --git a/stages/eib_ostree b/stages/eib_ostree index c859323c..1bbae8e7 100755 --- a/stages/eib_ostree +++ b/stages/eib_ostree @@ -27,7 +27,14 @@ ostree --repo="${EIB_OSTREE_REPODIR}" remote delete --if-exists \ ostree --repo="${EIB_OSTREE_REPODIR}" remote add \ --set=gpg-verify-summary=true \ ${EIB_OSTREE_REMOTE} ${BUILD_OSTREE_URL} ${EIB_OSTREE_REF} +if [ -d /ostree/repo ] +then + extra_pull_args=(--localcache-repo /ostree/repo) +else + extra_pull_args=() +fi eib_retry ostree --repo="${EIB_OSTREE_REPODIR}" pull \ + ${extra_pull_args[@]} \ ${EIB_OSTREE_REMOTE} ${EIB_OSTREE_REF} # Recreate the ref locally so that the deploy can pull from it