aboutsummaryrefslogtreecommitdiff
path: root/mkrootfs.sh
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-18 13:22:01 +0300
committerCem Keylan <cem@ckyln.com>2020-05-18 13:22:01 +0300
commitaf43d774c9149268126506cfd1ca508f2bf06e0a (patch)
treef30bb4ffeb8267d82616a2e5d791a980be441535 /mkrootfs.sh
parent95c37dcd8f9f5be9fd8dfd7ab185dfeb8e884923 (diff)
downloadmkrootfs-af43d774c9149268126506cfd1ca508f2bf06e0a.tar.gz
mkrootfs: add support for installing multiple repositories
Diffstat (limited to 'mkrootfs.sh')
-rwxr-xr-xmkrootfs.sh21
1 files changed, 21 insertions, 0 deletions
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}"