[问题]Ubuntu 6.06 每次启动都在会话->启动程序中增加一条 vmware-user

Kvm、VMware、Virtualbox、Xen、Qemu 等
回复
LaoBai_2006
帖子: 4
注册时间: 2006-06-24 15:05

[问题]Ubuntu 6.06 每次启动都在会话->启动程序中增加一条 vmware-user

#1

帖子 LaoBai_2006 » 2006-06-24 16:01

我在 VMWare Workstation 5.5 里面安装了 Ubuntu 6.06,又通过重新编译安装了 VMWare Tools(是那个 Perl 脚本做的)。
但是每次启动后去看“系统”->“首选项”->“会话”->“启动程序”都会发现增加了一条“/usr/bin/vmware-user”。我怀疑是这个脚本没有检测到自己已经存在于启动程序中,以致于每次启动时都增加一条。
不知熟悉 Shellscript 和 GNOME 的大虾们能否提供些线索。

下面就是 /usr/bin/vmware-user 的内容:

#!/bin/sh
#
# Copyright 2005 VMware, Inc. All rights reserved.
#
# Wrapper for the real 'vmware' binary. Ensure that the binary will find all
# the shared libraries it needs. If a shared library is not available from any
# of the standard system-wide locations, we provide it from the VMware package
# location. --hpreg

# BEGINNING_OF_DB_DOT_SH
#!/bin/sh

#
# Manage an installer database
#

# Add an answer to a database in memory
db_answer_add() {
local dbvar="$1" # IN/OUT
local id="$2" # IN
local value="$3" # IN
local answers
local i

eval "$dbvar"'_answer_'"$id"'="$value"'

eval 'answers="$'"$dbvar"'_answers"'
# There is no double quote around $answers on purpose
for i in $answers; do
if [ "$i" = "$id" ]; then
return
fi
done
answers="$answers"' '"$id"
eval "$dbvar"'_answers="$answers"'
}

# Remove an answer from a database in memory
db_answer_remove() {
local dbvar="$1" # IN/OUT
local id="$2" # IN
local new_answers
local answers
local i

eval 'unset '"$dbvar"'_answer_'"$id"

new_answers=''
eval 'answers="$'"$dbvar"'_answers"'
# There is no double quote around $answers on purpose
for i in $answers; do
if [ "$i" != "$id" ]; then
new_answers="$new_answers"' '"$i"
fi
done
eval "$dbvar"'_answers="$new_answers"'
}

# Load all answers from a database on stdin to memory (<dbvar>_answer_*
# variables)
db_load_from_stdin() {
local dbvar="$1" # OUT

eval "$dbvar"'_answers=""'

# read doesn't support -r on FreeBSD 3.x. For this reason, the following line
# is patched to remove the -r in case of FreeBSD tools build. So don't make
# changes to it. -- Jeremy Bar
while read -r action p1 p2; do
if [ "$action" = 'answer' ]; then
db_answer_add "$dbvar" "$p1" "$p2"
elif [ "$action" = 'remove_answer' ]; then
db_answer_remove "$dbvar" "$p1"
fi
done
}

# Load all answers from a database on disk to memory (<dbvar>_answer_*
# variables)
db_load() {
local dbvar="$1" # OUT
local dbfile="$2" # IN

db_load_from_stdin "$dbvar" < "$dbfile"
}

# Iterate through all answers in a database in memory, calling <func> with
# id/value pairs and the remaining arguments to this function
db_iterate() {
local dbvar="$1" # IN
local func="$2" # IN
shift 2
local answers
local i
local value

eval 'answers="$'"$dbvar"'_answers"'
# There is no double quote around $answers on purpose
for i in $answers; do
eval 'value="$'"$dbvar"'_answer_'"$i"'"'
"$func" "$i" "$value" "$@"
done
}

# If it exists in memory, remove an answer from a database (disk and memory)
db_remove_answer() {
local dbvar="$1" # IN/OUT
local dbfile="$2" # IN
local id="$3" # IN
local answers
local i

eval 'answers="$'"$dbvar"'_answers"'
# There is no double quote around $answers on purpose
for i in $answers; do
if [ "$i" = "$id" ]; then
echo 'remove_answer '"$id" >> "$dbfile"
db_answer_remove "$dbvar" "$id"
return
fi
done
}

# Add an answer to a database (disk and memory)
db_add_answer() {
local dbvar="$1" # IN/OUT
local dbfile="$2" # IN
local id="$3" # IN
local value="$4" # IN

db_remove_answer "$dbvar" "$dbfile" "$id"
echo 'answer '"$id"' '"$value" >> "$dbfile"
db_answer_add "$dbvar" "$id" "$value"
}

# Add a file to a database on disk
# 'file' is the file to put in the database (it may not exist on the disk)
# 'tsfile' is the file to get the timestamp from, '' if no timestamp
db_add_file() {
local dbfile="$1" # IN
local file="$2" # IN
local tsfile="$3" # IN
local date

if [ "$tsfile" = '' ]; then
echo 'file '"$file" >> "$dbfile"
else
date=`date -r "$tsfile" '+%s' 2> /dev/null`
if [ "$date" != '' ]; then
date=' '"$date"
fi
echo 'file '"$file$date" >> "$dbfile"
fi
}

# Add a directory to a database on disk
db_add_dir() {
local dbfile="$1" # IN
local dir="$2" # IN

echo 'directory '"$dir" >> "$dbfile"
}
# END_OF_DB_DOT_SH

db_load 'vm_db' '/etc/vmware-tools/locations'

vm_append_libs() {
local path
local lib
local dummy
local status

path=''
while read -r lib dummy status; do
# Use grep here since FreeBSD ldd output contains a trailing "(0x0)"
if echo "$status" | grep 'not found' > /dev/null; then
if [ "$path" = '' ]; then
path="$vm_db_answer_LIBDIR"'/lib32/'"$lib"
else
path="$path"':'"$vm_db_answer_LIBDIR"'/lib32/'"$lib"
fi
fi
done

echo "$path"
}

# Run gnome_session_manual.pl (which sets up vmware-user to auto-start for "this" user)
# only if we're in a Gnome session and we can find the binaries.
gnome_session_pl="$vm_db_answer_LIBDIR"'/gnome_session_manual.pl'
vmware_user="$vm_db_answer_BINDIR"'/vmware-user'
if [ 'x'"$GNOME_DESKTOP_SESSION_ID" != 'x' ] &&
[ -x $vmware_user ] &&
[ -x $gnome_session_pl ]; then
"$gnome_session_pl" "$vmware_user"
fi

binary="$vm_db_answer_LIBDIR"'/bin32/vmware-user'
export LD_LIBRARY_PATH=`LANGUAGE=C LANG=C ldd "$binary" | vm_append_libs`
exec "$binary" "$@"
回复