bash: do not hardcode prefix/home paths

Use @TERMUX_PREFIX@ or @TERMUX_HOME@ where needed.
This commit is contained in:
Leonid Pliushch 2019-07-22 02:23:55 +03:00
parent 1e5d50a950
commit a997e982a2
2 changed files with 11 additions and 12 deletions

View File

@ -54,13 +54,12 @@ termux_step_pre_configure() {
}
termux_step_post_make_install() {
sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" $TERMUX_PKG_BUILDER_DIR/etc-profile > $TERMUX_PREFIX/etc/profile
sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
$TERMUX_PKG_BUILDER_DIR/etc-profile | \
sed "s|@TERMUX_HOME@|$TERMUX_ANDROID_HOME|" > \
$TERMUX_PREFIX/etc/profile
sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
-e "s|@TERMUX_HOME@|$TERMUX_ANDROID_HOME|" \
$TERMUX_PKG_BUILDER_DIR/etc-profile > $TERMUX_PREFIX/etc/profile
# /etc/bash.bashrc - System-wide .bashrc file for interactive shells. (config-top.h in bash source, patched to enable):
sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
$TERMUX_PKG_BUILDER_DIR/etc-bash.bashrc > \
$TERMUX_PREFIX/etc/bash.bashrc
sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
-e "s|@TERMUX_HOME@|$TERMUX_ANDROID_HOME|" \
$TERMUX_PKG_BUILDER_DIR/etc-bash.bashrc > $TERMUX_PREFIX/etc/bash.bashrc
}

View File

@ -8,11 +8,11 @@ unset i
# Source etc/bash.bashrc and ~/.bashrc also for interactive bash login shells:
if [ "$BASH" ]; then
if [[ "$-" == *"i"* ]]; then
if [ -r /data/data/com.termux/files/usr/etc/bash.bashrc ]; then
. /data/data/com.termux/files/usr/etc/bash.bashrc
if [ -r @TERMUX_PREFIX@/etc/bash.bashrc ]; then
. @TERMUX_PREFIX@/etc/bash.bashrc
fi
if [ -r /data/data/com.termux/files/home/.bashrc ]; then
. /data/data/com.termux/files/home/.bashrc
if [ -r @TERMUX_HOME@/.bashrc ]; then
. @TERMUX_HOME@/.bashrc
fi
fi
fi