Skip to content

Commit

Permalink
fix: prevent kill apt process by accident
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfly3173 committed Mar 4, 2025
1 parent e28f861 commit 3e2c589
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions build/resources/deb/DEBIAN/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ set -e
case "$1" in
install|upgrade)
# Check if SourceGit is running and stop it
if pidof -q sourcegit || pgrep -f sourcegit > /dev/null; then
echo "SourceGit is running, stopping it..."
killall sourcegit 2>/dev/null || pkill -f sourcegit 2>/dev/null || true
# Wait for SourceGit to exit
if pgrep -f '/opt/sourcegit/sourcegit' > /dev/null; then
echo "Stopping running SourceGit instance..."
pkill -f '/opt/sourcegit/sourcegit' || true
# Give the process a moment to terminate
sleep 1
fi
;;
Expand Down
9 changes: 4 additions & 5 deletions build/resources/deb/DEBIAN/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ set -e

case "$1" in
remove|upgrade|deconfigure)
# Check if SourceGit is running and stop it
if pidof -q sourcegit || pgrep -f sourcegit > /dev/null; then
echo "SourceGit is running, stopping it before removal..."
killall sourcegit 2>/dev/null || pkill -f sourcegit 2>/dev/null || true
# Wait for SourceGit to exit
if pgrep -f '/opt/sourcegit/sourcegit' > /dev/null; then
echo "Stopping running SourceGit instance..."
pkill -f '/opt/sourcegit/sourcegit' || true
# Give the process a moment to terminate
sleep 1
fi
;;
Expand Down

0 comments on commit 3e2c589

Please sign in to comment.