anbox-installer icon indicating copy to clipboard operation
anbox-installer copied to clipboard

Patch to skip ashmem and binder install if already exists

Open inferrna opened this issue 8 years ago • 2 comments

Simple patch for https://github.com/anbox/anbox/issues/91 I looked out the 'ppa:morphis/anbox-support' ppa and found it used only for dkms modules. So, if those already existst, ppa also can be skipped.

--- anbox-installer.original.sh	2017-04-14 21:35:19.045591097 +0800
+++ anbox-installer.sh	2017-04-14 21:49:36.809415343 +0800
@@ -145,20 +145,24 @@
 EOF
 fi
 
-sudo apt install -y software-properties-common linux-headers-generic
-sudo add-apt-repository -y 'ppa:morphis/anbox-support'
-sudo apt update
-sudo apt install -y anbox-modules-dkms
+if [ -c /dev/binder ] && [ -c /dev/ashmem ]; then
+    echo "Android binder and ashmem seems to be already enabled in kernel.";
+else
+    sudo apt install -y software-properties-common linux-headers-generic
+    sudo add-apt-repository -y 'ppa:morphis/anbox-support'
+    sudo apt update
+    sudo apt install -y anbox-modules-dkms
 
-if [ ! -e /etc/modules-load.d/anbox.conf ]; then
-	sudo tee /etc/modules-load.d/anbox.conf &>/dev/null <<EOF
+    if [ ! -e /etc/modules-load.d/anbox.conf ]; then
+        sudo tee /etc/modules-load.d/anbox.conf &>/dev/null <<EOF
 ashmem_linux
 binder_linux
 EOF
-fi
+    fi
 
-sudo modprobe binder_linux
-sudo modprobe ashmem_linux
+    sudo modprobe binder_linux
+    sudo modprobe ashmem_linux
+fi
 
 if snap info anbox | grep -q "installed:" ; then
 	 sudo snap refresh --edge anbox || true

inferrna avatar Apr 14 '17 14:04 inferrna

Can you propose this as a proper PR?

morphis avatar Apr 26 '17 05:04 morphis

I think this bug can be closed

parithy avatar Dec 05 '18 10:12 parithy