Avoid using cpp for sshfs.1 generation
Move the logic to determine which values to stick into the manual page to the configure script and replace the logic to build the sshfs.1 manual page with sed instead of abusing cpp. I'm not using AC_OUTPUT here because this macro is typically used to generate support build files. Final artifacts of the build should, in general, be built by the Makefile itself.
This commit is contained in:
parent
a03d3eab39
commit
9b4ca1aade
|
|
@ -12,7 +12,8 @@ endif
|
|||
|
||||
sshfs_LDADD = $(SSHFS_LIBS)
|
||||
sshfs_CFLAGS = $(SSHFS_CFLAGS)
|
||||
sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\"
|
||||
sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\" \
|
||||
-DIDMAP_DEFAULT="\"$(IDMAP_DEFAULT)\""
|
||||
|
||||
EXTRA_DIST = sshnodelay.c sshfs.1.in
|
||||
CLEANFILES = sshnodelay.so sshfs.1 sshfs.1.tmp
|
||||
|
|
@ -20,8 +21,10 @@ CLEANFILES = sshnodelay.so sshfs.1 sshfs.1.tmp
|
|||
dist_man_MANS = sshfs.1
|
||||
|
||||
sshfs.1: sshfs.1.in
|
||||
$(AM_V_GEN)$(CPP) $(CPPFLAGS) -P -xassembler-with-cpp sshfs.1.in \
|
||||
| sed -e '/^$$/d' >sshfs.1.tmp || exit 1; \
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's,__IDMAP_DEFAULT__,$(IDMAP_DEFAULT),g' \
|
||||
-e 's,__UNMOUNT_COMMAND__,$(UNMOUNT_COMMAND),g' \
|
||||
<sshfs.1.in >sshfs.1.tmp || exit 1; \
|
||||
mv sshfs.1.tmp sshfs.1
|
||||
|
||||
if SSH_NODELAY_SO
|
||||
|
|
|
|||
11
configure.ac
11
configure.ac
|
|
@ -56,5 +56,16 @@ fi
|
|||
AM_CONDITIONAL(FUSE_OPT_COMPAT, test "$have_fuse_opt_parse" = no)
|
||||
AM_CONDITIONAL(DARWIN_COMPAT, test "$osname" = darwin)
|
||||
|
||||
AC_CHECK_PROG(UNMOUNT_COMMAND, fusermount, fusermount -u, umount)
|
||||
|
||||
# TODO: Figure out why we special-case this in Darwin. Would be nice if
|
||||
# the default setting was consistent across platforms so we wouldn't need
|
||||
# to care about it here.
|
||||
case "$osname" in
|
||||
darwin) IDMAP_DEFAULT=user ;;
|
||||
*) IDMAP_DEFAULT=none ;;
|
||||
esac
|
||||
AC_SUBST(IDMAP_DEFAULT)
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
|
|
|||
18
sshfs.1.in
18
sshfs.1.in
|
|
@ -7,11 +7,7 @@ SSHFS \- filesystem client based on ssh
|
|||
\fBsshfs\fP [\fIuser\fP@]\fBhost\fP:[\fIdir\fP] \fBmountpoint\fP [\fIoptions\fP]
|
||||
.SS unmounting
|
||||
.TP
|
||||
#ifdef __APPLE__
|
||||
\fBumount mountpoint\fP
|
||||
#else
|
||||
\fBfusermount -u mountpoint\fP
|
||||
#endif
|
||||
\fB__UNMOUNT_COMMAND__ mountpoint\fP
|
||||
.SH DESCRIPTION
|
||||
SSHFS (Secure SHell FileSystem) is a file system for Linux (and other
|
||||
operating systems with a FUSE implementation, such as Mac OS X or FreeBSD)
|
||||
|
|
@ -101,22 +97,14 @@ fix buffer fillup bug in server (default: on)
|
|||
.RE
|
||||
.TP
|
||||
\fB\-o\fR idmap=TYPE
|
||||
user/group ID mapping, possible types are:
|
||||
user/group ID mapping (default: __IDMAP_DEFAULT__)
|
||||
.RS 8
|
||||
.TP
|
||||
none
|
||||
#ifdef __APPLE__
|
||||
no translation of the ID space
|
||||
#else
|
||||
no translation of the ID space (default)
|
||||
#endif
|
||||
.TP
|
||||
user
|
||||
#ifdef __APPLE__
|
||||
only translate UID/GID of connecting user (default)
|
||||
#else
|
||||
only translate UID of connecting user
|
||||
#endif
|
||||
only translate UID/GID of connecting user
|
||||
.TP
|
||||
file
|
||||
translate UIDs/GIDs based upon the contents of \fBuidfile \fR and
|
||||
|
|
|
|||
23
sshfs.c
23
sshfs.c
|
|
@ -3413,14 +3413,9 @@ static void usage(const char *progname)
|
|||
" [no]nodelaysrv set nodelay tcp flag in sshd (default: off)\n"
|
||||
" [no]truncate fix truncate for old servers (default: off)\n"
|
||||
" [no]buflimit fix buffer fillup bug in server (default: on)\n"
|
||||
" -o idmap=TYPE user/group ID mapping, possible types are:\n"
|
||||
#ifdef __APPLE__
|
||||
" -o idmap=TYPE user/group ID mapping (default: " IDMAP_DEFAULT ")\n"
|
||||
" none no translation of the ID space\n"
|
||||
" user only translate UID/GID of connecting user (default)\n"
|
||||
#else
|
||||
" none no translation of the ID space (default)\n"
|
||||
" user only translate UID of connecting user\n"
|
||||
#endif
|
||||
" user only translate UID/GID of connecting user\n"
|
||||
" file translate UIDs/GIDs contained in uidfile/gidfile\n"
|
||||
" -o uidfile=FILE file containing username:remote_uid mappings\n"
|
||||
" -o gidfile=FILE file containing groupname:remote_gid mappings\n"
|
||||
|
|
@ -3975,11 +3970,15 @@ int main(int argc, char *argv[])
|
|||
sshfs.delay_connect = 0;
|
||||
sshfs.slave = 0;
|
||||
sshfs.detect_uid = 0;
|
||||
#ifdef __APPLE__
|
||||
sshfs.idmap = IDMAP_USER;
|
||||
#else
|
||||
sshfs.idmap = IDMAP_NONE;
|
||||
#endif
|
||||
if (strcmp(IDMAP_DEFAULT, "none") == 0) {
|
||||
sshfs.idmap = IDMAP_NONE;
|
||||
} else if (strcmp(IDMAP_DEFAULT, "user") == 0) {
|
||||
sshfs.idmap = IDMAP_USER;
|
||||
} else {
|
||||
fprintf(stderr, "bad idmap default value built into sshfs; "
|
||||
"assuming none (bad logic in configure script?)\n");
|
||||
sshfs.idmap = IDMAP_NONE;
|
||||
}
|
||||
sshfs.nomap = NOMAP_ERROR;
|
||||
ssh_add_arg("ssh");
|
||||
ssh_add_arg("-x");
|
||||
|
|
|
|||
Loading…
Reference in New Issue