From: Mark Wooding Date: Sun, 29 Mar 2015 16:34:28 +0000 (+0100) Subject: setup, bin/: Some scripts which are useful in Cygwin. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/6a5170a8b5b36406e249eee93868f1b0e2acfd8b setup, bin/: Some scripts which are useful in Cygwin. * bin/run-with-shell-env runs a program having established the proper shell environment. This is handy for invoking things from Windows shortcuts, for example. * bin/start-ssh-pageant starts the Cygwin proxy for PuTTY's Pageant SSH agent. It's not properly engineered yet, but it seems to work well enough for running at login time. --- diff --git a/bin/run-with-shell-env b/bin/run-with-shell-env new file mode 100644 index 0000000..ba0afcf --- /dev/null +++ b/bin/run-with-shell-env @@ -0,0 +1,13 @@ +#! /bin/bash -x +exec >/tmp/mdw/hacky.log 2>&1 +case ${__mdw_profile+t} in + t) ;; + *) + __mdw_force_secure_session=yes + export SHELL=/bin/bash USER=$(/bin/id -un) + set +x + . $HOME/.bash_profile + set -x + ;; +esac +exec "$@" diff --git a/bin/start-ssh-pageant b/bin/start-ssh-pageant new file mode 100644 index 0000000..cb704dd --- /dev/null +++ b/bin/start-ssh-pageant @@ -0,0 +1,13 @@ +#! /bin/sh -ex +PATH=/bin:$HOME/bin:$PATH +eval $(tmpdir -b) +sockdir=${TMPDIR?}/.ssh-agent.$(hostname).${USER-$(id -un)} +if [ -S $sockdir/sock ]; then + set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e + case $rc in 0) exit 0 ;; esac + kill $(cat $sockdir/pid) || : + rm -f $sockdir/pid $sockdir/sock +fi +mkdir -p -m700 $sockdir +(cd /; exec run ssh-pageant -d -a$sockdir/sock >/dev/null 2>&1)& +echo $! >$sockdir/pid diff --git a/setup b/setup index 7b54cd9..6347acd 100755 --- a/setup +++ b/setup @@ -245,7 +245,9 @@ scripts=" aspell-hack emerge-hack lesspipe.sh + run-with-shell-env start-ssh-agent + start-ssh-pageant svnwrap guest-console hyperspec"