-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,011 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [ "$#" -lt 1 ]; then | ||
echo "Usage: $0 <path_to_gz_file> [destination_folder]" >&2 | ||
exit 1 | ||
fi | ||
|
||
GZ_PATH="$1" | ||
DEST_DIR="${2:-/opt}" | ||
TEMP_DIR="/tmp/InstallApp" | ||
|
||
if [ ! -f "$GZ_PATH" ]; then | ||
echo "Error: File $GZ_PATH not found." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "$DEST_DIR" ]; then | ||
echo "Error: Destination directory $DEST_DIR does not exist." >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
mkdir -p "$TEMP_DIR" | ||
|
||
echo "Extracting $GZ_PATH..." | ||
gzip -d "$GZ_PATH" || { | ||
echo "Error: Failed to extract the .gz file." >&2 | ||
exit 1 | ||
} | ||
|
||
|
||
EXTRACTED_FILE="${GZ_PATH%.gz}" | ||
|
||
|
||
if [ ! -f "$EXTRACTED_FILE" ]; then | ||
echo "Error: Extraction failed, no file found at $EXTRACTED_FILE" >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "Copying $EXTRACTED_FILE to $DEST_DIR..." | ||
cp "$EXTRACTED_FILE" "$DEST_DIR" || { | ||
echo "Error: Failed to copy the extracted file." >&2 | ||
exit 1 | ||
} | ||
|
||
|
||
echo "Cleaning up temporary files..." | ||
rm -f "$EXTRACTED_FILE" | ||
|
||
echo "Launching $EXTRACTED_FILE..." | ||
"$DEST_DIR/$(basename "$EXTRACTED_FILE")" || { | ||
echo "Error: Failed to launch the application." >&2 | ||
exit 1 | ||
} | ||
|
||
echo "Installation and launch completed successfully in $DEST_DIR!" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [ "$#" -lt 1 ]; then | ||
echo "Usage: $0 <path_to_dmg_file> [destination_folder]" >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
DMG_PATH="$1" | ||
DEST_DIR="${2:-/Applications}" | ||
MOUNT_DIR="/Volumes/InstallDMG" | ||
|
||
|
||
if [ ! -f "$DMG_PATH" ]; then | ||
echo "Error: File $DMG_PATH not found." >&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
if [ ! -d "$DEST_DIR" ]; then | ||
echo "Error: Destination directory $DEST_DIR does not exist." >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "Mounting $DMG_PATH..." | ||
hdiutil attach "$DMG_PATH" -nobrowse -mountpoint "$MOUNT_DIR" || { | ||
echo "Error: Failed to mount the DMG file." >&2 | ||
exit 1 | ||
} | ||
|
||
|
||
APP_PATH=$(find "$MOUNT_DIR" -type d -name "*.app" | head -n 1) | ||
|
||
if [ -z "$APP_PATH" ]; then | ||
echo "Error: No application found inside the DMG." >&2 | ||
hdiutil detach "$MOUNT_DIR" | ||
exit 1 | ||
fi | ||
|
||
|
||
APP_NAME=$(basename "$APP_PATH") | ||
TARGET_PATH="$DEST_DIR/$APP_NAME" | ||
|
||
if [ -d "$TARGET_PATH" ]; then | ||
echo "Removing existing version of $APP_NAME in $DEST_DIR..." | ||
rm -rf "$TARGET_PATH" || { | ||
echo "Error: Failed to remove the old version." >&2 | ||
hdiutil detach "$MOUNT_DIR" | ||
exit 1 | ||
} | ||
fi | ||
|
||
|
||
echo "Copying $APP_PATH to $DEST_DIR..." | ||
cp -R "$APP_PATH" "$DEST_DIR" || { | ||
echo "Error: Failed to copy the application." >&2 | ||
hdiutil detach "$MOUNT_DIR" | ||
exit 1 | ||
} | ||
|
||
|
||
echo "Unmounting the DMG..." | ||
hdiutil detach "$MOUNT_DIR" || { | ||
echo "Error: Failed to unmount the DMG." >&2 | ||
exit 1 | ||
} | ||
|
||
|
||
echo "Launching $APP_NAME..." | ||
open "$TARGET_PATH" || { | ||
echo "Error: Failed to launch the application." >&2 | ||
exit 1 | ||
} | ||
|
||
echo "Installation and launch completed successfully in $DEST_DIR!" | ||
exit 0 |
5 changes: 2 additions & 3 deletions
5
.../script/mac/launch_fit_with_privileges.sh → ...t/mac/launch_fit_with_admin_privileges.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Controlla gli argomenti | ||
PYTHON_PATH=${1:-} | ||
APP_PATH=${2:-} | ||
|
||
if [[ -z "$PYTHON_PATH" ]]; then | ||
echo "Percorso di Python mancante. Avvio senza argomento Python." | ||
echo "Missing Python path. Starting without the Python argument." | ||
osascript -e "do shell script \"launchctl asuser $(id -u) '${APP_PATH}'\" with administrator privileges" | ||
else | ||
echo "Avvio con Python: $PYTHON_PATH" | ||
echo "Starting with Python: $PYTHON_PATH" | ||
osascript -e "do shell script \"launchctl asuser $(id -u) '${PYTHON_PATH}' '${APP_PATH}'\" with administrator privileges" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
if ($args.Count -lt 1) { | ||
Write-Host "Usage: .\$($MyInvocation.MyCommand.Name) <path_to_zip_file> [destination_folder]" -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
$ZIP_PATH = $args[0] | ||
$DEST_DIR = if ($args.Count -ge 2) { $args[1] } else { "C:\Program Files" } | ||
|
||
|
||
if (-not (Test-Path -Path $ZIP_PATH)) { | ||
Write-Host "Error: File $ZIP_PATH not found." -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
|
||
if (-not (Test-Path -Path $DEST_DIR)) { | ||
Write-Host "Error: Destination directory $DEST_DIR does not exist." -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
|
||
Write-Host "Extracting $ZIP_PATH..." | ||
try { | ||
Expand-Archive -Path $ZIP_PATH -DestinationPath $DEST_DIR -Force | ||
} catch { | ||
Write-Host "Error: Failed to extract the ZIP file." -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
$APP_NAME = (Get-ChildItem -Path $DEST_DIR | Where-Object { $_.PSIsContainer }).Name | ||
$TARGET_PATH = Join-Path -Path $DEST_DIR -ChildPath $APP_NAME | ||
|
||
if (Test-Path -Path $TARGET_PATH) { | ||
Write-Host "Removing existing version of $APP_NAME in $DEST_DIR..." | ||
Remove-Item -Path $TARGET_PATH -Recurse -Force | ||
} | ||
|
||
Write-Host "Moving extracted files to $DEST_DIR..." | ||
Move-Item -Path (Join-Path -Path $DEST_DIR -ChildPath $APP_NAME) -Destination $DEST_DIR | ||
|
||
|
||
Write-Host "Launching $APP_NAME..." | ||
$exePath = Join-Path -Path $DEST_DIR -ChildPath "$APP_NAME\your_application.exe" | ||
if (Test-Path -Path $exePath) { | ||
Start-Process -FilePath $exePath | ||
} else { | ||
Write-Host "Error: Executable not found in $TARGET_PATH." -ForegroundColor Red | ||
exit 1 | ||
} | ||
|
||
Write-Host "Installation and launch completed successfully in $DEST_DIR!" -ForegroundColor Green | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
$python_path = $args[0] | ||
$app_path = $args[1] | ||
|
||
if (-not $python_path) { | ||
Write-Host "Running the app without Python..." | ||
Start-Process -FilePath $app_path -Verb RunAs | ||
} else { | ||
Write-Host "Running with Python..." | ||
Start-Process -FilePath $python_path -ArgumentList $app_path -Verb RunAs | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
PENDING = "Pending" | ||
FAIL = "Fail" | ||
SUCCESS = "Success" | ||
UNKNOW = "Unknow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.