wok rev 18178

mosh: add dropbear support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 04 11:23:16 2015 +0200 (2015-07-04)
parents c5bef900f5df
children 3954e94bec9b
files mosh/receipt
line diff
     1.1 --- a/mosh/receipt	Fri Jul 03 04:23:02 2015 +0300
     1.2 +++ b/mosh/receipt	Sat Jul 04 11:23:16 2015 +0200
     1.3 @@ -10,16 +10,20 @@
     1.4  WEB_SITE="http://mosh.mit.edu/"
     1.5  WGET_URL="${WEB_SITE}$TARBALL"
     1.6  TAGS="ssh"
     1.7 -NOTE1="On remote server: need -a in /etc/daemons.conf DROPBEAR_OPTIONS"
     1.8 -NOTE2="Mosh client *needs* openssh. Not compatible with dropbear yet"
     1.9  
    1.10  DEPENDS="gcc-lib-base perl protobuf libssl libcrypto zlib ncursesw ssh"
    1.11  BUILD_DEPENDS="pkg-config protobuf-dev openssl-dev libcrypto-dev zlib-dev ncursesw-dev"
    1.12 -SUGGESTED="openssh"
    1.13  
    1.14  # Rules to configure and make the package.
    1.15  compile_rules()
    1.16  {
    1.17 +	sed -i '/.*quoted_self = shell_quote.*/r/dev/stdin' scripts/mosh <<EOT
    1.18 +  if (\`\$ssh -V 2>&1\` =~ m{Dropbear}) {
    1.19 +    my \$host = \$userhost; \$host = \$1 if (\$userhost =~ m{@(.*)});
    1.20 +    my \$port = 22; \$port = \$1 if (\$ssh =~ m{-p *(\d+)});
    1.21 +    exec "\$ssh " . shell_quote( '-J', "\$quoted_self --fake-proxy -- \$host \$port", '-t', \$userhost, "\$server " . shell_quote( @server ) );
    1.22 +  }
    1.23 +EOT
    1.24  	./configure --prefix=/usr --sysconfdir=/etc \
    1.25  		--enable-compile-warnings=error &&
    1.26  	make &&
    1.27 @@ -32,3 +36,20 @@
    1.28  	mkdir -p $fs/usr
    1.29  	cp -a $install/usr/bin $fs/usr
    1.30  }
    1.31 +
    1.32 +post_install()
    1.33 +{
    1.34 +	if ! grep ^DROPBEAR_OPTIONS $1/etc/daemons.conf | grep -q -- -a; then
    1.35 +		cat <<EOT
    1.36 +The mosh server needs dropbear to allow connections to forwarded ports
    1.37 +from any host. Nothing to do if you are using OpenSSH or you plan
    1.38 +to use the mosh client only.
    1.39 +EOT
    1.40 +		echo -n "Add -a for DROPBEAR_OPTIONS in /etc/daemons.conf now ?"
    1.41 +		read -t 30 answer
    1.42 +		[ "$answer" == "y" ] && 
    1.43 +		sed -i 's/^DROPBEAR_OPTIONS="/&-a /' $1/etc/daemons.conf &&
    1.44 +		[ -z "$1" ] && /etc/init.d/dropbear restart
    1.45 +
    1.46 +	fi
    1.47 +}