SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "mosh"

# SliTaz package receipt.

PACKAGE="mosh"
VERSION="1.3.2"
CATEGORY="security"
TAGS="ssh"
SHORT_DESC="An Openbsd Secure Shell replacement."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL3"
WEB_SITE="https://mosh.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="${WEB_SITE}$TARBALL"

DEPENDS="gcc-lib-base libcrypto libssl ncursesw perl protobuf ssh zlib \
gcc83-lib-base"
BUILD_DEPENDS="libcrypto-dev ncursesw-dev openssl-dev pkg-config protobuf-dev \
zlib-dev automake gcc83"

# What is the latest version available today?
current_version()
{
    wget -O - ${WGET_URL%/*} 2>/dev/null | \
    sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
    # Add dropbear support
    patch -p0 <<EOT || return 1
--- scripts/mosh.pl
+++ scripts/mosh.pl
@@ -397,2 +397,10 @@
     my \$quoted_proxy_command = shell_quote( \$0, "--family=\$family" );
+    my \$ssh = join ' ', @ssh;
+    if (\`\$ssh -V 2>&1\` =~ m{Dropbear}) {
+      my \$host = \$userhost; \$host = \$1 if (\$userhost =~ m{@(.*)});
+      my \$port = 22; \$port = \$1 if (\$ssh =~ m{-p *(\d+)});
+      exec "\$ssh " . shell_quote( '-J', 
+    "\$quoted_proxy_command --fake-proxy -- \$host \$port",
+    '-t', \$userhost, "\$server " . shell_quote( @server ) );
+    }
     push @sshopts, ( '-S', 'none', '-o', "ProxyCommand=\$quoted_proxy_command --fake-proxy -- %h %p" );
EOT
    ./autogen.sh
    ./configure            \
        CC=gcc-83        \
        CXX=g++-83        \
        --prefix=/usr        \
        --sysconfdir=/etc    \
        --enable-compile-warnings=error &&
    make -j 1 &&
    make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr
    cp -a $install/usr/bin $fs/usr
}

post_install()
{
    [ -d "$1/usr/lib/locale/$LC_ALL" ] ||
    chroot "$1/" localedef -i ${LC_ALL%.*} -c -f UTF-8 /usr/lib/locale/$LC_ALL
    if ! grep ^DROPBEAR_OPTIONS "$1/etc/daemons.conf" | grep -q -- -a; then
        cat <<EOT
The mosh server needs dropbear to allow connections to forwarded ports
from any host. Nothing to do if you are using OpenSSH or you plan
to use the mosh client only.
EOT
        echo -n "Add -a for DROPBEAR_OPTIONS in /etc/daemons.conf now ?"
        read -t 30 answer
        [ "$answer" = "y" ] && 
        sed -i 's/^DROPBEAR_OPTIONS="/&-a /' "$1/etc/daemons.conf" &&
        [ -z "$1" ] && /etc/init.d/dropbear restart
    fi
    [ ! -e $1/usr/share/terminfo/x/xterm-256color ] &&
        [ -e $1/usr/share/terminfo/x/xterm-color ] &&
        ln -s xterm-color $1/usr/share/terminfo/x/xterm-256color
    true
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)