Skip to content

Instantly share code, notes, and snippets.

@tinywrkb
Last active July 10, 2022 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinywrkb/cdc98926f7594d61ac538177eb80a204 to your computer and use it in GitHub Desktop.
Save tinywrkb/cdc98926f7594d61ac538177eb80a204 to your computer and use it in GitHub Desktop.
ntfs-3g-improvements.patch
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 6e15dc44..d43d8e5a 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -2,48 +2,85 @@
# Contributor: Tom Gundersen <teg@jklm.no>
# Contributor: Ronald van Haren <ronald.archlinux.org>
# Contributor: Thomas Bächler <thomas.archlinux.org>
+# Contributor: okhsunrog <me@gornushko.com>
+# Contributor: tinywrkb <tinywrkb@gmail.com>
-pkgname=ntfs-3g
-_pkgname=ntfs-3g_ntfsprogs
+pkgbase=ntfs-3g
+pkgname=(ntfsprogs ntfs-3g ntfs3-udev)
pkgver=2022.5.17
pkgrel=1
-pkgdesc='NTFS filesystem driver and utilities'
-url='https://www.tuxera.com/community/open-source-ntfs-3g/'
+pkgdesc=' NTFS filesystem driver and utilities'
+url='https://www.tuxera.com/company/open-source/'
arch=('x86_64')
license=('GPL2')
-depends=('util-linux' 'fuse2')
-source=("https://tuxera.com/opensource/${_pkgname}-${pkgver}.tgz")
-sha256sums=('0489fbb6972581e1b417ab578d543f6ae522e7fa648c3c9b49c789510fd5eb93')
+depends=('util-linux')
+makedepends=('fuse2' 'git')
+_commit=875a1d4e90874457151466870fe2c70a2bedfd98 # tags/2022.5.17
+source=("ntfs-3g::git+https://github.com/tuxera/ntfs-3g#commit=$_commit"
+ 'mount.ntfs'
+ 'ntfs3.rules')
+sha256sums=('SKIP'
+ '6ce6b3545eb5e98220ce1ea663b46a0a4e8346f472ad00a7580b9aa38e074fa5'
+ '35cbd5290944b8ce9536dcee42321e5b418ff135f5b623bed6797760e1a1ad5b')
-conflicts=('ntfsprogs')
-provides=('ntfsprogs')
-replaces=('ntfsprogs')
+pkgver() {
+ cd ntfs-3g
+ git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
+}
-prepare() {
- cd ${_pkgname}-${pkgver}
- sed 's|$(DESTDIR)/sbin|$(DESTDIR)/usr/bin|' -i {ntfsprogs,src}/Makefile.in
+_pick() {
+ local p="$1" f d; shift
+ for f; do
+ d="$srcdir/$p/${f#$pkgdir/}"
+ mkdir -p "$(dirname "$d")"
+ mv "$f" "$d"
+ rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
+ done
}
build() {
- cd ${_pkgname}-${pkgver}
- ./configure \
- --prefix=/usr \
- --sbin=/usr/bin \
- --mandir=/usr/share/man \
- --disable-ldconfig \
- --disable-static \
- --with-fuse=external \
- --enable-xattr-mappings \
- --enable-posix-acls \
- --enable-extras \
- --enable-crypto \
-
- make
+ cd ntfs-3g
+
+ local configure_options=(
+ --prefix=/usr
+ --sbin=/usr/bin
+ --mandir=/usr/share/man
+ --disable-ldconfig
+ --disable-static
+ --disable-mount-helper
+ --enable-crypto
+ --enable-extras
+ --enable-posix-acls
+ --enable-xattr-mappings
+ --with-fuse=external
+ )
+
+ autoreconf -vfi
+ ./configure "${configure_options[@]}"
+ make ntfsprogs
}
-package_ntfs-3g() {
- cd ${_pkgname}-${pkgver}
- make DESTDIR="${pkgdir}" rootbindir=/usr/bin rootsbindir=/usr/bin rootlibdir=/usr/lib install
+package_ntfsprogs() {
+ pkgdesc='NTFS filesystem utilities'
+ depends+=('gnutls')
+ make -C ntfs-3g ntfsprogs DESTDIR="${pkgdir}" rootbindir=/usr/bin install
rm "${pkgdir}"/usr/share/man/man8/ntfsfallocate.8 # uninstalled binary
- ln -s /usr/bin/ntfs-3g "${pkgdir}/usr/bin/mount.ntfs"
+ install -Dm755 mount.ntfs -t "${pkgdir}"/usr/bin/
+
+ cd "${pkgdir}"
+ _pick ntfs-3g-fuse usr/bin/*ntfs-3g*
+ _pick ntfs-3g-fuse usr/share/man/man8/*ntfs-3g*
+}
+
+package_ntfs-3g() {
+ pkgdesc='NTFS filesystem driver for FUSE'
+ depends+=('fuse2' 'ntfsprogs')
+ mv ntfs-3g-fuse/* "${pkgdir}"
+ ln -s /usr/bin/lowntfs-3g "${pkgdir}"/usr/bin/mount.lowntfs-3g
+ ln -s /usr/bin/ntfs-3g "${pkgdir}"/usr/bin/mount.ntfs-3g
+}
+
+package_ntfs3-udev() {
+ pkgdesc='Udev rule to use ntfs3 kernel driver by default'
+ install -Dm644 ntfs3.rules "${pkgdir}"/usr/lib/udev/rules.d/99-ntfs3.rules
}
diff --git a/trunk/mount.ntfs b/trunk/mount.ntfs
new file mode 100644
index 00000000..8e2db972
--- /dev/null
+++ b/trunk/mount.ntfs
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+# mount.ntfs : catch {,-tauto,-tntfs} NTFS mounts
+# ===============================================
+# (c) DLCB 2/11-2021
+
+if zgrep CONFIG_NTFS3_FS /proc/config.gz &>/dev/null; then
+ exec mount -tntfs3 "$@"
+else
+ exec ntfs-3g "$@"
+fi
diff --git a/trunk/ntfs3.rules b/trunk/ntfs3.rules
new file mode 100644
index 00000000..c436d2f6
--- /dev/null
+++ b/trunk/ntfs3.rules
@@ -0,0 +1 @@
+SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment