@@ -12,6 +12,7 @@ TOOL_NAME="Luca"
1212INSTALL_DIR=" /usr/local/bin"
1313TOOL_FOLDER=" .luca"
1414VERSION_FILE=" ${PWD} /.luca-version"
15+ ORGANIZATION=" LucaTools"
1516REPOSITORY_URL=" https://github.com/LucaTools/Luca"
1617TOOL_DIR=" $HOME /$TOOL_FOLDER "
1718SHELL_HOOK_SCRIPT_PATH=" $TOOL_DIR /shell_hook.sh"
@@ -25,7 +26,7 @@ SHELL_HOOK_SCRIPT_URL="https://raw.githubusercontent.com/LucaTools/LucaInstall/H
2526if [ ! -f " $VERSION_FILE " ]; then
2627 echo " Missing $VERSION_FILE . Fetching the latest version"
2728 # Fetch latest release version from GitHub API
28- REQUIRED_EXECUTABLE_VERSION=$( curl -LSsf " https://api.github.com/repos/LucaTools/Luca /releases/latest" | grep ' "tag_name":' | sed ' s/.*"tag_name": *"\([^"]*\)".*/\1/' )
29+ REQUIRED_EXECUTABLE_VERSION=$( curl -LSsf " https://api.github.com/repos/$ORGANIZATION / $TOOL_NAME /releases/latest" | grep ' "tag_name":' | sed ' s/.*"tag_name": *"\([^"]*\)".*/\1/' )
2930
3031 if [ -z " $REQUIRED_EXECUTABLE_VERSION " ]; then
3132 echo " ERROR: Could not fetch latest version from $REPOSITORY_URL "
146147# Skip the download and installation if version is already current
147148if [ " $SKIP_INSTALLATION " = " true" ]; then
148149 echo " Skipping Luca download and installation..."
149- else
150- # =============================================================================
151- # LUCA DOWNLOAD AND INSTALLATION
152- # =============================================================================
153-
154- echo " π₯ Downloading $TOOL_NAME ($REQUIRED_EXECUTABLE_VERSION )..."
150+ exit 0
151+ fi
155152
156- # Download the appropriate version for the detected OS
157- # Use the updated URL pointing to the new S3 bucket
158- curl -LSsf --output " ./$TEMP_EXECUTABLE_ZIP_FILENAME " \
159- " https://luca-tool-manager-scripts.s3.eu-west-2.amazonaws.com/$TOOL_NAME /$REQUIRED_EXECUTABLE_VERSION /$TEMP_EXECUTABLE_ZIP_FILENAME "
160-
161- DOWNLOAD_SUCCESS=$?
162- if [ $DOWNLOAD_SUCCESS -ne 0 ]; then
163- echo " β ERROR: Could not download $TOOL_NAME ($REQUIRED_EXECUTABLE_VERSION )."
164- echo " Please check your internet connection and verify the version exists."
165- exit 1
166- fi
153+ # =============================================================================
154+ # LUCA DOWNLOAD AND INSTALLATION
155+ # =============================================================================
167156
168- echo " β
Download completed successfully "
157+ echo " π₯ Downloading $TOOL_NAME ( $REQUIRED_EXECUTABLE_VERSION )... "
169158
170- # =============================================================================
171- # EXTRACTION AND INSTALLATION
172- # =============================================================================
159+ # Download the appropriate version for the detected OS
160+ # Use the updated URL pointing to the new S3 bucket
161+ curl -LSsf --output " ./$TEMP_EXECUTABLE_ZIP_FILENAME " \
162+ " $REPOSITORY_URL /releases/download/$REQUIRED_EXECUTABLE_VERSION /$TEMP_EXECUTABLE_ZIP_FILENAME "
173163
174- echo " π¦ Extracting $TEMP_EXECUTABLE_ZIP_FILENAME ..."
175-
176- # Extract the downloaded zip file quietly
177- if ! unzip -o -qq " ./$TEMP_EXECUTABLE_ZIP_FILENAME " -d ./; then
178- echo " β ERROR: Failed to extract $TEMP_EXECUTABLE_ZIP_FILENAME "
179- rm -f " ./$TEMP_EXECUTABLE_ZIP_FILENAME "
180- exit 1
181- fi
164+ DOWNLOAD_SUCCESS=$?
165+ if [ $DOWNLOAD_SUCCESS -ne 0 ]; then
166+ echo " β ERROR: Could not download $TOOL_NAME ($REQUIRED_EXECUTABLE_VERSION )."
167+ echo " Please check your internet connection and verify the version exists."
168+ exit 1
169+ fi
170+
171+ echo " β
Download completed successfully"
172+
173+ # =============================================================================
174+ # EXTRACTION AND INSTALLATION
175+ # =============================================================================
182176
183- echo " β
Extraction completed "
177+ echo " π¦ Extracting $TEMP_EXECUTABLE_ZIP_FILENAME ... "
184178
185- # Clean up the downloaded zip file
186- rm " ./$TEMP_EXECUTABLE_ZIP_FILENAME "
187- echo " π§Ή Cleaned up temporary files"
179+ # Extract the downloaded zip file quietly
180+ if ! unzip -o -qq " ./$TEMP_EXECUTABLE_ZIP_FILENAME " -d ./; then
181+ echo " β ERROR: Failed to extract $TEMP_EXECUTABLE_ZIP_FILENAME "
182+ rm -f " ./$TEMP_EXECUTABLE_ZIP_FILENAME "
183+ exit 1
184+ fi
188185
189- # =============================================================================
190- # SYSTEM INSTALLATION WITH PRIVILEGE HANDLING
191- # =============================================================================
186+ echo " β
Extraction completed"
192187
193- # Helper function to run commands with sudo only if needed
194- # This checks if the install directory is writable before using sudo
195- sudo_if_install_dir_not_writeable () {
196- local command=" $1 "
197- if [ -w " $INSTALL_DIR " ]; then
198- # Directory is writable, run without sudo
199- sh -c " $command "
200- else
201- # Directory requires elevated privileges
202- echo " π Administrator privileges required for installation to $INSTALL_DIR "
203- sudo sh -c " $command "
204- fi
205- }
188+ # Clean up the downloaded zip file
189+ rm " ./$TEMP_EXECUTABLE_ZIP_FILENAME "
190+ echo " π§Ή Cleaned up temporary files"
206191
207- # Create install directory if it doesn't exist
208- if [ ! -d " $INSTALL_DIR " ]; then
209- echo " π Creating install directory: $INSTALL_DIR "
210- sudo_if_install_dir_not_writeable " mkdir -p $INSTALL_DIR "
211- fi
192+ # =============================================================================
193+ # SYSTEM INSTALLATION WITH PRIVILEGE HANDLING
194+ # =============================================================================
212195
213- # Move the executable to the install directory and make it executable
214- echo " π Installing $TOOL_NAME to $INSTALL_DIR ..."
215- sudo_if_install_dir_not_writeable " mv $TOOL_NAME $EXECUTABLE_FILE "
216- sudo_if_install_dir_not_writeable " chmod +x $EXECUTABLE_FILE "
196+ # Helper function to run commands with sudo only if needed
197+ # This checks if the install directory is writable before using sudo
198+ sudo_if_install_dir_not_writeable () {
199+ local command=" $1 "
200+ if [ -w " $INSTALL_DIR " ]; then
201+ # Directory is writable, run without sudo
202+ sh -c " $command "
203+ else
204+ # Directory requires elevated privileges
205+ echo " π Administrator privileges required for installation to $INSTALL_DIR "
206+ sudo sh -c " $command "
207+ fi
208+ }
217209
218- echo " β
$TOOL_NAME ($REQUIRED_EXECUTABLE_VERSION ) successfully installed to $INSTALL_DIR "
210+ # Create install directory if it doesn't exist
211+ if [ ! -d " $INSTALL_DIR " ]; then
212+ echo " π Creating install directory: $INSTALL_DIR "
213+ sudo_if_install_dir_not_writeable " mkdir -p $INSTALL_DIR "
219214fi
220215
216+ # Move the executable to the install directory and make it executable
217+ echo " π Installing $TOOL_NAME to $INSTALL_DIR ..."
218+ sudo_if_install_dir_not_writeable " mv $TOOL_NAME $EXECUTABLE_FILE "
219+ sudo_if_install_dir_not_writeable " chmod +x $EXECUTABLE_FILE "
220+
221+ echo " β
$TOOL_NAME ($REQUIRED_EXECUTABLE_VERSION ) successfully installed to $INSTALL_DIR "
222+
221223# =============================================================================
222224# SHELL HOOK SETUP
223225# =============================================================================
0 commit comments