mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
fix: close running instance before trying to update
This commit is contained in:
parent
30b61b3ce4
commit
edc9cf6ad3
@ -33,9 +33,19 @@ get_download_url() {
|
||||
echo "https://github.com/amir1376/ab-download-manager/releases/download/${LATEST_VERSION}/$ASSET_NAME"
|
||||
}
|
||||
|
||||
close_if_running() {
|
||||
pid=$(pidof -s "$APP_NAME")
|
||||
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 "$pid"
|
||||
echo "Closed running instance of AB Download Manager before updating."
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete the old version of the app if it exists
|
||||
delete_old_version() {
|
||||
local installed_dir
|
||||
close_if_running
|
||||
installed_dir=$(find "$HOME/.local" -maxdepth 1 -type d -name "ABDownloadManager_*" | head -n 1)
|
||||
if [ -n "$installed_dir" ]; then
|
||||
rm -rf "$installed_dir"
|
||||
|
Loading…
x
Reference in New Issue
Block a user