Allow to configure path of external tools

This commit is contained in:
Andrea Mazzoleni 2026-05-11 09:21:39 +02:00
parent 72cbf932d9
commit db98fb0e68
3 changed files with 52 additions and 0 deletions

View file

@ -611,6 +611,10 @@ int exit_sync_needed = 2;
#if HAVE_LINUX_DEVICE
static const char* const bcachefs_paths[] = {
#ifdef BCACHEFS_PATH
/* Path configured at build time (e.g. on NixOS). */
BCACHEFS_PATH,
#else
"/usr/sbin/bcachefs",
"/sbin/bcachefs",
"/usr/local/sbin/bcachefs",
@ -620,6 +624,7 @@ static const char* const bcachefs_paths[] = {
#ifdef __APPLE__
/* macOS (Intel & Apple Silicon) */
"/opt/homebrew/sbin/bcachefs",
#endif
#endif
0
};
@ -638,6 +643,10 @@ static const char* find_bcachefs(void)
#if HAVE_LINUX_DEVICE
static const char* const zfs_paths[] = {
#ifdef ZFS_PATH
/* Path configured at build time (e.g. on NixOS). */
ZFS_PATH,
#else
"/usr/sbin/zfs",
"/sbin/zfs",
"/usr/local/sbin/zfs",
@ -647,6 +656,7 @@ static const char* const zfs_paths[] = {
#ifdef __APPLE__
/* macOS (Intel & Apple Silicon) */
"/opt/homebrew/sbin/zfs",
#endif
#endif
0
};
@ -662,6 +672,10 @@ static const char* find_zfs(void)
}
static const char* const zpool_paths[] = {
#ifdef ZPOOL_PATH
/* Path configured at build time (e.g. on NixOS). */
ZPOOL_PATH,
#else
"/usr/sbin/zpool",
"/sbin/zpool",
"/usr/local/sbin/zpool",
@ -671,6 +685,7 @@ static const char* const zpool_paths[] = {
#ifdef __APPLE__
/* macOS (Intel & Apple Silicon) */
"/opt/homebrew/sbin/zpool",
#endif
#endif
0
};
@ -782,7 +797,12 @@ const char* stat_desc(struct stat* st)
}
#if HAVE_LINUX_DEVICE
static const char* smartctl_paths[] = {
#ifdef SMARTCTL_PATH
/* Path configured at build time (e.g. on NixOS). */
SMARTCTL_PATH,
#else
/* Linux & BSD */
"/usr/sbin/smartctl",
"/sbin/smartctl",
@ -792,6 +812,7 @@ static const char* smartctl_paths[] = {
#ifdef __APPLE__
/* macOS (Intel & Apple Silicon) */
"/opt/homebrew/sbin/smartctl",
#endif
#endif
0
};