Clean up a lot how the ssh search is generated and maintained.
This commit is contained in:
19
ssh/gen-search.sh
Executable file
19
ssh/gen-search.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
rm -f ~/.ssh/search
|
||||
|
||||
if [ -e ${CSHENV_DIR}/ssh/ssh-search-domains ]
|
||||
then
|
||||
domains=`grep "^search" /etc/resolv.conf | cut -c 6- - | cat - ${CSHENV_DIR}/ssh/ssh-search-domains | xargs`
|
||||
else
|
||||
domains=`grep "^search" /etc/resolv.conf | cut -c 6- - | xargs`
|
||||
fi
|
||||
|
||||
if [ -z "${domains}" ] ; then exit 1; fi
|
||||
echo ${domains}
|
||||
|
||||
printf "Host *\n\tCanonicalDomains ${domains}\n\tCanonicalizeHostname yes\n# v" > ~/.ssh/search
|
||||
printf "im:ft=sshconfig" >> ~/.ssh/search
|
||||
|
||||
exit 0
|
||||
|
||||
# vim: ft=bash
|
||||
Reference in New Issue
Block a user