Don't export PS1 in /system/etc/mkshrc.

At present, when running a busybox shell ("busybox sh") from mksh
(/system/bin/sh), one gets the following message before every command line:

sh: precmd: Permission denied

This is due to mkshrc exporting a PS1 which depends on a mkshrc defined
function, "precmd".  Since "busybox sh" does not source mkshrc, it does not
have this function defined, resulting in the above error.

By not exporting PS1, "busybox sh" uses its own reasonable default.  mksh
subshells continue to work as usual, since they (re)source /etc/mkshrc
anyways.

Change-Id: Ic9182e42aa033e811300d9e6e8d6d3f43e14e58f
This commit is contained in:
Mike Kasick 2012-01-26 17:54:31 -05:00
parent a0fae84b85
commit 511d60900a
2 changed files with 33 additions and 0 deletions

View File

@ -54,6 +54,10 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml
# Don't export PS1 in /system/etc/mkshrc.
PRODUCT_COPY_FILES += \
vendor/cm/prebuilt/common/etc/mkshrc:system/etc/mkshrc
# Required CM packages # Required CM packages
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
Camera \ Camera \

View File

@ -0,0 +1,29 @@
# Copyright (c) 2010
# Thorsten Glaser <t.glaser@tarent.de>
# This file is provided under the same terms as mksh.
#-
# Minimal /system/etc/mkshrc for Android
: ${TERM:=vt100} ${HOME:=/data} ${MKSH:=/system/bin/sh} ${HOSTNAME:=android}
: ${SHELL:=$MKSH} ${USER:=$(typeset x=$(id); x=${x#*\(}; print -r -- ${x%%\)*})}
if (( USER_ID )); then PS1='$'; else PS1='#'; fi
function precmd {
typeset e=$?
(( e )) && print -n "$e|"
}
PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
export HOME HOSTNAME MKSH SHELL TERM USER
alias l='ls'
alias la='l -a'
alias ll='l -l'
alias lo='l -a -l'
for p in ~/.bin; do
[[ -d $p/. ]] || continue
[[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
done
unset p
: place customisations above this line