mirror of
https://github.com/gromgit/homebrew-fuse.git
synced 2025-12-08 09:11:37 +00:00
106 lines
3.3 KiB
Ruby
106 lines
3.3 KiB
Ruby
require_relative "../require/macfuse"
|
|
|
|
class Ntfs3gMac < Formula
|
|
desc "Read-write NTFS driver for FUSE"
|
|
homepage "https://www.tuxera.com/community/open-source-ntfs-3g/"
|
|
url "https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2021.8.22.tgz"
|
|
sha256 "55b883aa05d94b2ec746ef3966cb41e66bed6db99f22ddd41d1b8b94bb202efb"
|
|
license all_of: ["GPL-2.0-or-later", "LGPL-2.0-or-later"]
|
|
|
|
livecheck do
|
|
url :head
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
root_url "https://github.com/gromgit/homebrew-fuse/releases/download/ntfs-3g-mac-2021.8.22"
|
|
rebuild 1
|
|
sha256 cellar: :any, monterey: "7392dbc67b438543512dd9fe1baf69c8294b56c575416d812cded4844878bb44"
|
|
sha256 cellar: :any, big_sur: "968b41b875cc84b63bbe968a2915e238c9d7156c7ff21a1f31b330ad6632654f"
|
|
sha256 cellar: :any, catalina: "60b68f563a0b12e22f036633f41632119ebf93224891c73447d0db9f705834d2"
|
|
sha256 cellar: :any, mojave: "dfa90d9771a1531fe3c6ab7a2e84eb0867c1c2da386f6e158a45d1ca7d54add1"
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/tuxera/ntfs-3g.git", branch: "edge"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libgcrypt" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "coreutils" => :test
|
|
depends_on "gettext"
|
|
depends_on MacfuseRequirement
|
|
depends_on :macos
|
|
|
|
def install
|
|
setup_fuse
|
|
ENV.append "LDFLAGS", "-lintl"
|
|
|
|
args = %W[
|
|
--disable-debug
|
|
--disable-dependency-tracking
|
|
--prefix=#{prefix}
|
|
--exec-prefix=#{prefix}
|
|
--mandir=#{man}
|
|
--with-fuse=external
|
|
--enable-extras
|
|
]
|
|
|
|
system "./autogen.sh" if build.head?
|
|
# Workaround for hardcoded /sbin in ntfsprogs
|
|
inreplace "ntfsprogs/Makefile.in", "/sbin", sbin
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "install"
|
|
|
|
# Install a script that can be used to enable automount
|
|
File.open("#{sbin}/mount_ntfs", File::CREAT|File::TRUNC|File::RDWR, 0755) do |f|
|
|
f.puts <<~EOS
|
|
#!/bin/bash
|
|
|
|
VOLUME_NAME="${@:$#}"
|
|
VOLUME_NAME=${VOLUME_NAME#/Volumes/}
|
|
USER_ID=#{Process.uid}
|
|
GROUP_ID=#{Process.gid}
|
|
|
|
if [ "$(/usr/bin/stat -f %u /dev/console)" -ne 0 ]; then
|
|
USER_ID=$(/usr/bin/stat -f %u /dev/console)
|
|
GROUP_ID=$(/usr/bin/stat -f %g /dev/console)
|
|
fi
|
|
|
|
#{opt_bin}/ntfs-3g \\
|
|
-o volname="${VOLUME_NAME}" \\
|
|
-o local \\
|
|
-o negative_vncache \\
|
|
-o auto_xattr \\
|
|
-o auto_cache \\
|
|
-o noatime \\
|
|
-o windows_names \\
|
|
-o streams_interface=openxattr \\
|
|
-o inherit \\
|
|
-o uid="$USER_ID" \\
|
|
-o gid="$GROUP_ID" \\
|
|
-o allow_other \\
|
|
-o big_writes \\
|
|
"$@" >> /var/log/mount-ntfs-3g.log 2>&1
|
|
|
|
exit $?;
|
|
EOS
|
|
end
|
|
end
|
|
|
|
test do
|
|
# create a small raw image, format and check it
|
|
ntfs_raw = testpath/"ntfs.raw"
|
|
system Formula["coreutils"].libexec/"gnubin/truncate", "--size=10M", ntfs_raw
|
|
ntfs_label_input = "Homebrew"
|
|
system sbin/"mkntfs", "--force", "--fast", "--label", ntfs_label_input, ntfs_raw
|
|
system bin/"ntfsfix", "--no-action", ntfs_raw
|
|
ntfs_label_output = shell_output("#{sbin}/ntfslabel #{ntfs_raw}")
|
|
assert_match ntfs_label_input, ntfs_label_output
|
|
end
|
|
end
|