@@ -140,6 +140,47 @@ download_script() {
140140 fi
141141}
142142
143+ download_dependencies () {
144+ print_step " Downloading required dependencies..."
145+
146+ # Create lib directory in install location
147+ local lib_dir=" $INSTALL_DIR /lib"
148+ if ! mkdir -p " $lib_dir " ; then
149+ print_error " Failed to create lib directory: $lib_dir "
150+ return 1
151+ fi
152+
153+ # Download bash_compat.sh
154+ local bash_compat_url=" https://raw.githubusercontent.com/${GITHUB_REPO} /${VERSION} /lib/bash_compat.sh"
155+ local temp_compat_file
156+ temp_compat_file=$( mktemp)
157+
158+ if curl -fsSL " $bash_compat_url " -o " $temp_compat_file " ; then
159+ print_success " Downloaded bash_compat.sh successfully"
160+
161+ # Verify the compatibility file looks correct
162+ if grep -q " compat_assoc_set" " $temp_compat_file " ; then
163+ if mv " $temp_compat_file " " $lib_dir /bash_compat.sh" ; then
164+ chmod 644 " $lib_dir /bash_compat.sh"
165+ print_success " Installed bash_compat.sh to $lib_dir /bash_compat.sh"
166+ else
167+ print_error " Failed to install bash_compat.sh"
168+ rm -f " $temp_compat_file "
169+ return 1
170+ fi
171+ else
172+ print_error " Downloaded bash_compat.sh doesn't appear to be correct"
173+ rm -f " $temp_compat_file "
174+ return 1
175+ fi
176+ else
177+ print_warning " Failed to download bash_compat.sh from $bash_compat_url "
178+ print_warning " The script will work on Bash 4.0+ but may fail on older versions"
179+ rm -f " $temp_compat_file "
180+ # Don't fail the installation, just warn
181+ fi
182+ }
183+
143184install_config_files () {
144185 print_step " Installing configuration files..."
145186
@@ -293,6 +334,15 @@ uninstall_llm_env() {
293334 print_warning " Script not found at $INSTALL_DIR /$SCRIPT_NAME "
294335 fi
295336
337+ # Remove lib directory and dependencies
338+ if [[ -d " $INSTALL_DIR /lib" ]]; then
339+ if rm -rf " $INSTALL_DIR /lib" ; then
340+ print_success " Removed $INSTALL_DIR /lib directory"
341+ else
342+ print_error " Failed to remove $INSTALL_DIR /lib directory"
343+ fi
344+ fi
345+
296346 # Remove shell function from config files
297347 local shell_configs=(" $HOME /.bashrc" " $HOME /.zshrc" " $HOME /.bash_profile" " $HOME /.profile" )
298348
@@ -416,6 +466,7 @@ main() {
416466
417467 check_requirements
418468 download_script
469+ download_dependencies
419470 install_config_files
420471 setup_shell_function
421472 show_next_steps
0 commit comments