termux-packages/packages/termux-tools/login

43 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2017-02-12 21:01:01 +01:00
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
2017-02-12 21:01:01 +01:00
fi
# TERMUX_VERSION env variable has been exported since v0.107 and PATH was being set to following value in <0.104. Last playstore version was v0.101.
if [ $# = 0 ] && [ -f @TERMUX_PREFIX@/etc/motd-playstore ] && [ -z "$TERMUX_VERSION" ] && [ "$PATH" = "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets" ]; then
printf '\033[0;31m'; cat @TERMUX_PREFIX@/etc/motd-playstore; printf '\033[0m'
fi
2017-02-12 21:01:01 +01:00
if [ -G ~/.termux/shell ]; then
export SHELL="`realpath ~/.termux/shell`"
2017-02-12 21:01:01 +01:00
else
for file in @TERMUX_PREFIX@/bin/bash @TERMUX_PREFIX@/bin/sh /system/bin/sh; do
2017-02-12 21:01:01 +01:00
if [ -x $file ]; then
export SHELL=$file
2017-02-12 21:01:01 +01:00
break
fi
done
fi
# for the correct operation of scripts that work with the package manager
export TERMUX_MAIN_PACKAGE_FORMAT="@TERMUX_PACKAGE_FORMAT@"
if [ -f @TERMUX_PREFIX@/lib/libtermux-exec.so ]; then
export LD_PRELOAD=@TERMUX_PREFIX@/lib/libtermux-exec.so
2020-03-30 14:15:59 +02:00
$SHELL -c "coreutils --coreutils-prog=true" > /dev/null 2>&1 || unset LD_PRELOAD
2017-09-17 16:12:20 +02:00
fi
if [ -f @TERMUX_PREFIX@/etc/termux-login.sh ]; then
. @TERMUX_PREFIX@/etc/termux-login.sh
fi
if [ -n "$TERM" ]; then
exec "$SHELL" -l "$@"
else
exec "$SHELL" "$@"
fi