Google play services on Sailfish 4.1

can you help with this?

2 Likes

Worked on Xperia 10 Plus with minor modifications:

  • replace nemo with defaultuser (twice)
  • replace call to xdg-open with

`which xdg-open`

  • tap “Try To Download Anyway” on Sourceforge website

I don’t get it - while uname -a reports aarch64, it won’t install Fedora package in 64-bit version of this script.

Dear all, I’m a complete newbe and trying hard to stick to SFOS, but unfortunately I need some more help in this case.

I’ve tried to follow all the mentioned steps and skripts but I failed.
Is there any chance of taking me by the hand please? Kind of step by step?

I have a Xperia 10 II Dual Sim with SFOS 4.2 (or should I open a new topic here since this one is for 4.1? - let me know).

I’d like to get gapps running because some Apps won’t work without (e.g. carsharing apps using gmaps).

I’ve tried the skript from anig (June 16th) and downloaded the open_gapps-arm64-10.0-nano.zip, is this right? Because on my phone was Android 11 before?

Running the skript it says
: not foundngapps.sh: line 2:
: not foundngapps.sh: line 3:
install_opengapps.sh: set: line 4: illegal option -

Thank you so much.

@thwep
Admittedly my 10 II is single SIM on 4.2.0.19 but used open_gapps-arm64-10.0-pico-20200808.zip myself with “defaultuser” in script.


root@Xperia10II Downloads]# sh opengapps.sh
Copying original image /opt/alien/system.img to /home/.aliendalvik_systemimg_patch/system.img.orig.20210617T125643 line 87
Searching for Open GApps zip at /home/defaultuser/Downloads/open_gapps-arm64-10.0-pico-*.zip
Found Open GApps zip /home/defaultuser/Downloads/open_gapps-arm64-10.0-pico-20200808.zipArchive: /home/defaultuser/Downloads/open_gapps-arm64-10.0-pico-20200808.zip
signed by SignApk
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/backuprestore-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/carriersetup-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/configupdater-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/datatransfertool-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/defaultetc-common.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/defaultframework-common.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/extservicesgoogle-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/extsharedgoogle-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/gmscore-arm64.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googlebackuptransport-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googlecontactssync-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googlefeedback-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googleonetimeinitializer-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googlepartnersetup-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/googlepixelconfig-common.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/gsfcore-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/setupwizarddefault-arm64.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/setupwizardtablet-arm64.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Core/vending-arm.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/GApps/calsync-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/GApps/dialerframework-common.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/GApps/googletts-arm64.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/GApps/packageinstallergoogle-all.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/LICENSE
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/META-INF/com/google/android/update-binary
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/META-INF/com/google/android/updater-script
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/Optional/swypelibs-lib-arm64.tar.lz
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/app_densities.txt
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/app_sizes.txt
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/bkup_tail.sh
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/busybox-arm
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/g.prop
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/gapps-remove.txt
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/installer.sh
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/tar-arm
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/unzip-arm
extracting: /home/.aliendalvik_systemimg_patch/tmp/opengapps/zip-arm
inflating: /home/.aliendalvik_systemimg_patch/tmp/opengapps/META-INF/MANIFEST.MF
inflating: /home/.aliendalvik_systemimg_patch/tmp/opengapps/META-INF/CERT.SF
inflating: /home/.aliendalvik_systemimg_patch/tmp/opengapps/META-INF/CERT.RSA
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on /opt/alien/system.img, block size 131072.
[=============================================================/] 9759/9759 100%

Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, no fragments, compressed xattrs
duplicates are not removed
Filesystem size 464454.09 Kbytes (453.57 Mbytes)
45.13% of uncompressed filesystem size (1029141.66 Kbytes)
Inode table size 66310 bytes (64.76 Kbytes)
33.22% of uncompressed inode table size (199615 bytes)
Directory table size 33369 bytes (32.59 Kbytes)
40.89% of uncompressed directory table size (81600 bytes)
Xattr table size 1075 bytes (1.05 Kbytes)
19.06% of uncompressed xattr table size (5640 bytes)
No duplicate files removed
Number of inodes 3029
Number of files 2447
Number of symbolic links 269
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 313
Number of ids (unique uids + gids) 6
Number of uids 3
root (0)
system (1000)
logd (1036)
Number of gids 6
root (0)
system (1000)
cache (2001)
shell (2000)
sdcard_r (1028)
logd (1036)
[root@Xperia10II Downloads]#

