From af43d774c9149268126506cfd1ca508f2bf06e0a Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 18 May 2020 13:22:01 +0300 Subject: mkrootfs: add support for installing multiple repositories --- mkrootfs.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mkrootfs.sh b/mkrootfs.sh index 38c34f3..e030d2e 100755 --- a/mkrootfs.sh +++ b/mkrootfs.sh @@ -86,6 +86,27 @@ rm -rf /tmp/repo "$MNTDIR/var/db/kiss/repo" git clone --depth 1 "$REPO" /tmp/repo cp -r /tmp/repo "$MNTDIR/var/db/kiss/repo" +# Install extra repositories defined in a 'repositories' +# file if it exists. The file is formed by these three +# space seperated sections: +# +# 1: URI of git repository +# 2: The location where the repository will be cloned. +# 3: Options for the git clone, space seperation is not important. +# +[ -f repositories ] && +while read -r repourl repodir gitopts; do + # We already die if MNTDIR doesn't exist + # shellcheck disable=2115 + rm -rf "$MNTDIR/$repodir" + mkdir -p "$MNTDIR/${repodir%/*}" + + # We want word splitting here. + # shellcheck disable=2086 + git clone $gitopts -- "$repourl" "$MNTDIR/$repodir" +done < repositories + + # We export the new KISS_PATH export KISS_PATH="${HOST_REPO_PATH:-/tmp/repo/core}" -- cgit v1.2.3