Skip to content

Instantly share code, notes, and snippets.

@denisoster
Last active August 5, 2022 23:41
Show Gist options
  • Save denisoster/07251780c66fbba309b00c1e0fb602be to your computer and use it in GitHub Desktop.
Save denisoster/07251780c66fbba309b00c1e0fb602be to your computer and use it in GitHub Desktop.
UDisks 2 with support mountpoint via udev rule
# Maintainer: Felix Yan <[email protected]>
# Contributor: Ionut Biru <[email protected]>
pkgname=udisks2
pkgver=2.9.4
pkgrel=2
pkgdesc="Disk Management Service, version 2"
arch=('x86_64')
url="https://www.freedesktop.org/wiki/Software/udisks"
license=('GPL2')
depends=('polkit' 'libatasmart' 'libgudev' 'libblockdev')
makedepends=('docbook-xsl' 'gobject-introspection' 'parted' 'gtk-doc')
optdepends=('gptfdisk: GUID partition table support'
'ntfs-3g: NTFS filesystem management support'
'dosfstools: VFAT filesystem management support')
backup=('etc/udisks2/udisks2.conf')
source=(https://github.com/storaged-project/udisks/archive/udisks-$pkgver.tar.gz
where.patch)
sha512sums=('5b266cbc29f55d4c4a5100147793becf32a95f94bc7e184796bd2505a4e958a6bce9e5ffa584e4a89c7b874ed14ba6d9d096659565d0f51d860ef216d0cbd435'
'fd65af07750d50bdafb725239f36a35e745ce24859101ee655d1402c3e4fb5730c1b6f3858fb27d664f04d690b8bae753b130779475e17d3c24fdaa008b92ce7')
prepare() {
cd udisks-udisks-$pkgver
NOCONFIGURE=1 ./autogen.sh
patch --strip=1 --input="${srcdir}/where.patch"
}
build() {
cd udisks-udisks-$pkgver
./configure --prefix=/usr --sysconfdir=/etc \
--sbindir=/usr/bin --libexecdir=/usr/lib \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--localstatedir=/var --disable-static \
--enable-gtk-doc enable_available_modules=yes
make
}
check() {
cd udisks-udisks-$pkgver
make check
}
package() {
cd udisks-udisks-$pkgver
make DESTDIR="$pkgdir" install
}
ENV{ID_FS_UUID}="cd8e3e17-326b-4cd0-9e00-dc4bdb0a622b", ENV{UDISKS_MOUNT_WHERE}="/home/denis/SAMSUNG"
Index: src/udiskslinuxfilesystem.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
--- a/src/udiskslinuxfilesystem.c (revision 001c486e6d099ed33e2de4f5c73c03e3ee180f81)
+++ b/src/udiskslinuxfilesystem.c (date 1659728796866)
@@ -554,6 +554,7 @@
gchar *escaped_user_name = NULL;
gchar *mount_dir = NULL;
gchar *mount_point = NULL;
+ gchar *where = NULL;
gchar *orig_mount_point;
GString *str;
gchar *s;
@@ -681,6 +682,21 @@
mount_point = g_strdup_printf ("%s/disk", mount_dir);
}
+ if (object != NULL) {
+ UDisksLinuxDevice *device = udisks_linux_block_object_get_device(object);
+
+ if (device != NULL && device->udev_device != NULL) {
+ where = g_strdup(g_udev_device_get_property(device->udev_device, "UDISKS_MOUNT_WHERE"));
+
+ if (where != NULL) {
+ mount_point = where;
+ }
+
+ g_object_unref (device);
+ }
+
+ }
+
/* ... then uniqify the mount point */
orig_mount_point = g_strdup (mount_point);
n = 1;
Index: src/udiskslinuxmountoptions.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/udiskslinuxmountoptions.c b/src/udiskslinuxmountoptions.c
--- a/src/udiskslinuxmountoptions.c (revision 001c486e6d099ed33e2de4f5c73c03e3ee180f81)
+++ b/src/udiskslinuxmountoptions.c (date 1659729119989)
@@ -963,7 +963,7 @@
object = udisks_daemon_util_dup_object (block, NULL);
device = udisks_linux_block_object_get_device (object);
if (device != NULL && device->udev_device != NULL &&
- g_udev_device_get_property_as_boolean (device->udev_device, "UDISKS_FILESYSTEM_SHARED"))
+ (g_udev_device_get_property_as_boolean (device->udev_device, "UDISKS_FILESYSTEM_SHARED") || g_udev_device_get_property (device->udev_device, "UDISKS_MOUNT_WHERE")))
shared_fs = TRUE;
fs_type_l = g_ascii_strdown (fs_type, -1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment