]>
Commit | Line | Data |
---|---|---|
da9b5371 | 1 | --- vmware-distrib/bin/vmware.orig 2004-03-10 00:01:31.000000000 +0100 |
2 | +++ vmware-distrib/bin/vmware 2004-04-06 13:17:34.813580480 +0200 | |
3 | @@ -6,163 +6,9 @@ | |
4 | # the shared libraries it needs. If a shared library is not available from any | |
5 | # of the standard system-wide locations, we provide it from the VMware package | |
6 | # location. --hpreg | |
7 | - | |
8 | -# BEGINNING_OF_DB_DOT_SH | |
9 | -#!/bin/sh | |
10 | - | |
11 | -# | |
12 | -# Manage an installer database | |
13 | -# | |
14 | - | |
15 | -# Add an answer to a database in memory | |
16 | -db_answer_add() { | |
17 | - local dbvar="$1" # IN/OUT | |
18 | - local id="$2" # IN | |
19 | - local value="$3" # IN | |
20 | - local answers | |
21 | - local i | |
22 | - | |
23 | - eval "$dbvar"'_answer_'"$id"'="$value"' | |
24 | - | |
25 | - eval 'answers="$'"$dbvar"'_answers"' | |
26 | - # There is no double quote around $answers on purpose | |
27 | - for i in $answers; do | |
28 | - if [ "$i" = "$id" ]; then | |
29 | - return | |
30 | - fi | |
31 | - done | |
32 | - answers="$answers"' '"$id" | |
33 | - eval "$dbvar"'_answers="$answers"' | |
34 | -} | |
35 | - | |
36 | -# Remove an answer from a database in memory | |
37 | -db_answer_remove() { | |
38 | - local dbvar="$1" # IN/OUT | |
39 | - local id="$2" # IN | |
40 | - local new_answers | |
41 | - local answers | |
42 | - local i | |
43 | - | |
44 | - eval 'unset '"$dbvar"'_answer_'"$id" | |
45 | - | |
46 | - new_answers='' | |
47 | - eval 'answers="$'"$dbvar"'_answers"' | |
48 | - # There is no double quote around $answers on purpose | |
49 | - for i in $answers; do | |
50 | - if [ "$i" != "$id" ]; then | |
51 | - new_answers="$new_answers"' '"$i" | |
52 | - fi | |
53 | - done | |
54 | - eval "$dbvar"'_answers="$new_answers"' | |
55 | -} | |
56 | - | |
57 | -# Load all answers from a database on stdin to memory (<dbvar>_answer_* | |
58 | -# variables) | |
59 | -db_load_from_stdin() { | |
60 | - local dbvar="$1" # OUT | |
61 | - | |
62 | - eval "$dbvar"'_answers=""' | |
63 | - | |
64 | - # read doesn't support -r on FreeBSD 3.x. For this reason, the following line | |
65 | - # is patched to remove the -r in case of FreeBSD tools build. So don't make | |
66 | - # changes to it. -- Jeremy Bar | |
67 | - while read -r action p1 p2; do | |
68 | - if [ "$action" = 'answer' ]; then | |
69 | - db_answer_add "$dbvar" "$p1" "$p2" | |
70 | - elif [ "$action" = 'remove_answer' ]; then | |
71 | - db_answer_remove "$dbvar" "$p1" | |
72 | - fi | |
73 | - done | |
74 | -} | |
75 | - | |
76 | -# Load all answers from a database on disk to memory (<dbvar>_answer_* | |
77 | -# variables) | |
78 | -db_load() { | |
79 | - local dbvar="$1" # OUT | |
80 | - local dbfile="$2" # IN | |
81 | - | |
82 | - db_load_from_stdin "$dbvar" < "$dbfile" | |
83 | -} | |
84 | - | |
85 | -# Iterate through all answers in a database in memory, calling <func> with | |
86 | -# id/value pairs and the remaining arguments to this function | |
87 | -db_iterate() { | |
88 | - local dbvar="$1" # IN | |
89 | - local func="$2" # IN | |
90 | - shift 2 | |
91 | - local answers | |
92 | - local i | |
93 | - local value | |
94 | - | |
95 | - eval 'answers="$'"$dbvar"'_answers"' | |
96 | - # There is no double quote around $answers on purpose | |
97 | - for i in $answers; do | |
98 | - eval 'value="$'"$dbvar"'_answer_'"$i"'"' | |
99 | - "$func" "$i" "$value" "$@" | |
100 | - done | |
101 | -} | |
102 | - | |
103 | -# If it exists in memory, remove an answer from a database (disk and memory) | |
104 | -db_remove_answer() { | |
105 | - local dbvar="$1" # IN/OUT | |
106 | - local dbfile="$2" # IN | |
107 | - local id="$3" # IN | |
108 | - local answers | |
109 | - local i | |
110 | - | |
111 | - eval 'answers="$'"$dbvar"'_answers"' | |
112 | - # There is no double quote around $answers on purpose | |
113 | - for i in $answers; do | |
114 | - if [ "$i" = "$id" ]; then | |
115 | - echo 'remove_answer '"$id" >> "$dbfile" | |
116 | - db_answer_remove "$dbvar" "$id" | |
117 | - return | |
118 | - fi | |
119 | - done | |
120 | -} | |
121 | - | |
122 | -# Add an answer to a database (disk and memory) | |
123 | -db_add_answer() { | |
124 | - local dbvar="$1" # IN/OUT | |
125 | - local dbfile="$2" # IN | |
126 | - local id="$3" # IN | |
127 | - local value="$4" # IN | |
128 | - | |
129 | - db_remove_answer "$dbvar" "$dbfile" "$id" | |
130 | - echo 'answer '"$id"' '"$value" >> "$dbfile" | |
131 | - db_answer_add "$dbvar" "$id" "$value" | |
132 | -} | |
133 | - | |
134 | -# Add a file to a database on disk | |
135 | -# 'file' is the file to put in the database (it may not exist on the disk) | |
136 | -# 'tsfile' is the file to get the timestamp from, '' if no timestamp | |
137 | -db_add_file() { | |
138 | - local dbfile="$1" # IN | |
139 | - local file="$2" # IN | |
140 | - local tsfile="$3" # IN | |
141 | - local date | |
142 | - | |
143 | - if [ "$tsfile" = '' ]; then | |
144 | - echo 'file '"$file" >> "$dbfile" | |
145 | - else | |
146 | - date=`date -r "$tsfile" '+%s' 2> /dev/null` | |
147 | - if [ "$date" != '' ]; then | |
148 | - date=' '"$date" | |
149 | - fi | |
150 | - echo 'file '"$file$date" >> "$dbfile" | |
151 | - fi | |
152 | -} | |
153 | - | |
154 | -# Add a directory to a database on disk | |
155 | -db_add_dir() { | |
156 | - local dbfile="$1" # IN | |
157 | - local dir="$2" # IN | |
158 | - | |
159 | - echo 'directory '"$dir" >> "$dbfile" | |
160 | -} | |
161 | # END_OF_DB_DOT_SH | |
162 | ||
163 | -db_load 'vm_db' '/etc/vmware/locations' | |
164 | +. /etc/vmware/locations | |
165 | ||
166 | vm_append_libs() { | |
167 | local path | |
168 | @@ -174,9 +20,9 @@ | |
169 | while read -r lib dummy status; do | |
170 | if [ "$status" = 'not found' ]; then | |
171 | if [ "$path" = '' ]; then | |
172 | - path="$vm_db_answer_LIBDIR"'/lib/'"$lib" | |
173 | + path="$VM_LIBDIR"'/lib/'"$lib" | |
174 | else | |
175 | - path="$path"':'"$vm_db_answer_LIBDIR"'/lib/'"$lib" | |
176 | + path="$path"':'"$VM_LIBDIR"'/lib/'"$lib" | |
177 | fi | |
178 | fi | |
179 | done | |
180 | @@ -184,6 +30,6 @@ | |
181 | echo "$path" | |
182 | } | |
183 | ||
184 | -binary="$vm_db_answer_LIBDIR"'/bin/vmware' | |
185 | +binary="$VM_BINDIR"'/bin/vmware' | |
186 | export LD_LIBRARY_PATH=`LANGUAGE=C LANG=C ldd "$binary" | vm_append_libs` | |
187 | exec "$binary" "$@" |