aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-18 12:39:52 +0300
committerCem Keylan <cem@ckyln.com>2020-05-18 12:39:52 +0300
commit1badd68f39d7e5d3dfe0dc736d9251e68a72b2fe (patch)
tree8e25cf0298bf4f6fc4a162198ecd03da04240e6b
parentb0d40c129dcde67710314365477dec3ef0d1d6c8 (diff)
downloadmkrootfs-1badd68f39d7e5d3dfe0dc736d9251e68a72b2fe.tar.gz
mkrootfs: change method of package installation
This new method speeds up the installation. You can continue installations without rebuilding packages as well. This method, * skips the package if it is already installed. * skips building the package if a prebuilt tarball exists.
-rwxr-xr-xmkrootfs.sh25
1 files changed, 21 insertions, 4 deletions
diff --git a/mkrootfs.sh b/mkrootfs.sh
index 9fc4556..6b065e7 100755
--- a/mkrootfs.sh
+++ b/mkrootfs.sh
@@ -91,10 +91,27 @@ export KISS_PATH="${HOST_REPO_PATH:-/tmp/repo/core}"
msg "Starting build from the PKGS variable"
-# Word Splitting is intentional here, as we are
-# passing package names seperately
-# shellcheck disable=SC2086
-KISS_NOPROMPT=1 KISS_ASROOT=1 kiss b $PKGS
+
+# shellcheck disable=2154
+for pkg in $order; do
+ # Check if the package is already installed and skip.
+ kiss l "$pkg" >/dev/null 2>&1 && continue
+
+ # Get the package directory so we can get version
+ # and release numbers.
+ pkgdir=$(kiss s "$pkg" | sed 1q)
+ read -r ver rel < "$pkgdir/version"
+
+ # Check if a prebuild tarball exists, build the package
+ # if it doesn't exist.
+ #
+ # pkg_order should be dealing with packages in a way that
+ # no prompts are asked, but let's not take any chances
+ # either.
+ [ -f "${XDG_CONFIG_HOME:-$HOME/.cache}/kiss/bin/$pkg#$ver-$rel.tar.${KISS_COMPRESS:-gz}" ] ||
+ KISS_NOPROMPT=1 kiss b "$pkg"
+ KISS_NOPROMPT=1 kiss i "$pkg"
+done
# You can check out about post-installation
# from the configuration file