Commit 5db52049 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Make sed regexes in .ssh/ssh work on MacOS

parent dd84f097
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ die() {

ssh_version() {
	eval `${SSH_BIN} -V 2>&1 | sed -n \
		's/OpenSSH_\([0-9]\+\)\.\([0-9]\+\).*/SSH_MAJOR="\1" SSH_MINOR="\2"/p'`
		's/OpenSSH_\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/SSH_MAJOR="\1" SSH_MINOR="\2"/p'`
}

platform() {
@@ -37,9 +37,12 @@ platform() {
}

config_sed() {
	case $PLATFORM in
		darwin|bsd) SED_WORD_START='[[:<:]]' SED_WORD_END='[[:>:]]'; return ;;
	esac
	case "$SHELL" in
		bash) SED_WORD_DELIM='\b' ;;
		zsh|sh) SED_WORD_DELIM='\\b' ;;
		bash) SED_WORD_START='\b' SED_WORD_END='\b' ;;
		zsh|sh) SED_WORD_START='\\b' SED_WORD_END='\b' ;;
	esac
}

@@ -78,7 +81,7 @@ rule_canonisation() {
rule_runtime() {
	# Replace RUNTIME with the value of the RUNTIME variable
	[ -n "$RUNTIME" ] || die "RUNTIME not set"
	echo "s!${SED_WORD_DELIM}RUNTIME${SED_WORD_DELIM}!${RUNTIME-.}!g;"
	echo "s!${SED_WORD_START}RUNTIME${SED_WORD_END}!${RUNTIME-.}!g;"
}

make_config() {