Hi! Has anyone had any problems installing 4.3? I have 4.1 installed with opengapps script…

I didn’t have any issues. Simply ran the script after updating to 4.3.

Ok. I’ll try. Thanks.

Thanks for this instruction, got now gapps working on my 10 ii (sf 4.2). These things perhaps worth mentioning:

  • loaded .sh script didn’t run before line endings were changed to unix style (LF, used notepad++ to do that)
  • the script file had no execute permission, had to do chmod +x …
  • xdg-open errored “not found” until changed it to /usr/bin/xdg-open

New Jan 24th 2022 Update:

I got the Xperia 10 ii and wanted to get Google play store, wanted a Linux “daily driver” Anyway, after a couple hours and stiching together some of the comments. I updated the script to work with the Xperia 10 ii. Couple changes most are noted above. Updated repo for 64 bit, updated Nemo to default user, and updated lzip to 1.20 from 1.16(in the script)… got it working eventually… now I have run it probably a dozen times, once to reinstall after updated to 4.3 sailfish, had to reinstall but took a second with the script.

Go to opengapps.org and download ARM64, 10, pico. (Save to Downloads folder on Xperia 10ii)(seems like it updates itself once installed so 10 works)

(Save script to Downloads folder on Xperia 10ii)

Xperia 10ii gapps install script(line feed & xdg-open updated):

1)Enable developer mode(settings>About product> then tap on “Build” 7 times) and enable ssh and add a password. This adds terminal and admin. Might need to restart your phone for the terminal app to show up.

2)Then open terminal app and run these commands:

“devel-su“
(Then enter password from step 1)

“pkcon install unzip”
(Wait for the unzip install type y if prompted)

“pkcon install rsync”
(Wait for the rsync install type y if prompted)

“cd Downloads”
(with a capital D)

“chmod +x install_gapps.sh”
(Might need to enter password from step 1)

“./install_gapps.sh”

3)Once install is completed, Restart phone.

4)On boot up be sure to log in to your google account immediately when prompted. You’ll have to delete and reinstall if you fail to log in.

Note …(did you run into a directory exist error?)…
if you run the script again, you will have to manually go in an add a hash sign “#” in front of

mkdir “$SQUASHFS_ROOT/“

around line 83 to comment it out and it should run fine again. You can use the seabass app in Jolla store to edit the script
Note

Let me know if you need any help. Hopefully this helps the Xperia 10 ii users get gapps much easier

Let me know how it goes and if I missed a step

Update I deleted original post and reposted with updates

Updated the script – correct line feeds now
Added in chmod x+ command
Updated the script – command on 118 from “xdg-open” to “/usr/bin/xdg-open”

Can you confirm if this is all correct now?
Thanks for the help

4 Likes

Anyone had any problems with 4.3.0.15 ? I mean with script…

Works

@all didn’t want to start a new topic so: updated to 4.4 and still works. Had to rerun the script after every update up until now, though. Also after a while of inactivity (not using the Play Store, or the apps, can’t tell the amount of time though, in my case a few months) Android apps and Play Store stop working and have to be reinstalled again

1 Like

hey, I managed to install opengapps 10 on xperia 10 III however there is an annoyance where I cannot put the android apps to background, I have to go to sailfish top menu → select something that will open a sailfish app → then it will open the android app → now I can put it in background. Really blocking from using the devices properly. Did anyone else run into this?

you can use mkdir -p to ignore error if the directory already exists

Actually managed to figure it out. After having ran the android setup wizard and setting up my google account I made a new system image with the script but removed setupwizarddefault-arm64 and setupwizardtablet-arm64. After rebooting the account was still set up and the annoying thing doesn’t happen anymore.

1 Like

Okay help us simpletons understand

Which part do you need help with?

How did u remove those files

I changed the part in the script where it deletes files

