aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-18 12:31:21 +0300
committerCem Keylan <cem@ckyln.com>2020-05-18 12:31:21 +0300
commitb0d40c129dcde67710314365477dec3ef0d1d6c8 (patch)
tree5f4973712d67f951106d4f6459ad892fb421e390
parenta1acebc4ca699da837c1f063983e9aa046ed75af (diff)
downloadmkrootfs-b0d40c129dcde67710314365477dec3ef0d1d6c8.tar.gz
mkrootfs: do not clone the same repository twice
-rwxr-xr-xmkrootfs.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/mkrootfs.sh b/mkrootfs.sh
index ad06a41..9fc4556 100755
--- a/mkrootfs.sh
+++ b/mkrootfs.sh
@@ -77,12 +77,16 @@ export KISS_ROOT="$MNTDIR"
# Check whether REPO and REPO_PATH variables exist
[ "$REPO" ] || die "REPO variable is not set"
-# Remove if /tmp/repo already exists
-rm -rf /tmp/repo
+# Create parent directories for the repositories, and
+# remove pre-existing repositories. We then shallow
+# clone the repositories to both locations.
+msg "Cloning repository"
+mkdir -p "$MNTDIR/var/db/kiss" /tmp
+rm -rf /tmp/repo "$MNTDIR/var/db/kiss/repo"
git clone --depth 1 "$REPO" /tmp/repo
-msg "Cloning repository to /var/db/kiss/repo"
-rm -rf "$MNTDIR/var/db/kiss/repo"
-git clone --depth 1 "$REPO" "$MNTDIR/var/db/kiss/repo"
+cp -r /tmp/repo "$MNTDIR/var/db/kiss/repo"
+
+# We export the new KISS_PATH
export KISS_PATH="${HOST_REPO_PATH:-/tmp/repo/core}"
msg "Starting build from the PKGS variable"