termux-packages/packages/termux-tools/login
Leonid Pliushch 4d3a6658d4 termux-tools: do not print motd on OpenSSH login when config PrintMotd=no
Now OpenSSH will not print motd on its own which may result in duplicate.
Instead it will control the login script via environment variable.

Fixes https://github.com/termux/termux-packages/issues/3941.
2019-09-06 01:59:07 +03:00

31 lines
690 B
Bash
Executable File

#!/data/data/com.termux/files/usr/bin/sh
if [ $# = 0 ] && [ -f $PREFIX/etc/motd ] && [ ! -f ~/.hushlogin ] && [ -z "$TERMUX_HUSHLOGIN" ]; then
cat $PREFIX/etc/motd
else
# This variable shouldn't be kept set.
unset TERMUX_HUSHLOGIN
fi
if [ -G ~/.termux/shell ]; then
export SHELL="`realpath ~/.termux/shell`"
else
for file in $PREFIX/bin/bash $PREFIX/bin/sh /system/bin/sh; do
if [ -x $file ]; then
export SHELL=$file
break
fi
done
fi
if [ -f $PREFIX/lib/libtermux-exec.so ]; then
export LD_PRELOAD=$PREFIX/lib/libtermux-exec.so
$SHELL -c "busybox true" > /dev/null 2>&1 || unset LD_PRELOAD
fi
if [ -n "$TERM" ]; then
exec "$SHELL" -l "$@"
else
exec "$SHELL" "$@"
fi