1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-27 00:07:08 +00:00
termux-packages/packages/termux-tools/login
2020-03-30 15:15:59 +03:00

31 lines
726 B
Bash
Executable File

#!/bin/sh
if [ $# = 0 ] && [ -f @TERMUX_PREFIX@/etc/motd ] && [ ! -f ~/.hushlogin ] && [ -z "$TERMUX_HUSHLOGIN" ]; then
cat @TERMUX_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 @TERMUX_PREFIX@/bin/bash @TERMUX_PREFIX@/bin/sh /system/bin/sh; do
if [ -x $file ]; then
export SHELL=$file
break
fi
done
fi
if [ -f @TERMUX_PREFIX@/lib/libtermux-exec.so ]; then
export LD_PRELOAD=@TERMUX_PREFIX@/lib/libtermux-exec.so
$SHELL -c "coreutils --coreutils-prog=true" > /dev/null 2>&1 || unset LD_PRELOAD
fi
if [ -n "$TERM" ]; then
exec "$SHELL" -l "$@"
else
exec "$SHELL" "$@"
fi