1 --- vmware-distrib/bin/vmware 2005-03-23 05:54:18.000000000 -0600
2 +++ vmware-distrib.new/bin/vmware 2005-04-13 09:35:12.000000000 -0500
4 # the VMware software is installed. --hpreg
7 -# BEGINNING_OF_DB_DOT_SH
11 -# Manage an installer database
14 -# Add an answer to a database in memory
16 - local dbvar="$1" # IN/OUT
18 - local value="$3" # IN
22 - eval "$dbvar"'_answer_'"$id"'="$value"'
24 - eval 'answers="$'"$dbvar"'_answers"'
25 - # There is no double quote around $answers on purpose
26 - for i in $answers; do
27 - if [ "$i" = "$id" ]; then
31 - answers="$answers"' '"$id"
32 - eval "$dbvar"'_answers="$answers"'
35 -# Remove an answer from a database in memory
37 - local dbvar="$1" # IN/OUT
43 - eval 'unset '"$dbvar"'_answer_'"$id"
46 - eval 'answers="$'"$dbvar"'_answers"'
47 - # There is no double quote around $answers on purpose
48 - for i in $answers; do
49 - if [ "$i" != "$id" ]; then
50 - new_answers="$new_answers"' '"$i"
53 - eval "$dbvar"'_answers="$new_answers"'
56 -# Load all answers from a database on stdin to memory (<dbvar>_answer_*
58 -db_load_from_stdin() {
59 - local dbvar="$1" # OUT
61 - eval "$dbvar"'_answers=""'
63 - # read doesn't support -r on FreeBSD 3.x. For this reason, the following line
64 - # is patched to remove the -r in case of FreeBSD tools build. So don't make
65 - # changes to it. -- Jeremy Bar
66 - while read -r action p1 p2; do
67 - if [ "$action" = 'answer' ]; then
68 - db_answer_add "$dbvar" "$p1" "$p2"
69 - elif [ "$action" = 'remove_answer' ]; then
70 - db_answer_remove "$dbvar" "$p1"
75 -# Load all answers from a database on disk to memory (<dbvar>_answer_*
78 - local dbvar="$1" # OUT
79 - local dbfile="$2" # IN
81 - db_load_from_stdin "$dbvar" < "$dbfile"
84 -# Iterate through all answers in a database in memory, calling <func> with
85 -# id/value pairs and the remaining arguments to this function
87 - local dbvar="$1" # IN
88 - local func="$2" # IN
94 - eval 'answers="$'"$dbvar"'_answers"'
95 - # There is no double quote around $answers on purpose
96 - for i in $answers; do
97 - eval 'value="$'"$dbvar"'_answer_'"$i"'"'
98 - "$func" "$i" "$value" "$@"
102 -# If it exists in memory, remove an answer from a database (disk and memory)
103 -db_remove_answer() {
104 - local dbvar="$1" # IN/OUT
105 - local dbfile="$2" # IN
110 - eval 'answers="$'"$dbvar"'_answers"'
111 - # There is no double quote around $answers on purpose
112 - for i in $answers; do
113 - if [ "$i" = "$id" ]; then
114 - echo 'remove_answer '"$id" >> "$dbfile"
115 - db_answer_remove "$dbvar" "$id"
121 -# Add an answer to a database (disk and memory)
123 - local dbvar="$1" # IN/OUT
124 - local dbfile="$2" # IN
126 - local value="$4" # IN
128 - db_remove_answer "$dbvar" "$dbfile" "$id"
129 - echo 'answer '"$id"' '"$value" >> "$dbfile"
130 - db_answer_add "$dbvar" "$id" "$value"
133 -# Add a file to a database on disk
134 -# 'file' is the file to put in the database (it may not exist on the disk)
135 -# 'tsfile' is the file to get the timestamp from, '' if no timestamp
137 - local dbfile="$1" # IN
138 - local file="$2" # IN
139 - local tsfile="$3" # IN
142 - if [ "$tsfile" = '' ]; then
143 - echo 'file '"$file" >> "$dbfile"
145 - date=`date -r "$tsfile" '+%s' 2> /dev/null`
146 - if [ "$date" != '' ]; then
149 - echo 'file '"$file$date" >> "$dbfile"
153 -# Add a directory to a database on disk
155 - local dbfile="$1" # IN
156 - local dir="$2" # IN
158 - echo 'directory '"$dir" >> "$dbfile"
162 -db_load 'vm_db' '/etc/vmware/locations'
163 +. /etc/vmware/locations
165 if [ "vmware" = "vmware-console" ]; then
166 vmware_config_name="vmware-config-console"