From 023095a01aa21a64b1b515d457a9282b8e69ead3 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 17 Jun 2022 22:46:16 -0300 Subject: [PATCH] Usar cache --- .gitignore | 1 + alpine.lua | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 507e3f4..b9b4cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ root/ v00001/ boot/ image.squashfs +cache/ diff --git a/alpine.lua b/alpine.lua index 1add0d3..40d4e3a 100644 --- a/alpine.lua +++ b/alpine.lua @@ -94,12 +94,21 @@ end -- Returns nil when no failure, otherwise string error or apk's status code function alpine.make_world(rootfs_path, packages) + local err = alpine.symlink(rootfs_path, "/etc/apk/cache", "../../../cache") + if err then return err end + local err = alpine.mkdir(rootfs_path, "../cache") + if err then return err end + local err = alpine.write_file(rootfs_path, "/etc/apk/world", utils.join_table(packages, "\n")) if err then return err end - local status = os.execute("sudo apk upgrade --clean-protected --no-cache --root "..rootfs_path) + local status = os.execute("sudo apk upgrade --clean-protected --root "..rootfs_path) + if not (status == 0) then return status end + + local status = os.execute(t("rm {{rootfs_path}}/etc/apk/cache", + { rootfs_path = rootfs_path })) if not (status == 0) then return status end end