install_opengapps() {
    unzip "$(get_opengapps_zip)" -d "$TMPWORKDIR/opengapps/"

    for p in $GOOGLE_APPS_REMOVE; do
        rm "$TMPWORKDIR/opengapps/Core/$p-all.tar.lz"
    done

    rm "$TMPWORKDIR/opengapps/Core/setupwizarddefault-arm64.tar.lz"
    rm "$TMPWORKDIR/opengapps/Core/setupwizardtablet-arm64.tar.lz"
    if [ -f "$TMPWORKDIR/opengapps/Core/extservicesgoogle-all.tar.lz" ]; then
        rm -r "$SQUASHFS_ROOT/system/priv-app/ExtServices"
    fi
    if [ -f "$TMPWORKDIR/opengapps/Core/extsharedgoogle-all.tar.lz" ]; then
        rm -r "$SQUASHFS_ROOT/system/app/ExtShared"
    fi


    mkdir "$TMPWORKDIR/opengapps_2"
    for f in "$TMPWORKDIR"/opengapps/Core/*.tar.lz; do
        lzip -c -d "$f" | tar -x -C "$TMPWORKDIR/opengapps_2"
    done
    rm -r "$TMPWORKDIR/opengapps/"

    cp -r "$TMPWORKDIR"/opengapps_2/*/*/* "$SQUASHFS_ROOT/system/"

    rm -r "$TMPWORKDIR/opengapps_2/"
}
1 Like

If you dont mind sharing the the script as some of us are not so tech savvy

I used the same script that you can get from this thread from the mega link

I’ll repost

#!/bin/sh

# Install Open GApps to the Alien Dalvik squashfs system.img.

set -e


WORKDIR=/home/.aliendalvik_systemimg_patch
TMPWORKDIR="$WORKDIR/tmp"
SQUASHFS_ROOT="$TMPWORKDIR/squashfs-root"
MOUNT_ROOT="$TMPWORKDIR/systemimg_mount"
SYSTEM_IMG=/opt/alien/system.img
ORIG_IMG_FILE=orig_img_path.txt

FEDORA22_REPO=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Everything/aarch64/os/Packages

OPENGAPPS_ARCH=arm64
OPENGAPPS_API=10.0
OPENGAPPS_VARIANT=pico

GOOGLE_APPS_REMOVE='carriersetup extservicesgoogle extsharedgoogle googlebackuptransport googlecontactssync googlefeedback googlepartnersetup'


log() {
    printf '%s\n' "$1" > /dev/stderr
}


install_fedora22_rpm() {
    pkgname="$1"
    pkgversion="$2"

   if ! rpm -q "$pkgname" > /dev/null; then
       pkgfile="$pkgname-$pkgversion.fc30.aarch64.rpm"
      firstletter="$(printf '%s' "$pkgfile" | cut -c 1)"
       mkdir "$TMPWORKDIR/rpms"
        curl "$FEDORA22_REPO/$firstletter/$pkgfile" > "$TMPWORKDIR/rpms/$pkgfile"
       pkcon -y install-local "$TMPWORKDIR/rpms/$pkgfile"
       rm "$TMPWORKDIR/rpms/$pkgfile"
        rmdir "$TMPWORKDIR/rpms"
   fi
}


install_deps() {
    if ! rpm -q squashfs-tools > /dev/null; then
        pkcon -y install squashfs-tools
    fi

    install_fedora22_rpm lzip 1.20-4
}


extract_image() {
    mkdir "$MOUNT_ROOT"
    mount -o loop,ro "$SYSTEM_IMG" "$MOUNT_ROOT"

    if [ -f "$MOUNT_ROOT/$ORIG_IMG_FILE" ]; then
        orig_image="$(cat "$MOUNT_ROOT/$ORIG_IMG_FILE")"
        log "$SYSTEM_IMG already patched, using original from $orig_image"
    else
        orig_image="$WORKDIR/system.img.orig.$(date +%Y%m%dT%H%M%S)"
        cp "$SYSTEM_IMG" "$orig_image"
        log "Copying original image $SYSTEM_IMG to $orig_image"
    fi
    umount "$MOUNT_ROOT"

    if [ ! -f "$orig_image" ]; then
        log "$orig_image not found"
        return 1
    fi

    mount -o loop,ro "$orig_image" "$MOUNT_ROOT"

    if [ -f "$MOUNT_ROOT/$ORIG_IMG_FILE" ]; then
        umount "$MOUNT_ROOT"
        rmdir "$MOUNT_ROOT"
        log "$orig_image already patched, please restore original image to $SYSTEM_IMG"
        return 1
    fi

    mkdir -p "$SQUASHFS_ROOT"
    # rsync needs to be run twice to copy all xattrs. Probably a bug in rsync.
    rsync -aSHAX "$MOUNT_ROOT/" "$SQUASHFS_ROOT/"
    rsync -aSHAX "$MOUNT_ROOT/" "$SQUASHFS_ROOT/"
    umount "$MOUNT_ROOT"
    rmdir "$MOUNT_ROOT"

    printf '%s' "$orig_image" > "$SQUASHFS_ROOT/$ORIG_IMG_FILE"
}


build_image() {
    cp "$SYSTEM_IMG" "$TMPWORKDIR/system.img.backup"
    mksquashfs "$SQUASHFS_ROOT" "$SYSTEM_IMG" -noappend -no-exports -no-duplicates -no-fragments
    rm "$TMPWORKDIR/system.img.backup"
    rm -r "$SQUASHFS_ROOT"
}


_find_opengapps() {
    downloads=/home/defaultuser/Downloads/
    name_pattern="open_gapps-$OPENGAPPS_ARCH-$OPENGAPPS_API-$OPENGAPPS_VARIANT-*.zip"
    if [ "$1" != quiet ]; then
        log "Searching for Open GApps zip at $downloads/$name_pattern"
    fi
    find "$downloads" -maxdepth 1 -name "$name_pattern" | sort | tail -n 1
}


get_opengapps_zip() {
    opengapps_zip="$(_find_opengapps)"
    if [ -z "$opengapps_zip" ]; then
        # Show the Open GApps download page to the user instead of automating
        # the download of the latest version.
        # https://opengapps.org/blog/post/2016/03/18/the-no-mirror-policy/
        log "Opening Open GApps download page"
        runuser -l defaultuser -- /usr/bin/xdg-open "https://opengapps.org/?download=true&arch=$OPENGAPPS_ARCH&api=$OPENGAPPS_API&variant=$OPENGAPPS_VARIANT"
        log "Waiting for download to start"
        while [ -z "$opengapps_zip" ]; do
            sleep 1
            opengapps_zip="$(_find_opengapps quiet)"
        done
        log "Detected new download at $opengapps_zip"
        log "Waiting for download to finish"
        while [ -f "$opengapps_zip" ] && [ -f "$opengapps_zip.part" ]; do
            sleep 1
        done
        sleep 1
        if [ ! -f "$opengapps_zip" ]; then
            log "Download failed"
            return 1
        fi
    else
        log "Found Open GApps zip $opengapps_zip"
    fi
    printf '%s' "$opengapps_zip"
}


install_opengapps() {
    unzip "$(get_opengapps_zip)" -d "$TMPWORKDIR/opengapps/"

    for p in $GOOGLE_APPS_REMOVE; do
        rm "$TMPWORKDIR/opengapps/Core/$p-all.tar.lz"
    done

    rm "$TMPWORKDIR/opengapps/Core/setupwizarddefault-arm64.tar.lz"
    rm "$TMPWORKDIR/opengapps/Core/setupwizardtablet-arm64.tar.lz"
    if [ -f "$TMPWORKDIR/opengapps/Core/extservicesgoogle-all.tar.lz" ]; then
        rm -r "$SQUASHFS_ROOT/system/priv-app/ExtServices"
    fi
    if [ -f "$TMPWORKDIR/opengapps/Core/extsharedgoogle-all.tar.lz" ]; then
        rm -r "$SQUASHFS_ROOT/system/app/ExtShared"
    fi


    mkdir "$TMPWORKDIR/opengapps_2"
    for f in "$TMPWORKDIR"/opengapps/Core/*.tar.lz; do
        lzip -c -d "$f" | tar -x -C "$TMPWORKDIR/opengapps_2"
    done
    rm -r "$TMPWORKDIR/opengapps/"

    cp -r "$TMPWORKDIR"/opengapps_2/*/*/* "$SQUASHFS_ROOT/system/"

    rm -r "$TMPWORKDIR/opengapps_2/"
}


set_traps() {
    # shellcheck disable=SC2064
    trap "$*" EXIT HUP INT QUIT PIPE TERM
}

cleanup() {
    if [ ! -f "$SYSTEM_IMG" ] && [ -f "$TMPWORKDIR/system.img.backup" ]; then
        mv "$TMPWORKDIR/system.img.backup" "$SYSTEM_IMG" || :
    fi
    umount "$MOUNT_ROOT" || :
    rm -r "$TMPWORKDIR" || :
    set_traps -
    exit 1
}

set_traps cleanup

systemctl stop aliendalvik

mkdir -p "$WORKDIR"
mkdir -p "$TMPWORKDIR"

install_deps
extract_image
install_opengapps
build_image

rmdir "$TMPWORKDIR"

set_traps -
exit 0