-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime directory and uninstall scripts
- Loading branch information
1 parent
4973f54
commit d62cdd8
Showing
5 changed files
with
114 additions
and
5 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
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,44 @@ | ||
Write-Host "Uninstalling ShareIT for Windows..." | ||
|
||
# Variables | ||
$CLI_EXECUTABLE = "shareit.cli.exe" | ||
$SERVER_EXECUTABLE = "shareit.server.exe" | ||
$INSTALL_DIR = "$env:ProgramFiles\ShareIT" | ||
$RUNTIME_DIR = "$env:LOCALAPPDATA\ShareIT" | ||
|
||
# Function to check if a process is running | ||
function Is-ProcessRunning { | ||
param ( | ||
[string]$ProcessName | ||
) | ||
$process = Get-Process -Name $ProcessName -ErrorAction SilentlyContinue | ||
return $process -ne $null | ||
} | ||
|
||
# Check if CLI executable is running | ||
if (Is-ProcessRunning -ProcessName "shareit.cli") { | ||
Write-Host "Error: CLI executable ($CLI_EXECUTABLE) is running. Please stop it before uninstalling." | ||
exit 1 | ||
} | ||
|
||
# Check if Server executable is running | ||
if (Is-ProcessRunning -ProcessName "shareit.server") { | ||
Write-Host "Server executable ($SERVER_EXECUTABLE) is running. Stopping it..." | ||
Stop-Process -Name "shareit.server" -Force | ||
Start-Sleep -Seconds 2 | ||
if (Is-ProcessRunning -ProcessName "shareit.server") { | ||
Write-Host "Error: Unable to stop the server executable. Please stop it manually and try again." | ||
exit 1 | ||
} | ||
} | ||
|
||
# Remove installed files | ||
Write-Host "Removing installed files..." | ||
Remove-Item -Path "$INSTALL_DIR\$CLI_EXECUTABLE" -Force | ||
Remove-Item -Path "$INSTALL_DIR\$SERVER_EXECUTABLE" -Force | ||
|
||
# Remove runtime directory | ||
Write-Host "Removing runtime directory..." | ||
Remove-Item -Path $RUNTIME_DIR -Recurse -Force | ||
|
||
Write-Host "Uninstallation complete." |
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,57 @@ | ||
#!/bin/bash | ||
|
||
# Determine OS | ||
OS="$(uname -s)" | ||
case "${OS}" in | ||
Linux*) OS=Linux;; | ||
Darwin*) OS=Mac;; | ||
*) echo "Unsupported OS: ${OS}"; exit 1;; | ||
esac | ||
|
||
echo "Uninstalling ShareIT for ${OS}..." | ||
|
||
# Variables | ||
CLI_EXECUTABLE="shareit.cli.linux" | ||
SERVER_EXECUTABLE="shareit.server.linux" | ||
INSTALL_DIR="/usr/local/bin" | ||
RUNTIME_DIR="$HOME/.shareit/" | ||
|
||
if [ "${OS}" == "Mac" ]; then | ||
RUNTIME_DIR="$HOME/Library/Application Support/shareit" | ||
CLI_EXECUTABLE="shareit.cli.darwin" | ||
SERVER_EXECUTABLE="shareit.server.darwin" | ||
fi | ||
|
||
# Function to check if a process is running | ||
is_running() { | ||
pgrep -f "$1" > /dev/null 2>&1 | ||
} | ||
|
||
# Check if CLI executable is running | ||
if is_running "$INSTALL_DIR/$CLI_EXECUTABLE"; then | ||
echo "Error: CLI executable ($CLI_EXECUTABLE) is running. Please stop it before uninstalling." | ||
exit 1 | ||
fi | ||
|
||
# Check if Server executable is running | ||
if is_running "$INSTALL_DIR/$SERVER_EXECUTABLE"; then | ||
echo "Server executable ($SERVER_EXECUTABLE) is running. Stopping it..." | ||
pkill -f "$INSTALL_DIR/$SERVER_EXECUTABLE" | ||
# Wait for the process to stop | ||
sleep 2 | ||
if is_running "$INSTALL_DIR/$SERVER_EXECUTABLE"; then | ||
echo "Error: Unable to stop the server executable. Please stop it manually and try again." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Remove installed files | ||
echo "Removing installed files..." | ||
sudo rm -f "$INSTALL_DIR/$CLI_EXECUTABLE" | ||
sudo rm -f "$INSTALL_DIR/$SERVER_EXECUTABLE" | ||
|
||
# Remove runtime directory | ||
echo "Removing runtime directory..." | ||
rm -rf "$RUNTIME_DIR" | ||
|
||
echo "Uninstallation complete." |
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