@@ -15,7 +15,7 @@ declare USER_TAXONOMY_DIR
1515declare AUTH_URL=" http://localhost:3000"
1616declare AUTH_SECRET=" your_super_secret_random_string"
1717declare DEV_MODE=" false"
18- declare EXPERIMENTAL_FEATURES=" false "
18+ declare EXPERIMENTAL_FEATURES=" "
1919declare PYENV_DIR=" "
2020
2121BINARY_INSTALL_DIR=./
@@ -45,13 +45,14 @@ usage_install() {
4545 echo -e " ${green} --username TEXT${reset} (Required) Set username for authentication."
4646 echo -e " ${green} --password TEXT${reset} (Required) Set password for authentication."
4747 echo -e " ${green} --taxonomy-dir PATH${reset} (Optional) Path of the taxonomy repo directory."
48- echo -e " e.g /var/home/cloud-user/.local/share/instructlab/taxonomy."
48+ echo -e " e.g /var/home/cloud-user/.local/share/instructlab/taxonomy."
4949 echo -e " ${green} --auth-url URL${reset} (Optional) Authentication URL. (default: https://localhost:3000)."
5050 echo -e " ${green} --auth-secret TEXT${reset} (Optional) Authentication secret."
5151 echo -e " ${green} --dev-mode ${reset} (Optional)Enable development mode. Deploys assistive features for Developers."
5252 echo -e " ${green} --experimental-features ${reset} (Optional)Enable experimental features available in Native mode."
53+ echo -e " Installer auto enable these features if InstructLab is setup on host."
5354 echo -e " ${green} --python-venv-dir ${reset} (Optional)Path to the InstructLab Python virtual environment directory."
54- echo -e " e.g /var/home/cloud-user/instructlab/venv \n"
55+ echo -e " e.g /var/home/cloud-user/instructlab/venv \n"
5556 exit 1
5657}
5758
@@ -127,7 +128,7 @@ verify_user_taxonomy() {
127128 SELECTED_TAXONOMY_DIR=$USER_TAXONOMY_DIR
128129 fi
129130 else
130- echo -e " ${green} User provided taxonomy and the ilab configured taxonomy directory is same.{reset}\n"
131+ echo -e " ${green} User provided taxonomy and the ilab configured taxonomy directory is same.$ {reset} \n"
131132 fi
132133 return
133134 fi
@@ -140,7 +141,10 @@ discover_pyenv() {
140141 echo -e " ${green} Discovering python virtual environment present on the host...${reset} \n"
141142 results=()
142143 while IFS= read -r line; do
143- results+=(" $line " )
144+ # Skip paths containing "containers/storage/overlay"
145+ if [[ " $line " != * " containers/storage/overlay" * ]]; then
146+ results+=(" $line " )
147+ fi
144148 done < <( find " $HOME " -type d -name " bin" -exec test -f {}/activate \; -print 2> /dev/null)
145149
146150 # Check if any results were found
@@ -178,14 +182,14 @@ discover_taxonomy_path() {
178182 taxonomy_path=" "
179183 if [[ " $IS_ILAB_INSTALLED " == " true" ]]; then
180184 if [[ " $PYENV_DIR " == " " && " $DISCOVERED_PYENV_DIR " == " " ]]; then
181- taxonomy_path=$( ilab config show 2> /dev/null | grep " taxonomy_path" | head -n 1 | cut -d ' :' -f 2)
185+ taxonomy_path=$( ilab config show 2> /dev/null | grep " taxonomy_path" | head -n 1 | cut -d ' :' -f 2 | sed ' s/^ *//;s/ *$// ' | tr -d ' \r\n ' )
182186 else
183187 # Always use discovered python virtual environment,
184188 venv_ilab=" $DISCOVERED_PYENV_DIR /bin/ilab"
185- taxonomy_path=$( $venv_ilab config show 2> /dev/null | grep " taxonomy_path" | head -n 1 | cut -d ' :' -f 2)
189+ taxonomy_path=$( $venv_ilab config show 2> /dev/null | grep " taxonomy_path" | head -n 1 | cut -d ' :' -f 2 | sed ' s/^ *//;s/ *$// ' | tr -d ' \r\n ' )
186190 fi
187191 else
188- echo -e " ${red} ilab is not set up on the host. Skip taxonomy path discovery.{reset}\n"
192+ echo -e " ${red} ilab is not set up on the host. Skip taxonomy path discovery.$ {reset} \n"
189193 return
190194 fi
191195 if [[ -n " $taxonomy_path " ]]; then
@@ -226,7 +230,7 @@ if [[ "$COMMAND" == "install" ]]; then
226230 shift 2
227231 ;;
228232 --taxonomy-dir)
229- USER_TAXONOMY_DIR=" $2 "
233+ USER_TAXONOMY_DIR=$( echo " $2 " | sed ' s/^ *//;s/ *$// ' )
230234 shift 2
231235 ;;
232236 --auth-url)
@@ -246,7 +250,7 @@ if [[ "$COMMAND" == "install" ]]; then
246250 shift 2
247251 ;;
248252 --python-venv-dir)
249- PYENV_DIR=" $2 "
253+ PYENV_DIR=$( echo " $2 " | sed ' s/^ *//;s/ *$// ' )
250254 shift 2
251255 ;;
252256 --help)
@@ -325,7 +329,26 @@ if [[ "$COMMAND" == "install" ]]; then
325329 AUTH_URL_B64=$( echo -n " $AUTH_URL " | base64)
326330 AUTH_SECRET_B64=$( echo -n " $AUTH_SECRET " | base64)
327331 DEV_MODE_B64=$( echo -n " $DEV_MODE " | base64)
328- EXPERIMENTAL_FEATURES_B64=$( echo -n " $EXPERIMENTAL_FEATURES " | base64)
332+
333+ if [[ " $EXPERIMENTAL_FEATURES " == " " ]]; then
334+ if [[ " $IS_ILAB_INSTALLED " == " true" ]]; then
335+ echo -e " ${green} InstructLab is set up on the host, enabling experimental features.${reset} \n"
336+ EXPERIMENTAL_FEATURES_B64=$( echo -n " true" | base64)
337+ else
338+ echo -e " ${green} InstructLab is not set up on the host, not enabling experimental features.${reset} \n"
339+ EXPERIMENTAL_FEATURES_B64=$( echo -n " false" | base64)
340+ fi
341+ elif [[ " $EXPERIMENTAL_FEATURES " == " true" ]]; then
342+ if [[ " $IS_ILAB_INSTALLED " == " true" ]]; then
343+ echo -e " ${green} InstructLab is set up on the host, enabling experimental features.${reset} \n"
344+ else
345+ echo -e " ${red} InstructLab is not set up on the host, enabling experimental features but they might not work as expected.${reset} \n"
346+
347+ fi
348+ EXPERIMENTAL_FEATURES_B64=$( echo -n " true" | base64)
349+ else
350+ EXPERIMENTAL_FEATURES_B64=$( echo -n " false" | base64)
351+ fi
329352
330353 # Download secret.yaml file
331354 echo -e " ${green} Downloading the secret.yaml sample file...${reset} \n"
@@ -469,13 +492,13 @@ elif [[ "$COMMAND" == "uninstall" ]]; then
469492 # Run Podman commands to uninstall UI containers
470493 echo -e " ${green} Deleting the UI stack containers from Podman...${reset} \n"
471494 if [ -f " instructlab-ui.yaml" ]; then
472- podman kube down instructlab-ui.yaml
495+ podman kube down instructlab-ui.yaml
473496 else
474497 echo -e " ${red} instructlab-ui.yaml file does not exist, can't stop the relevant containers (if running). Continuing with cleanup...${reset} \n"
475498 fi
476499 echo -e " ${green} Deleting the UI stack secrets from Podman...${reset} \n"
477500 if [ -f " secret.yaml" ]; then
478- podman kube down secret.yaml
501+ podman kube down secret.yaml
479502 else
480503 echo -e " ${red} secret.yaml file does not exist, can't unload the podman secrets. Continuing with cleanup...${reset} \n"
481504 fi
0 commit comments