install: make cached remote repositories available on first install

This allows the usage of APK (and apk-polkit-rs) on first boot without
the need to establish an internet connection.

Closes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2206

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/%3CPAXP192MB1293A82207F0983ED6C8665EC7AE9@PAXP192MB1293.EURP192.PROD.OUTLOOK.COM%3E
This commit is contained in:
Pablo Correa Gómez 2023-02-26 23:02:59 +01:00 committed by Oliver Smith
parent 014509b427
commit bf820f442d
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 9 additions and 2 deletions

View File

@ -164,8 +164,8 @@ def create_home_from_skel(args):
def configure_apk(args):
"""
Copy over all official keys, and the keys used to compile local packages
(unless --no-local-pkgs is set). Then disable the /mnt/pmbootstrap-packages
repository.
(unless --no-local-pkgs is set). Then copy the corresponding APKINDEX files
and remove the /mnt/pmbootstrap-packages repository.
"""
# Official keys
pattern = f"{pmb.config.apk_keys_path}/*.pub"
@ -179,6 +179,13 @@ def configure_apk(args):
for key in glob.glob(pattern):
pmb.helpers.run.root(args, ["cp", key, rootfs + "/etc/apk/keys/"])
# Copy over the corresponding APKINDEX files from cache
index_files = pmb.helpers.repo.apkindex_files(args,
arch=args.deviceinfo["arch"],
user_repository=False)
for f in index_files:
pmb.helpers.run.root(args, ["cp", f, rootfs + "/var/cache/apk/"])
# Disable pmbootstrap repository
pmb.helpers.run.root(args, ["sed", "-i", r"/\/mnt\/pmbootstrap-packages/d",
rootfs + "/etc/apk/repositories"])