]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
anbox: Edit anbox-net script and run it
authorErfan Abdi <erfangplus@gmail.com>
Sun, 13 Jun 2021 08:39:05 +0000 (13:09 +0430)
committerErfan Abdi <erfangplus@gmail.com>
Sun, 13 Jun 2021 15:04:24 +0000 (19:34 +0430)
scripts/anbox-net.sh
scripts/install.sh
scripts/run-container.sh
scripts/stop-container.sh

index b2226f3faad1dcf904d58f61ac08092cc401066c..f60969096b30a934539f3a64c8f844c8cd4d4a3f 100644 (file)
@@ -1,19 +1,15 @@
 #!/bin/sh -
 
-distrosysconfdir="@LXC_DISTRO_SYSCONF@"
-varrun="@RUNTIME_PATH@/lxc"
-varlib="@LOCALSTATEDIR@/lib"
-
-# These can be overridden in @LXC_DISTRO_SYSCONF@/lxc
-#   or in @LXC_DISTRO_SYSCONF@/lxc-net
+varrun="/run/anbox-lxc"
+varlib="/var/lib"
 
 USE_LXC_BRIDGE="true"
-LXC_BRIDGE="lxcbr0"
-LXC_BRIDGE_MAC="00:16:3e:00:00:00"
-LXC_ADDR="10.0.3.1"
+LXC_BRIDGE="anbox0"
+LXC_BRIDGE_MAC="00:16:3e:00:00:01"
+LXC_ADDR="192.168.250.1"
 LXC_NETMASK="255.255.255.0"
-LXC_NETWORK="10.0.3.0/24"
-LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
+LXC_NETWORK="192.168.250.0/24"
+LXC_DHCP_RANGE="192.168.250.2,192.168.250.254"
 LXC_DHCP_MAX="253"
 LXC_DHCP_CONFILE=""
 LXC_DHCP_PING="true"
@@ -25,8 +21,6 @@ LXC_IPV6_MASK=""
 LXC_IPV6_NETWORK=""
 LXC_IPV6_NAT="false"
 
-[ ! -f $distrosysconfdir/lxc ] || . $distrosysconfdir/lxc
-
 use_nft() {
     [ -n "$NFT" ] && nft list ruleset > /dev/null 2>&1 && [ "$LXC_USE_NFT" = "true" ]
 }
@@ -114,7 +108,7 @@ add rule ip lxc postrouting ip saddr ${LXC_NETWORK} ip daddr != ${LXC_NETWORK} c
 start() {
     [ "x$USE_LXC_BRIDGE" = "xtrue" ] || { exit 0; }
 
-    [ ! -f "${varrun}/network_up" ] || { echo "lxc-net is already running"; exit 1; }
+    [ ! -f "${varrun}/network_up" ] || { echo "anbox-net is already running"; exit 1; }
 
     if [ -d /sys/class/net/${LXC_BRIDGE} ]; then
         stop force || true
@@ -125,7 +119,7 @@ start() {
     cleanup() {
         set +e
         if [ "$FAILED" = "1" ]; then
-            echo "Failed to setup lxc-net." >&2
+            echo "Failed to setup anbox-net." >&2
             stop force
             exit 1
         fi
@@ -224,7 +218,7 @@ delete table ip6 lxc;"
 stop() {
     [ "x$USE_LXC_BRIDGE" = "xtrue" ] || { exit 0; }
 
-    [ -f "${varrun}/network_up" ] || [ "$1" = "force" ] || { echo "lxc-net isn't running"; exit 1; }
+    [ -f "${varrun}/network_up" ] || [ "$1" = "force" ] || { echo "anbox-net isn't running"; exit 1; }
 
     if [ -d /sys/class/net/${LXC_BRIDGE} ]; then
         _ifdown
index 6e8e04666b41af80a2d56236e847142541ca4acb..915cfb9ebbf953d95b0508d2778727adada2fb71 100644 (file)
@@ -44,6 +44,9 @@ chmod +x run-container.sh
 rm -f stop-container.sh
 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/stop-container.sh
 chmod +x stop-container.sh
+rm -f anbox-net.sh
+wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/anbox-net.sh
+chmod +x anbox-net.sh
 
 if [ -f anbox.prop ]; then
     mv anbox.prop anbox.prop.bak
index 8786995bc01b80bf425eb595ea00715991cb9b99..30f96566f82e640a29f959f485bc4c6650f6b1d6 100644 (file)
@@ -11,9 +11,8 @@ umount -l /sys/fs/cgroup/schedtune
 # start sensors hal
 start anbox-sensors
 
-# start lxc-net, that sets up lxc bridge
-start lxc-net
-brctl addbr anbox0
+# start anbox-net, that sets up lxc bridge
+/home/anbox/anbox-net.sh start
 
 # stop nfcd to not conflict with anbox
 stop nfcd
index d8c74a2612e2eb90e851ccb2b21df068a6dc0675..ca54e744b2ec32fea872b1cbd7e1cfcc59177e03 100644 (file)
@@ -1,3 +1,4 @@
 #!/bin/bash
 
 lxc-stop -n anbox -k
+/home/anbox/anbox-net.sh stop