summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIkiWiki <ikiwiki.info>2019-09-02 13:51:05 -0400
committerIkiWiki <ikiwiki.info>2019-09-02 13:51:05 -0400
commit258fc3d7f7ba7983dcd3dac1429936227233eaf2 (patch)
treecf45cc431b692e07811a8e3d8f62abd5937755ec
parent1e6e19dad98f517152aeba4e4f60a87a7731d648 (diff)
downloadstandingwithresilience-258fc3d7f7ba7983dcd3dac1429936227233eaf2.tar.gz
standingwithresilience-258fc3d7f7ba7983dcd3dac1429936227233eaf2.zip
fix ssh behavior on old ssh versions
-rwxr-xr-xbackend/dep/build_ikiwiki.sh2
-rw-r--r--backend/resilient/__init__.py14
-rwxr-xr-xbackend/wrapped_ssh.sh6
3 files changed, 12 insertions, 10 deletions
diff --git a/backend/dep/build_ikiwiki.sh b/backend/dep/build_ikiwiki.sh
index 38d6692..3635e40 100755
--- a/backend/dep/build_ikiwiki.sh
+++ b/backend/dep/build_ikiwiki.sh
@@ -1,6 +1,6 @@
#!/bin/env bash
-SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+SCRIPTDIR="$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTDIR"/ikiwiki &&
{ PERL5LIB=`pwd` PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::Shell->notest("install", "Bundle::IkiWiki")'; } &&
diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py
index d44e914..e2b40c7 100644
--- a/backend/resilient/__init__.py
+++ b/backend/resilient/__init__.py
@@ -25,7 +25,7 @@ html_path = os.path.normpath(os.path.join(root_path, 'html'))
wiki_src_path = os.path.normpath(os.path.join(root_path, 'wiki'))
git_path = os.path.normpath(os.path.join(root_path, '.git'))
-ssh_config_path = os.path.join(auth_path, "ssh-config")
+ssh_wrap_path = os.path.join(backend_path, "wrapped_ssh.sh")
for auth_subpath, auth_subpaths, auth_subfiles in os.walk(auth_path):
for auth_subfile in auth_subfiles:
@@ -83,21 +83,17 @@ class git:
def pull(self):
if self.remote == None:
return False
- # TODO: GIT_SSH_COMMAND needs new version of git
- # to make it work on old versions, path ssh_config_path on environment
- # and use a wrapper script that calls ssh -F
- # then place path to wrapper script in os.environ["GIT_SSH"]
- os.environ["GIT_SSH_COMMAND"] = "ssh -F %s" % ssh_config_path
+ os.environ["GIT_SSH"] = ssh_wrap_path
status = os.system("git pull %s master" % self.remote)
- del os.environ["GIT_SSH_COMMAND"]
+ del os.environ["GIT_SSH"]
return status == 0
def push(self):
if self.push_remote == None:
return False
- os.environ["GIT_SSH_COMMAND"] = "ssh -F %s" % ssh_config_path
+ os.environ["GIT_SSH"] = ssh_wrap_path
status = os.system("git push %s master" % self.push_remote)
- del os.environ["GIT_SSH_COMMAND"]
+ del os.environ["GIT_SSH"]
return status == 0
diff --git a/backend/wrapped_ssh.sh b/backend/wrapped_ssh.sh
new file mode 100755
index 0000000..8281e9d
--- /dev/null
+++ b/backend/wrapped_ssh.sh
@@ -0,0 +1,6 @@
+#!/bin/env sh
+
+SCRIPTDIR="$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd )"
+
+ssh -F "$SCRIPTDIR"/auth/ssh-config "$@"
+