From 94b86ed2b8df84cf9e138c5a4af8f698ad56565a Mon Sep 17 00:00:00 2001 From: Phill Kelley <34226495+Paraphraser@users.noreply.github.com> Date: Sun, 17 Dec 2023 13:31:47 +1100 Subject: [PATCH] default clone of IOTstack uses `--filter=tree:0` Implements suggestion from @Slyke. Can be overridden via `GIT_CLONE_OPTIONS`. Examples: * Clone full repo - either of the following: ``` $ GIT_CLONE_OPTIONS= ./install.sh $ GIT_CLONE_OPTIONS="" ./install.sh ``` * Different options: ``` $ GIT_CLONE_OPTIONS="--filter=blob:none" ./install.sh ``` Naturally the user is responsible for passing valid options! Signed-off-by: Phill Kelley <34226495+Paraphraser@users.noreply.github.com> --- install.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 55a83dcd..bcc475a0 100755 --- a/install.sh +++ b/install.sh @@ -40,6 +40,12 @@ IOTSTACK_MENU_REQUIREMENTS="$IOTSTACK/requirements-menu.txt" IOTSTACK_MENU_VENV_DIR="$IOTSTACK/.virtualenv-menu" IOTSTACK_INSTALLER_HINT="$IOTSTACK/.new_install" +# git cloning options which can be overridden +# (needs special handling for the null case) +if [[ ! -v GIT_CLONE_OPTIONS ]] ; then + GIT_CLONE_OPTIONS="--filter=tree:0" +fi + # the expected installation location of docker-compose-plugin is COMPOSE_PLUGIN_PATH="/usr/libexec/docker/cli-plugins/docker-compose" @@ -322,8 +328,13 @@ fi # does the IOTstack folder already exist? if [ ! -d "$IOTSTACK" ] ; then # no! clone from GitHub - echo -e "\nCloning the IOTstack repository from GitHub" - git clone https://github.com/SensorsIot/IOTstack.git "$IOTSTACK" + if [ -n "$GIT_CLONE_OPTIONS" ] ; then + echo -e "\nCloning the IOTstack repository from GitHub using options $GIT_CLONE_OPTIONS" + git clone "$GIT_CLONE_OPTIONS" https://github.com/SensorsIot/IOTstack.git "$IOTSTACK" + else + echo -e "\nCloning the full IOTstack repository from GitHub" + git clone https://github.com/SensorsIot/IOTstack.git "$IOTSTACK" + fi if [ $? -eq 0 -a -d "$IOTSTACK" ] ; then echo "IOTstack cloned successfully into $IOTSTACK" mkdir -p "$IOTSTACK/backups" "$IOTSTACK/services" @@ -415,5 +426,4 @@ fi # normal exit #---------------------------------------------------------------------- -echo "$SCRIPT completed." handle_exit 0