@@ -54,7 +54,7 @@ install_apt_deps(){
5454 echo " ====================== INSTALL APT DEPS =============================="
5555 echo " Installing apt packages listed in packages.txt..."
5656
57- if [ ! -f " packages.txt" ]; then
57+ if [[ ! -f " packages.txt" ] ]; then
5858 echo " ⚠️ packages.txt not found, skipping apt package installation"
5959 return 0
6060 fi
@@ -75,19 +75,19 @@ install_asdf(){
7575 # Download asdf
7676 echo " Downloading asdf to $tarball ..."
7777 if ! curl -fsSL -o " $tarball " " $ASDF_DOWNLOAD_URL " ; then
78- echo " ❌ ERROR: Failed to download asdf from $ASDF_DOWNLOAD_URL "
78+ echo " ❌ ERROR: Failed to download asdf from $ASDF_DOWNLOAD_URL " >&2
7979 return 1
8080 fi
8181
8282 # Extract to /usr/local/bin
8383 if ! sudo tar -xzf " $tarball " -C /usr/local/bin; then
84- echo " ❌ ERROR: Failed to extract asdf"
84+ echo " ❌ ERROR: Failed to extract asdf" >&2
8585 return 1
8686 fi
8787
8888 # Set executable permissions
8989 if ! sudo chmod +x " $ASDF_INSTALL_PATH " ; then
90- echo " ❌ ERROR: Failed to set permissions on asdf"
90+ echo " ❌ ERROR: Failed to set permissions on asdf" >&2
9191 return 1
9292 fi
9393
@@ -99,7 +99,7 @@ configure_shell_rc_file() {
9999 local rc_file=" $ASDF_HOME /$rc_name "
100100
101101 # Skip if rc file doesn't exist (user probably doesn't use this shell)
102- if [ ! -f " $rc_file " ]; then
102+ if [[ ! -f " $rc_file " ] ]; then
103103 echo " ℹ️ $rc_name not found, skipping configuration"
104104 return 0
105105 fi
@@ -136,11 +136,12 @@ persist_asdf_env_to_shell_rc(){
136136 if ! $configured ; then
137137 echo " ⚠️ Warning: Failed to configure any shell RC files"
138138 fi
139+ return 0
139140}
140141
141142configure_asdf_for_github_actions (){
142143 # Make this natively available to GitHub Actions steps
143- if [ -n " ${GITHUB_ENV:- } " ] && [ -n " ${GITHUB_PATH:- } " ]; then
144+ if [[ -n " ${GITHUB_ENV:- } " && -n " ${GITHUB_PATH:- } " ] ]; then
144145 local asdf_data_dir=" $ASDF_HOME /.asdf"
145146 echo " Adding ASDF to GITHUB_PATH and GITHUB_ENV..." && \
146147 echo " ASDF_DATA_DIR=$asdf_data_dir " >> " $GITHUB_ENV " && \
@@ -149,6 +150,7 @@ configure_asdf_for_github_actions(){
149150 else
150151 echo " Not running in GitHub Actions, skipping GitHub environment setup"
151152 fi
153+ return 0
152154}
153155
154156setup_asdf_current_session (){
@@ -163,7 +165,7 @@ setup_asdf_current_session(){
163165 fi
164166
165167 # Report status
166- if [ -f " $ASDF_INSTALL_PATH " ]; then
168+ if [[ -f " $ASDF_INSTALL_PATH " ] ]; then
167169 if command -v asdf & > /dev/null; then
168170 echo " ✅ asdf is accessible from PATH"
169171 else
@@ -172,38 +174,42 @@ setup_asdf_current_session(){
172174 else
173175 echo " ℹ️ asdf binary not yet installed"
174176 fi
177+ return 0
175178}
176179
177180setup_asdf (){
178181 # Check if asdf binary file exists in the installation location
179- if [ -f " $ASDF_INSTALL_PATH " ]; then
182+ if [[ -f " $ASDF_INSTALL_PATH " ] ]; then
180183 echo " ====================== ASDF ALREADY INSTALLED =============================="
181184 echo " ✅ asdf binary found at $ASDF_INSTALL_PATH "
182185 else
183186 echo " ====================== ASDF NOT FOUND, INSTALLING =============================="
184187 install_asdf
185188 fi
186189 setup_asdf_current_session
190+ return 0
187191}
188192
189193install_asdf_plugins (){
190194 echo " ====================== INSTALL ASDF PLUGINS =============================="
191195 if ! make _install-dependencies; then
192- echo " ❌ ERROR: Failed to install asdf plugins"
196+ echo " ❌ ERROR: Failed to install asdf plugins" >&2
193197 exit 1
194198 fi
195199 echo " ✅ asdf plugins installed successfully"
200+ return 0
196201}
197202
198203verify_asdf_configuration (){
199204 echo " ====================== VERIFY ASDF CONFIGURATION =============================="
200205 echo " ASDF data dir: ${ASDF_DATA_DIR:- not set} "
201206 echo " PATH: $PATH "
202207 if ! asdf current; then
203- echo " ❌ ERROR: asdf is not fully configured. Cannot proceed with project dependencies installation."
208+ echo " ❌ ERROR: asdf is not fully configured. Cannot proceed with project dependencies installation." >&2
204209 exit 1
205210 fi
206211 echo " ✅ asdf configuration verified successfully"
212+ return 0
207213}
208214
209215install_project_dependencies ()
@@ -213,10 +219,11 @@ install_project_dependencies()
213219 echo " ====================== INSTALL PROJECT DEPENDENCIES =============================="
214220 echo " Installing documentation dependencies..."
215221 make -C docs install
222+ return 0
216223}
217224
218225# Main execution flow
219- if [ " $SKIP_SYSTEM_DEPS " = false ]; then
226+ if [[ " $SKIP_SYSTEM_DEPS " = false ] ]; then
220227 echo " 📦 Installing system dependencies..."
221228 install_apt_deps
222229 setup_asdf
0 commit comments