Skip to content

Commit

Permalink
Merge pull request #43 from Olf0/301+
Browse files Browse the repository at this point in the history
Commits for next release
  • Loading branch information
Olf0 committed May 30, 2021
2 parents 8d5cc34 + 0eddf43 commit 8af4b85
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions References.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Technical references
1. From *crypto-sdcard*
* [Release version format, RPM dependencies and Git workflow](https://github.com/Olf0/crypto-sdcard/blob/master/RPM-dependencies_Git-workflow.md)
* [On admin configurable policy rules with Polkit v0.1xy](https://github.com/Olf0/crypto-sdcard/blob/master/On-Polkit.md)
4 changes: 2 additions & 2 deletions rpm/mount-sdcard.spec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Name: mount-sdcard
Summary: Enhanced mounting scripts for SD-cards
Version: 1.7.2
Version: 1.8.0
# Since v1.4.2, the release version consists of two or three fields, separated by a dot ("."):
# - The first field must contain a natural number greater than zero.
# This number may be prefixed by one of {alpha,beta,stable}, e.g. "alpha13".
# This number may be prefixed by one of {alpha,beta,rc,stable}, e.g. "alpha13".
# - The second field indicates the minimal required SailfishOS version A.B.C.X in the format "sfosABC";
# the fourth field of a SailfishOS version ("X") is neither depended upon or denoted.
# - An optional third field might be used by downstream packagers, who alter the package but want to
Expand Down
2 changes: 1 addition & 1 deletion systemd/system/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ EnvironmentFile=-/etc/mount-sdcard/%p.conf
EnvironmentFile=-/etc/mount-sdcard/%N.conf
ExecStart=/usr/bin/udisksctl mount $UDISKS2_MOUNT_OPTIONS -b /dev/%i
ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
ExecStopPost=/bin/umount -vrq /dev/%i
ExecStopPost=-/bin/umount -vrq /dev/%i

16 changes: 9 additions & 7 deletions udev/rules.d/91-mountsd.rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ KERNEL!="mmcblk[1-9]*|sd*|sr*", GOTO="mountsd_end"
# https://git.sailfishos.org/mer-core/udisks2/blob/master/rpm/0005-Add-udev-rule-for-the-sda-drives.patch
# by setting these anew / clobbering these for *all suitable* devices.
KERNEL=="mmcblk[1-9]*", ENV{DEVTYPE}=="disk", ENV{MMC_TYPE}!="?*", ENV{ID_DRIVE_FLASH_SD}="1", ENV{ID_DRIVE_MEDIA_FLASH_SD}="1"
KERNEL=="sd*", ENV{DEVTYPE}=="disk", ENV{ID_DRIVE_FLASH_SD}="1", ENV{ID_DRIVE_MEDIA_FLASH_SD}="1"
# ToDo: Only set that for storage, which is not "rotational", but also for SATA-RAIDs; check, if ATTR{queue/rotational} works!?!
#KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ATTR{queue/rotational}=="0", ENV{ID_DRIVE_FLASH_SD}="1", ENV{ID_DRIVE_MEDIA_FLASH_SD}="1"
SUBSYSTEMS=="usb", KERNEL=="mmcblk0*|sd*|sr*", ENV{DEVTYPE}=="disk", ATTR{queue/rotational}=="0", ENV{MMC_TYPE}!="?*", ENV{ID_DRIVE_FLASH_SD}="1", ENV{ID_DRIVE_MEDIA_FLASH_SD}="1"

# Set UDISKS_CAN_POWER_OFF for all devices dealt with, here:
#ENV{DEVTYPE}=="disk", ENV{UDISKS_CAN_POWER_OFF}="1"
# Set power control / UDISKS_CAN_POWER_OFF for all devices dealt with, here: This is also supported for partitions, not only disks!?!
# KERNEL=="mmcblk[1-9]*", ATTR{power/control}=="off", ATTR{power/control}="auto"
# SUBSYSTEMS=="usb", KERNEL=="mmcblk0*|sd*|sr*", ATTR{power/control}=="off", ATTR{power/control}="auto"
KERNEL=="mmcblk[1-9]*", ATTR{power/control}=="on", ENV{UDISKS_CAN_POWER_OFF}="1"
SUBSYSTEMS=="usb", KERNEL=="mmcblk0*|sd*|sr*", ATTR{power/control}=="on", ENV{UDISKS_CAN_POWER_OFF}="1"

# Match ENV{ID_FS_USAGE}=="filesystem" for all selected devices
ENV{ID_FS_USAGE}=="filesystem", ACTION=="add|change", ENV{UDISKS_SYSTEM}="0", ENV{UDISKS_AUTO}="0", ENV{UDISKS_NAME}="mountsd_dev-%k", MODE="0660", ENV{MOUNTSD_ACTIVE}="1", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
KERNEL=="mmcblk[1-9]*", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add|change", ENV{UDISKS_SYSTEM}="0", ENV{UDISKS_AUTO}="0", ENV{UDISKS_NAME}="mountsd_dev-%k", MODE="0660", ENV{MOUNTSD_ACTIVATED}="1", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
SUBSYSTEMS=="usb", KERNEL=="mmcblk0*|sd*|sr*", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add|change", ENV{UDISKS_SYSTEM}="0", ENV{UDISKS_AUTO}="0", ENV{UDISKS_NAME}="mountsd_dev-%k", MODE="0660", ENV{MOUNTSD_ACTIVATED}="1", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
# When above detected and assigned devices are removed
ENV{MOUNTSD_ACTIVE}=="1", ACTION=="remove", ENV{MOUNTSD_ACTIVE}="0", ENV{UDISKS_NAME}="mountsd_removed", ENV{SYSTEMD_WANTS}="", ENV{SYSTEMD_USER_WANTS}="", RUN{program}+="/bin/systemctl stop mount-sd@%k.service"
ENV{MOUNTSD_ACTIVATED}=="1", ACTION=="remove", ENV{MOUNTSD_ACTIVATED}="0", ENV{UDISKS_NAME}="mountsd_removed", ENV{SYSTEMD_WANTS}="", ENV{SYSTEMD_USER_WANTS}="", RUN{program}+="/bin/systemctl stop mount-sd@%k.service"

LABEL="mountsd_end"

0 comments on commit 8af4b85

Please sign in to comment.