Skip to content

Commit

Permalink
Merge pull request geeks-r-us#41 from ahmubashshir/nonsnap
Browse files Browse the repository at this point in the history
Add support installs without snap.
  • Loading branch information
geeks-r-us committed Feb 13, 2020
2 parents 49d761c + 5452333 commit 5a00c5f
Showing 1 changed file with 45 additions and 16 deletions.
61 changes: 45 additions & 16 deletions install-playstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# For further information see: http://geeks-r-us.de/2017/08/26/android-apps-auf-dem-linux-desktop/

# If you find this piece of software useful and or want to support it's development think of
# If you find this piece of software useful and or want to support it's development think of
# buying me a coffee https://ko-fi.com/geeks_r_us

# die when an error occurs
Expand Down Expand Up @@ -105,15 +105,30 @@ OPENGAPPS_URL="https://sourceforge.net/projects/opengapps/files/x86_64/$OPENGAPP
HOUDINI_Y_URL="http://dl.android-x86.org/houdini/7_y/houdini.sfs"
HOUDINI_Z_URL="http://dl.android-x86.org/houdini/7_z/houdini.sfs"

COMBINEDDIR="/var/snap/anbox/common/combined-rootfs"
OVERLAYDIR="/var/snap/anbox/common/rootfs-overlay"


if [ -d '/snap' ] && [ "$(which anbox)" = "/snap/bin/anbox" ];then
COMBINEDDIR="/var/snap/anbox/common/combined-rootfs"
OVERLAYDIR="/var/snap/anbox/common/rootfs-overlay"
WITH_SNAP=true
else
COMBINEDDIR="/var/lib/anbox/combined-rootfs"
OVERLAYDIR="/var/lib/anbox/rootfs-overlay"
WITH_SNAP=false
fi

if [ ! -d "$COMBINEDDIR" ]; then
# enable overlay fs
$SUDO snap set anbox rootfs-overlay.enable=true
$SUDO snap restart anbox.container-manager
if $WITH_SNAP;then
$SUDO snap set anbox rootfs-overlay.enable=true
$SUDO snap restart anbox.container-manager
else
$SUDO cat >/etc/systemd/system/anbox-container-manager.service.d/override.conf<<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox --use-rootfs-overlay
EOF
$SUDO systemctl daemon-reload
$SUDO systemctl restart anbox-container-manager.service
fi

sleep 20
fi
Expand All @@ -136,26 +151,36 @@ if [ -d "$WORKDIR/squashfs-root" ]; then
fi
echo "Extracting anbox android image"
# get image from anbox
cp /snap/anbox/current/android.img .
if $WITH_SNAP;then
cp /snap/anbox/current/android.img .
else
cp /var/lib/anbox/android.img .
fi
$SUDO $UNSQUASHFS android.img

# get opengapps and install it
cd "$WORKDIR"
if [ ! -f ./$OPENGAPPS_FILE ]; then
echo "Loading open gapps from $OPENGAPPS_URL"
$WGET -q --show-progress $OPENGAPPS_URL
$UNZIP -d opengapps ./$OPENGAPPS_FILE
fi

echo "Loading open gapps from $OPENGAPPS_URL"
while : ;do
if [ ! -f ./$OPENGAPPS_FILE ]; then
$WGET -q --show-progress $OPENGAPPS_URL
else
$WGET -q --show-progress -c $OPENGAPPS_URL
fi
[ $? = 0 ] && break
done
echo "extracting open gapps"

$UNZIP -d opengapps ./$OPENGAPPS_FILE

cd ./opengapps/Core/
for filename in *.tar.lz
do
$TAR --lzip -xvf ./$filename
done

cd "$WORKDIR"
APPDIR="$OVERLAYDIR/system/priv-app"
APPDIR="$OVERLAYDIR/system/priv-app"
if [ ! -d "$APPDIR" ]; then
$SUDO mkdir -p "$APPDIR"
fi
Expand Down Expand Up @@ -270,4 +295,8 @@ echo "ro.opengles.version=131072" | $SUDO tee -a "$OVERLAYDIR/system/build.prop"

echo "Restart anbox"

$SUDO snap restart anbox.container-manager
if $WITH_SNAP;then
$SUDO snap restart anbox.container-manager
else
$SUDO systemctl restart anbox-container-manager.service
fi

0 comments on commit 5a00c5f

Please sign in to comment.