command-not-found: Bump with new commands
[termux-packages] / packages / openssh / build.sh
CommitLineData
59f0d218
FF
1TERMUX_PKG_HOMEPAGE=http://www.openssh.com/
2TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
a8b61adf
FF
3TERMUX_PKG_VERSION=7.4p1
4TERMUX_PKG_SRCURL=http://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
5TERMUX_PKG_SHA256=1b1fc4a14e2024293181924ed24872e6f2e06293f3e8926a376b8aec481f19d1
6TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libutil"
59f0d218
FF
7# --disable-strip to prevent host "install" command to use "-s", which won't work for target binaries:
8TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-cflags=-Dfd_mask=int --with-ldns --disable-etc-default-login --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-libutil --disable-pututline --disable-pututxline --without-stackprotect --with-pid-dir=$TERMUX_PREFIX/var/run --disable-strip --sysconfdir=$TERMUX_PREFIX/etc/ssh --without-ssh1"
9TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_header_sys_un_h=yes ac_cv_func_strnvis=no ac_cv_func_readpassphrase=no ac_cv_search_getrrsetbyname=no ac_cv_func_getlastlogxbyname=no ac_cv_func_fmt_scaled=no ac_cv_func_endgrent=yes"
a8b61adf 10TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-privsep-path=$TERMUX_PREFIX/var/empty"
59f0d218
FF
11TERMUX_PKG_MAKE_INSTALL_TARGET="install-nokeys"
12TERMUX_PKG_RM_AFTER_INSTALL="bin/slogin share/man/man1/slogin.1"
13
7ce56385
FF
14termux_step_pre_configure() {
15 LD=$CC # Needed to link the binaries
16 LDFLAGS+=" -llog" # liblog for android logging in syslog hack
17}
59f0d218
FF
18
19termux_step_pre_make () {
20 # We need to remove this file before installing, since otherwise the
21 # install leaves it alone which means no updated timestamps.
22 rm -Rf $TERMUX_PREFIX/etc/moduli
23}
24
25termux_step_post_make_install () {
62c37b97 26 # OpenSSH 7.0 disabled ssh-dss by default, keep it for a while in Termux:
d8052afc 27 echo -e "PasswordAuthentication no\nUsePrivilegeSeparation no\nPubkeyAcceptedKeyTypes +ssh-dss\nSubsystem sftp $TERMUX_PREFIX/libexec/sftp-server" > $TERMUX_PREFIX/etc/ssh/sshd_config
62c37b97 28 echo "PubkeyAcceptedKeyTypes +ssh-dss" > $TERMUX_PREFIX/etc/ssh/ssh_config
59f0d218
FF
29 cp $TERMUX_PKG_BUILDER_DIR/source-ssh-agent.sh $TERMUX_PREFIX/bin/source-ssh-agent
30 cp $TERMUX_PKG_BUILDER_DIR/ssh-with-agent.sh $TERMUX_PREFIX/bin/ssha
31
b0c457ae
FF
32 # Install ssh-copy-id:
33 cp $TERMUX_PKG_SRCDIR/contrib/ssh-copy-id.1 $TERMUX_PREFIX/share/man/man1/
34 cp $TERMUX_PKG_SRCDIR/contrib/ssh-copy-id $TERMUX_PREFIX/bin/
35 chmod +x $TERMUX_PREFIX/bin/ssh-copy-id
36
59f0d218
FF
37 mkdir -p $TERMUX_PREFIX/var/run
38 echo "OpenSSH needs this folder to put sshd.pid in" >> $TERMUX_PREFIX/var/run/README.openssh
39
40 mkdir -p $TERMUX_PREFIX/etc/ssh/
41 cp $TERMUX_PKG_SRCDIR/moduli $TERMUX_PREFIX/etc/ssh/moduli
42}
43
44termux_step_create_debscripts () {
45 echo "mkdir -p \$HOME/.ssh" > postinst
46 echo "" >> postinst
47 echo "for a in rsa dsa ecdsa ed25519; do" >> postinst
48 echo " KEYFILE=$TERMUX_PREFIX/etc/ssh/ssh_host_\${a}_key" >> postinst
49 echo " test ! -f \$KEYFILE && ssh-keygen -N '' -t \$a -f \$KEYFILE" >> postinst
50 echo "done" >> postinst
51 echo "exit 0" >> postinst
52 chmod 0755 postinst
53}