From b0d40c129dcde67710314365477dec3ef0d1d6c8 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 18 May 2020 12:31:21 +0300 Subject: mkrootfs: do not clone the same repository twice --- mkrootfs.sh | 14 +++++++++----- 1 file 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" -- cgit v1.2.3