在预安装阶段就报错了,没有显示具体的原因
xiaoyugo61 opened this issue · comments
笑羽 commented
笑羽 commented
客户使用以下脚本做source测试只能打印一个0
echo -e "
source /etc/profile
echo $?
set -e
source /etc/profile
echo $?" > test.sh
bash test.sh
wzxiaojf commented
通过#2中的方法定位到问题出在source /etc/profile的时候中间有执行结果是非0的状态码。通过在/etc/profile行头添加set -ex去执行source /etc/profile可以看到代码执行到[[ -f /etc/slackware-version ]]后中断了,所以问题出在这边。通过touch /etc/slackware-version后重新安装即可解决安装失败问题
W0rkHarder commented
遇到此情况可以检查/etc/profile
是否配置了$PS1变量。
当配置了PS1,执行到 /tmp/honeyguide_whole_package/shakespeare_1.0.0/install_script/load_shell.sh
(设置了set -e) 第49行source /etc/profile
时,脚本会异常退出。具体原因为
source /etc/profile
中调用/etc/profile.d/bash_completion.sh
时,会进入. /usr/share/bash-completion/bash_completion
[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION_COMPAT_DIR" ] && return
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
# Source completion code.
. /usr/share/bash-completion/bash_completion
fi
fi
unset bash bmajor bminor
/usr/share/bash-completion/bash_completion
中 存在[ -f /etc/slackware-version ]
返回非0,被 load_shell.sh 捕捉退出,导致安装进程中断。
_sysvdirs()
{
sysvdirs=( )
[[ -d /etc/rc.d/init.d ]] && sysvdirs+=( /etc/rc.d/init.d )
[[ -d /etc/init.d ]] && sysvdirs+=( /etc/init.d )
# Slackware uses /etc/rc.d
[[ -f /etc/slackware-version ]] && sysvdirs=( /etc/rc.d )
}
+++ shopt -q progcomp
+++ '[' -r /usr/share/bash-completion/bash_completion ']'
+++ . /usr/share/bash-completion/bash_completion
++++ [[ ehxB == *v* ]]
++++ BASH_COMPLETION_ORIGINAL_V_VALUE=+v
++++ [[ -n '' ]]
++++ set +v
++++ : /etc/bash_completion.d
++++ readonly BASH_COMPLETION_COMPAT_DIR
++++ _blacklist_glob='@()'
++++ shopt -s extglob progcomp
++++ complete -d pushd
++++ complete -u groups slay w sux
++++ complete -A stopped -P '"%' -S '"' bg
++++ complete -j -P '"%' -S '"' fg jobs disown
++++ complete -v readonly unset
++++ complete -A setopt set
++++ complete -A shopt shopt
++++ complete -A helptopic help
++++ complete -a unalias
++++ complete -A binding bind
++++ complete -c command type which
++++ complete -b builtin
++++ [[ linux-gnu == *@(solaris|aix)* ]]
++++ [[ linux-gnu == *@(solaris|aix)* ]]
++++ [[ linux-gnu == *@(solaris|aix)* ]]
++++ _backup_glob='@(#*#|*@(~|.@(bak|orig|rej|swp|dpkg*|rpm@(orig|new|save))))'
++++ complete -F _service service
++++ _sysvdirs
++++ sysvdirs=()
++++ [[ -d /etc/rc.d/init.d ]]
++++ sysvdirs+=(/etc/rc.d/init.d)
++++ [[ -d /etc/init.d ]]
++++ sysvdirs+=(/etc/init.d)
++++ [[ -f /etc/slackware-version ]]
root@localhost:~>
- 可通过
touch /etc/slackware-version
创建文件,或者取消配置$PS1变量解决。