From bf820f442d68f725d83d809814eeeddddab606a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Sun, 26 Feb 2023 23:02:59 +0100 Subject: [PATCH] install: make cached remote repositories available on first install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Oliver Smith Tested-by: Oliver Smith Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3CPAXP192MB1293A82207F0983ED6C8665EC7AE9@PAXP192MB1293.EURP192.PROD.OUTLOOK.COM%3E --- pmb/install/_install.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 768fa86d..563fc20f 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -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"])