I cannot guarantee proper function, so you’re on your own!

This modification should work with ext4, btrfs, vfat, maybe even with extfat formatted cards. Tested with btrfs only on Sailfish OS v1.0.38. As of Sailfish 1.0.5.19 btrfs formatted cards seem to work without further modifications!

Edit /usr/sbin/mount-sd.sh to read as follows or download mount-sd.sh:

#!/bin/bash

SDCARD=/dev/sdcard
DEF_UID=$(grep "^UID_MIN" /etc/login.defs |  tr -s " " | cut -d " " -f2)
DEF_GID=$(grep "^GID_MIN" /etc/login.defs |  tr -s " " | cut -d " " -f2)
DEVICEUSER=$(getent passwd $DEF_UID | sed 's/:.*//')
MNT=/run/user/$DEF_UID/media/sdcard

if [ "$ACTION" = "add" ]; then
        if [ -b /dev/mmcblk1p1 ]; then
                ln -sf /dev/mmcblk1p1 $SDCARD
        elif [ -b /dev/mmcblk1 ]; then
                ln -sf /dev/mmcblk1 $SDCARD
        else
                exit $?
        fi
        su $DEVICEUSER -c "mkdir -p $MNT"
        mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID
        if [ -z $(mount | grep $MNT) ]; then
                # let's try 2nd time w/o options
                mount -o rw $SDCARD $MNT
                if [ $? = 0 ]; then
                        chown $DEF_UID:$DEF_GID $MNT
                fi
        fi
else
        umount $SDCARD

        if [ $? = 0 ]; then
                rm -f $SDCARD
        else
                umount -l $MNT
                rm -f $SDCARD
        fi
fi

Reboot your Jolla, the sdcard will be mounted automatically:

[nemo@localhost ~]$ mount |grep sdcard
/dev/mmcblk1p1 on /run/user/100000/media/sdcard type btrfs (rw,relatime,ssd,noacl,space_cache)

Benjamin Wiedmann

Benjamin Wiedmann is an IT Professional, Software Developer, Photograph and Musician. Read more...

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus


Benjamin Wiedmann

Benjamin Wiedmann is an IT Professional, Software Developer, Photograph and Musician. Read more...

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.