mirror of
https://github.com/winfsp/sshfs-win.git
synced 2025-04-18 23:04:01 +03:00
Makefile: prepare Cygwin based distro
This commit is contained in:
parent
5e7500d1ff
commit
50e6b6b686
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.build
|
53
Makefile
Normal file
53
Makefile
Normal file
@ -0,0 +1,53 @@
|
||||
PrjDir = $(shell pwd)
|
||||
BldDir = .build
|
||||
SrcDir = $(BldDir)/src
|
||||
RootDir = $(BldDir)/root
|
||||
Status = $(BldDir)/status
|
||||
BinExtra = ssh #bash ls mount
|
||||
|
||||
goal: $(Status) $(Status)/done
|
||||
|
||||
$(Status):
|
||||
mkdir -p $(Status)
|
||||
|
||||
$(Status)/done: $(Status)/run-sshfs
|
||||
touch $(Status)/done
|
||||
|
||||
$(Status)/run-sshfs: $(Status)/root run-sshfs.c
|
||||
gcc -o $(RootDir)/bin/run-sshfs run-sshfs.c
|
||||
strip $(RootDir)/bin/run-sshfs
|
||||
touch $(Status)/run-sshfs
|
||||
|
||||
$(Status)/root: $(Status)/make
|
||||
mkdir -p $(RootDir)/bin $(RootDir)/dev/{mqueue,shm}
|
||||
(ldd $(SrcDir)/sshfs/sshfs; for f in $(BinExtra); do ldd /usr/bin/$$f; done) |\
|
||||
sed -n 's@^.*/usr/bin/\([^ ]*\).*$$@\1@p' |\
|
||||
while read f; do cp /usr/bin/$$f $(RootDir)/bin; done
|
||||
cp $(SrcDir)/sshfs/sshfs $(RootDir)/bin
|
||||
strip $(RootDir)/bin/sshfs
|
||||
for f in $(BinExtra); do cp /usr/bin/$$f $(RootDir)/bin; done
|
||||
touch $(Status)/root
|
||||
|
||||
$(Status)/make: $(Status)/config
|
||||
cd $(SrcDir)/sshfs && make
|
||||
touch $(Status)/make
|
||||
|
||||
$(Status)/config: $(Status)/reconf
|
||||
cd $(SrcDir)/sshfs && ./configure
|
||||
touch $(Status)/config
|
||||
|
||||
$(Status)/reconf: $(Status)/patch
|
||||
cd $(SrcDir)/sshfs && autoreconf -i
|
||||
touch $(Status)/reconf
|
||||
|
||||
$(Status)/patch: $(Status)/clone
|
||||
cd $(SrcDir)/sshfs && for f in $(PrjDir)/patches/*.patch; do patch -p1 <$$f; done
|
||||
touch $(Status)/patch
|
||||
|
||||
$(Status)/clone:
|
||||
mkdir -p $(SrcDir)
|
||||
git clone $(PrjDir)/sshfs $(SrcDir)/sshfs
|
||||
touch $(Status)/clone
|
||||
|
||||
clean:
|
||||
git clean -dffx
|
32
patches/01-passwd.patch
Normal file
32
patches/01-passwd.patch
Normal file
@ -0,0 +1,32 @@
|
||||
diff --git a/sshfs.c b/sshfs.c
|
||||
index 3186867..63181e3 100644
|
||||
--- a/sshfs.c
|
||||
+++ b/sshfs.c
|
||||
@@ -271,7 +271,7 @@ struct sshfs {
|
||||
unsigned outstanding_len;
|
||||
unsigned max_outstanding_len;
|
||||
pthread_cond_t outstanding_cond;
|
||||
- int password_stdin;
|
||||
+ int password_stdin, password_stdout;
|
||||
char *password;
|
||||
int ext_posix_rename;
|
||||
int ext_statvfs;
|
||||
@@ -389,6 +389,7 @@ static struct fuse_opt sshfs_opts[] = {
|
||||
SSHFS_OPT("follow_symlinks", follow_symlinks, 1),
|
||||
SSHFS_OPT("no_check_root", no_check_root, 1),
|
||||
SSHFS_OPT("password_stdin", password_stdin, 1),
|
||||
+ SSHFS_OPT("password_stdout", password_stdout, 1),
|
||||
SSHFS_OPT("delay_connect", delay_connect, 1),
|
||||
SSHFS_OPT("slave", slave, 1),
|
||||
SSHFS_OPT("disable_hardlink", disable_hardlink, 1),
|
||||
@@ -1612,6 +1613,10 @@ static int sftp_init()
|
||||
|
||||
out:
|
||||
buf_free(&buf);
|
||||
+
|
||||
+ if (sshfs.password_stdout)
|
||||
+ puts(0 == res ? "OK" : "KO");
|
||||
+
|
||||
return res;
|
||||
}
|
||||
|
11
run-config
11
run-config
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")/sshfs
|
||||
|
||||
[ -f ./configure ] || {
|
||||
ln -s "$(regtool -W get /HKLM/Software/WinFsp/InstallDir)" winfsp
|
||||
patch -p1 < ../sshfs.patch
|
||||
autoreconf -i
|
||||
}
|
||||
|
||||
PKG_CONFIG_PATH=$(pwd)/winfsp/lib ./configure
|
49
run-sshfs.c
Normal file
49
run-sshfs.c
Normal file
@ -0,0 +1,49 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SSHFS_ARGS \
|
||||
"-f", \
|
||||
"-opassword_stdin", \
|
||||
"-opassword_stdout", \
|
||||
"-oUserKnownHostsFile=/dev/null", \
|
||||
"-oStrictHostKeyChecking=no"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
static const char *sshfs = "/bin/sshfs.exe";
|
||||
static const char *environ[] =
|
||||
{
|
||||
"PATH=/bin",
|
||||
};
|
||||
char idmap[64], volpfx[256], remote[256], *p, *q;
|
||||
|
||||
if (3 != argc)
|
||||
return 2;
|
||||
|
||||
snprintf(idmap, sizeof idmap, "-ouid=%d,gid=%d", -1, -1);
|
||||
|
||||
snprintf(volpfx, sizeof volpfx, "--VolumePrefix=%s", argv[1]);
|
||||
|
||||
p = argv[1];
|
||||
while ('\\' == *p)
|
||||
p++;
|
||||
while (*p && '\\' != *p)
|
||||
p++;
|
||||
while ('\\' == *p)
|
||||
p++;
|
||||
q = p;
|
||||
while (*q && '\\' != *q)
|
||||
q++;
|
||||
snprintf(remote, sizeof remote, "%.*s:%s", q - p, p, *q ? q + 1 : q);
|
||||
p = remote;
|
||||
while (*p)
|
||||
{
|
||||
if ('\\' == *p)
|
||||
*p = '/';
|
||||
p++;
|
||||
}
|
||||
|
||||
execle(sshfs, sshfs, SSHFS_ARGS, idmap, volpfx, remote, argv[2], (void *)0, environ);
|
||||
|
||||
return 1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user