Skip to content

Commit 71d0b69

Browse files
authored
fix: prevent kill apt process by accident (#1054)
1 parent 792e61b commit 71d0b69

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

build/resources/deb/DEBIAN/preinst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ set -e
1212
case "$1" in
1313
install|upgrade)
1414
# Check if SourceGit is running and stop it
15-
if pidof -q sourcegit || pgrep -f sourcegit > /dev/null; then
16-
echo "SourceGit is running, stopping it..."
17-
killall sourcegit 2>/dev/null || pkill -f sourcegit 2>/dev/null || true
18-
# Wait for SourceGit to exit
15+
if pgrep -f '/opt/sourcegit/sourcegit' > /dev/null; then
16+
echo "Stopping running SourceGit instance..."
17+
pkill -f '/opt/sourcegit/sourcegit' || true
18+
# Give the process a moment to terminate
1919
sleep 1
2020
fi
2121
;;

build/resources/deb/DEBIAN/prerm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ set -e
1515

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

0 commit comments

Comments
 (0)