summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenton Liu2020-12-29 01:53:23 -0800
committerDenton Liu2020-12-29 01:53:23 -0800
commit0c5ea71c389de4eca6d7c772ee67aaae35191d9e (patch)
tree0c06f3469417928f855ecd780392b22c04891655
parent5d1e97d1e0e83be8cb53b3ad2f444b440b1ee412 (diff)
downloadaur-0c5ea71c389de4eca6d7c772ee67aaae35191d9e.tar.gz
crewlink: update launcher
Fix two issues with the crewlink launcher. First, ensure that the sysctl command to restore the old value runs. Next, add a hack since CrewLink leaks processes.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rwxr-xr-xcrewlink35
3 files changed, 37 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 28446f32287a..34d711c5629d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = crewlink
pkgdesc = Free, open, Among Us Proximity Chat
pkgver = 1.1.6
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/zbanks/CrewLink
arch = x86_64
license = GPL3
@@ -9,7 +9,7 @@ pkgbase = crewlink
source = https://github.com/zbanks/CrewLink/archive/v1.1.6-linux.tar.gz
source = crewlink
sha256sums = df424481df5a473e9abfd1ca47bd6f2cc79ab275726757097574d26f46723f87
- sha256sums = 80a5eb8b16ef5b92e164bc281cfd1bf5b7f9ff3996dd3122dae67f5356c97531
+ sha256sums = d94f1847d9e7909de929dc7579cd2ab934872f20faee9822b4abc85c0b0afcc1
pkgname = crewlink
diff --git a/PKGBUILD b/PKGBUILD
index 2d352a979f06..56edf3bf57de 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Denton Liu <liu.denton@gmail.com>
pkgname=crewlink
pkgver=1.1.6
-pkgrel=1
+pkgrel=2
pkgdesc='Free, open, Among Us Proximity Chat'
arch=('x86_64')
url='https://github.com/zbanks/CrewLink'
@@ -10,7 +10,7 @@ makedepends=('yarn')
source=("https://github.com/zbanks/CrewLink/archive/v$pkgver-linux.tar.gz"
crewlink)
sha256sums=('df424481df5a473e9abfd1ca47bd6f2cc79ab275726757097574d26f46723f87'
- '80a5eb8b16ef5b92e164bc281cfd1bf5b7f9ff3996dd3122dae67f5356c97531')
+ 'd94f1847d9e7909de929dc7579cd2ab934872f20faee9822b4abc85c0b0afcc1')
build() {
cd "$srcdir/CrewLink-$pkgver-linux"
diff --git a/crewlink b/crewlink
index 2afc6ff09b61..d91a191d3a27 100755
--- a/crewlink
+++ b/crewlink
@@ -5,9 +5,40 @@ error () {
exit 1
}
+process_tree () {
+ children=$(cat /proc/"$1"/task/*/children)
+ echo "$1"
+ for p in $children
+ do
+ process_tree "$p"
+ done
+}
+
key='kernel.yama.ptrace_scope'
old_value=$(sysctl -n "$key")
sysctl "$key=0" || error "unable to run 'sysctl $key=0' (did you run this as root?)"
-su "$(logname)" -c '/opt/CrewLink/crewlink'
-sysctl "$key=$old_value" || error "unable to run 'sysctl $key=$old_value'"
+trap 'sysctl "$key=$old_value"' EXIT
+trap 'exit' INT
+
+su "$(logname)" -c /opt/CrewLink/crewlink &
+
+cl_pid="$!"
+max_procs=0
+
+# This is a dirty, dirty hack. This is required because closing the window
+# doesn't result in the process tree dying. Some zygote processes are left
+# behind. Instead of letting crewlink clean up after itself, detect when some
+# processes have died and just kill off the rest.
+while true
+do
+ sleep 1
+ cur_procs=$(process_tree "$cl_pid" | wc -l)
+ if test "$(( max_procs - 1 > cur_procs ))" = 1
+ then
+ break
+ fi
+ max_procs="$cur_procs"
+done
+kill "$cl_pid"
+wait