Doing libzfs the hard way, but it works

This commit is contained in:
Darryl Nixon 2023-07-16 10:23:03 -07:00
parent 176820cd81
commit 9534c30bd7
4 changed files with 21 additions and 9 deletions

View file

@ -0,0 +1,12 @@
# melamine
todo!
## install
```bash
sudo apt install --yes --no-install-recommends build-essential python3-dev libzfslinux-dev && \
sudo pip3 install Cython && \
git clone https://github.com/truenas/py-libzfs && \
cd py-libzfs && ./configure --prefix=/usr && sudo make install
```

View file

@ -39,7 +39,7 @@ class ext2_inode_large_p(ctypes.POINTER(ext2_inode_large)):
class EXT23Handler: class EXT23Handler:
def __init__(self, fs: str) -> None: def __init__(self) -> None:
self.fs = "ext2/ext3" self.fs = "ext2/ext3"
self.libext2fs = ctypes.CDLL("libext2fs.so.2") self.libext2fs = ctypes.CDLL("libext2fs.so.2")
self.libext2fs.ext2fs_open.restype = ctypes.c_int self.libext2fs.ext2fs_open.restype = ctypes.c_int

View file

@ -5,7 +5,7 @@ import libzfs
class ZFSHandler: class ZFSHandler:
def __init__(self, fs: str) -> None: def __init__(self) -> None:
self.fs = "zfs" self.fs = "zfs"
async def get_hardlinks(self, path: Path) -> Generator: async def get_hardlinks(self, path: Path) -> Generator:

View file

@ -10,13 +10,13 @@ description = "A comprehensive file shredder for Linux"
readme = "README.md" readme = "README.md"
requires-python = ">=3.9" requires-python = ">=3.9"
license = { text = "MIT" } license = { text = "MIT" }
dependencies = [
"loguru==0.7.0", [project.dependencies]
"aiofiles==23.1.0", loguru = "0.7.0"
"uvloop==0.17.0", aiofiles = "23.1.0"
"asyncstdlib==3.10.8", uvloop = "0.17.0"
"psutil==5.9.5", asyncstdlib = "3.10.8"
] psutil = "5.9.5"
[project.scripts] [project.scripts]
melamine = "melamine.cli:run" melamine = "melamine.cli:run"