@@ -9,8 +9,8 @@ TEMP_DIR=$(mktemp -d)
99# Detect OS
1010OS=" $( uname -s) "
1111case " $OS " in
12- Linux* ) FILE=" json-to-sql-linux .zip" ;;
13- Darwin* ) FILE=" json-to-sql-macos .zip" ;;
12+ Linux* ) FILE=" json-to-sql-Linux .zip" ;;
13+ Darwin* ) FILE=" json-to-sql-macOS .zip" ;;
1414 * ) echo " Unsupported OS: $OS " ; exit 1 ;;
1515esac
1616
@@ -29,9 +29,27 @@ curl -L "$BINARY_URL" -o "$TEMP_DIR/$FILE"
2929echo " Extracting..."
3030unzip -q " $TEMP_DIR /$FILE " -d " $TEMP_DIR "
3131
32+ # List contents of the temporary directory for debugging
33+ echo " Contents of $TEMP_DIR :"
34+ ls -l " $TEMP_DIR "
35+
36+ # Check if the extracted directory exists
37+ EXTRACTED_DIR=" $TEMP_DIR /json-to-sql-${OS} "
38+ if [[ ! -d " $EXTRACTED_DIR " ]]; then
39+ echo " Error: Extracted directory not found."
40+ exit 1
41+ fi
42+
43+ # Check if the binary exists in the extracted directory
44+ BINARY_PATH=" $EXTRACTED_DIR /json-to-sql"
45+ if [[ ! -f " $BINARY_PATH " ]]; then
46+ echo " Error: Extracted binary not found."
47+ exit 1
48+ fi
49+
3250# Install the binary
3351echo " Installing to $INSTALL_DIR ..."
34- sudo mv " $TEMP_DIR /json-to-sql " " $INSTALL_DIR /json-to-sql"
52+ sudo mv " $BINARY_PATH " " $INSTALL_DIR /json-to-sql"
3553sudo chmod +x " $INSTALL_DIR /json-to-sql"
3654
3755# Cleanup
@@ -43,4 +61,4 @@ if command -v json-to-sql &> /dev/null; then
4361else
4462 echo " ❌ Installation failed."
4563 exit 1
46- fi
64+ fi
0 commit comments