diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-22 14:06:55 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-22 14:09:51 -0400 |
commit | 731926b5e5fc28752433f830569d228513cceea6 (patch) | |
tree | 53fa538157d091d126ceb1482d6918b8541ae9ab /bcachefs.c | |
parent | f76c449ec0cb96ebeb4a110ba30ecb695b5a1823 (diff) |
Kill shell script wrappers
nixos has trouble with the shell script wrappers - readlink isn't
available by default!
But, there's a better approach: just get rid of them and use symlinks
instead, and have main() check what we're supposed to be.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'bcachefs.c')
-rw-r--r-- | bcachefs.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -188,6 +188,24 @@ int main(int argc, char *argv[]) full_cmd = argv[0]; + /* Are we being called via a symlink? */ + + if (strstr(full_cmd, "mkfs")) + return cmd_format(argc, argv); + + if (strstr(full_cmd, "fsck")) + return cmd_fsck(argc, argv); + +#ifdef BCACHEFS_FUSE + if (strstr(full_cmd, "mount.fuse")) + return cmd_fusemount(argc, argv); +#endif + +#ifndef BCACHEFS_NO_RUST + if (strstr(full_cmd, "mount")) + return cmd_mount(argc, argv); +#endif + setvbuf(stdout, NULL, _IOLBF, 0); char *cmd = pop_cmd(&argc, argv); @@ -253,9 +271,8 @@ int main(int argc, char *argv[]) if (!strcmp(cmd, "setattr")) return cmd_setattr(argc, argv); #ifndef BCACHEFS_NO_RUST - if (!strcmp(cmd, "mount")) { + if (!strcmp(cmd, "mount")) return cmd_mount(argc, argv); - } #endif #ifdef BCACHEFS_FUSE |