Commit 8c2575b4 authored by Frederic Danis's avatar Frederic Danis

Add pre_apt_script

This allows to perform actions before 'apt action' run.
Signed-off-by: Frederic Danis's avatarFrédéric Danis <frederic.danis@collabora.com>
parent 8af5d311
......@@ -4,6 +4,7 @@
{{- $suite := or .suite "stretch" -}}
{{- $flatpak_arch := or .flatpak_arch $architecture -}}
{{- $packages := or .packages "" -}}
{{- $pre_apt_script := or .pre_apt_script "" -}}
{{- $post_script := or .post_script "" -}}
{{- $sdk := or .sdk false -}}
{{- $sdk_packages := or .sdk_packages "" -}}
......@@ -54,6 +55,13 @@ actions:
chroot: false
command: 'echo; "$RECIPEDIR/prepare-runtime" "$ROOTDIR"'
{{ if $pre_apt_script }}
- action: run
label: pre_apt_script
chroot: true
script: '{{ $pre_apt_script }}'
{{ end }}
{{ if $packages }}
- action: run
label: apt-install
......
......@@ -1123,6 +1123,20 @@ class Builder:
argv.append('-t')
argv.append('post_script:post_script')
pre_apt_script = self.runtime_details.get('pre_apt_script', '')
if pre_apt_script:
dest = os.path.join(scratch, 'pre_apt_script')
with open(dest, 'w', encoding='utf-8') as writer:
writer.write('#!/bin/sh\n')
writer.write(pre_apt_script)
writer.write('\n')
os.chmod(dest, 0o755)
argv.append('-t')
argv.append('pre_apt_script:pre_apt_script')
if sdk:
sources_tarball = sources_prefix + '.tar.gz'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment