Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Google Play Store installation for Sailfish OS devices

Installing Play Store to Sailfish OS requires some downloading and terminal commands but luckily the terminal part is repeatable and easily scriptable - leaving us with only the downloading part.

Download and extract packages

Download compatible Google Apps from this link and extract them to /home/nemo/gapps-kk-20140606 so that the directory looks like following:

[root@Sailfish nemo]# ls -al /home/nemo/gapps-kk-20140606/
total 24
drwxr-xr-x  5 root root 4096 Feb 26 12:02 .
drwxr-x--- 31 nemo nemo 4096 Feb 26 12:15 ..
drwxr-xr-x  3 root root 4096 Feb 26 12:02 META-INF
-rw-r--r--  1 root root  733 Feb 28  2008 install-optional.sh
drwxr-xr-x  3 root root 4096 Feb 26 12:02 optional
drwxr-xr-x  9 root root 4096 Feb 26 12:02 system

Download Google Play store release 7.3.25 which supports downloading of apks from this link and extract the apk to /home/nemo/playstore so that the directory contains the play store apk as playstore.apk. You can do ln or rename. I did with:

ln -s com.android.<truncated>.apk playstore.apk

The directory looks like this:

[root@Sailfish nemo]# ls -al /home/nemo/playstore/
total 17320
drwxr-xr-x  2 root root     4096 Feb 26 12:16 .
drwxr-x--- 31 nemo nemo     4096 Feb 26 12:15 ..
-rw-r--r--  1 nemo nemo 17723383 Feb 26 12:15 com.android.vending_7.3.25.K-all_0_PR_142209747-80732500_minAPI14(240,320,480dpi)_apkmirror.com.apk
lrwxrwxrwx  1 root root       99 Feb 26 12:16 playstore.apk -> com.android.vending_7.3.25.K-all_0_PR_142209747-80732500_minAPI14(240,320,480dpi)_apkmirror.com.apk

The script

In short the playstore-reinstall.sh script does the following:

  • Stop aliendalvik
  • Remove existing store from file system
  • Copy downloaded store to file system
  • Copy gapps to file system
  • Set rights to the files
  • Start aliendalvik
  • Install the downloaded Play Store
  • Prevent Play Store from updating itself to prevent “pending” problem

Download option

Download the playstore-reinstall script to a convenient folder. I will use Download as an example.

Copy paste option

If you are not comfortable with downloading you can copy paste the script from below and save it as /home/nemo/Download/playstore-reinstall.sh - for below examples to work.

#!/bin/sh
srcdir="/home/nemo/gapps-kk-20140606/system/priv-app"
destdir="/opt/alien/system/priv-app/"
deletedir="/home/nemo/deleted/"
playstore="/home/nemo/playstore/playstore.apk"

user=`whoami`

if [ "$user" != "root" ]; then
        echo This script requires root privileges. Please try again with devel-su.
        exit 0;
fi

reinstall () {
        echo 1: Stopping aliendalvik
        systemctl stop aliendalvik
        systemctl mask aliendalvik

        echo 2: Replacing Play Store with a compatible one from file $playstore
        chattr -i /home/.android/data/app//incoming/com.android.vending.apk
        rm /home/.android/data/app//incoming/com.android.vending.apk
        chattr -i /data/app/com.android.vending-2.apk
        rm -f /data/app/com.android.vending-2.apk
        cp -a $playstore /data/app/com.android.vending-2.apk

        echo 3: Copying files from $srcdir to $destdir
        cp -a $srcdir/GmsCore.apk $destdir
        cp -a $srcdir/GoogleLoginService.apk $destdir
        cp -a $srcdir/GoogleServicesFramework.apk $destdir
        cp -a $srcdir/Phonesky.apk $destdir

        echo 4: Setting up rights
        chmod 644 $srcdir/GmsCore.apk
        chmod 644 $srcdir/GoogleLoginService.apk
        chmod 644 $srcdir/GoogleServicesFramework.apk
        chmod 644 $srcdir/Phonesky.apk

        echo 5: Starting aliendalvik
        systemctl unmask aliendalvik
        systemctl start aliendalvik

        echo 6: Installing Play Store. Please check the latest download enabled version from http://www.apkmirror.com/apk/google-inc/google-play-store/google-play-store-7-3-25-release/
        apkd-install $playstore

        echo 7: Preventing Play Store from updating itself
        touch /data/app/com.android.vending-2.apk
        chattr +i /data/app/com.android.vending-2.apk

        echo 8: Finished - remember to finish Play Store install in your device.
}

sign_out () {
        echo Skipping and quitting, bb.
}

echo This script requires that you have done following:
echo 1: downloaded gapps-kk-20140606 from https://www.androidfilehost.com/?fid=95832962473395379 and extracted it to /home/nemo/gapps-kk-20140606
echo 2: downloaded 7.3.25 play store and extracted it as $playstore
echo -n 'Do you want to continue? [Y/N] '
read answer

case "$answer" in
        Y|y)
                reinstall
                ;;
        N|n)
                sign_out
                ;;
esac

exit 0;

Execute the script

Start terminal and run the following:

devel-su
cd /home/nemo/Download
unzip playstore-reinstall.zip
chmod a+x playstore-reinstall.sh
./playstore-reinstall.sh

And finish the Play Store installation on phone screen.

Repeat

The above script is safe to repeat so feel free to experiment.

Comments

All comments and corrections are welcome.

 stars  from 0 votes

Leave a comment

Enter your comment:
R H S C F
 

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line