install: run alpine-appstream-downloader if available

This makes sure that the AppStream data is available on the built
image. To avoid unnecessary downloads on multiple invocations of
install, create a new cache chroot.

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Tested-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3CPAXP192MB12938C6B570CA56AA162E8A6C7AE9@PAXP192MB1293.EURP192.PROD.OUTLOOK.COM%3E
This commit is contained in:
Pablo Correa Gómez 2023-02-26 22:08:52 +01:00 committed by Oliver Smith
parent f296dc62e5
commit 014509b427
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 22 additions and 0 deletions

View File

@ -216,6 +216,7 @@ chroot_host_path = os.environ["PATH"] + ":/usr/sbin/"
chroot_mount_bind = {
"/proc": "/proc",
"$WORK/cache_apk_$ARCH": "/var/cache/apk",
"$WORK/cache_appstream/$ARCH/$CHANNEL": "/mnt/appstream-data",
"$WORK/cache_ccache_$ARCH": "/mnt/pmbootstrap-ccache",
"$WORK/cache_distfiles": "/var/cache/distfiles",
"$WORK/cache_git": "/mnt/pmbootstrap-git",

View File

@ -370,6 +370,25 @@ def setup_hostname(args):
pmb.chroot.root(args, ["sed", "-i", "-e", regex, "/etc/hosts"], suffix)
def setup_appstream(args):
"""
If alpine-appstream-downloader has been downloaded, execute it to have
update AppStream data on new installs
"""
suffix = "rootfs_" + args.device
installed_pkgs = pmb.chroot.apk.installed(args, suffix)
if "alpine-appstream-downloader" not in installed_pkgs or args.offline:
return
pmb.chroot.root(args, ["alpine-appstream-downloader",
"/mnt/appstream-data"], suffix)
pmb.chroot.root(args, ["mkdir", "-p", "/var/lib/swcatalog"], suffix)
pmb.chroot.root(args, ["cp", "-r", "/mnt/appstream-data/icons",
"/mnt/appstream-data/xml",
"-t", "/var/lib/swcatalog"], suffix)
def disable_sshd(args):
if not args.no_sshd:
return
@ -1013,6 +1032,8 @@ def create_device_rootfs(args, step, steps):
# Set the hostname as the device name
setup_hostname(args)
setup_appstream(args)
disable_sshd(args)
disable_firewall(args)