199
181
exit $SHELL_LIB_USAGE_ERROR
204
# returns what symlink should point to; i.e., what the "sane" answer is
205
# Keep this in sync with the debian/*.links files.
206
# This is only needed for symlinks to directories.
208
# XXX: Most of these look wrong in the X11R7 world and need to be fixed.
209
# If we've stopped using this function, fixing it might enable us to re-enable
210
# it again and catch more errors.
212
/etc/X11/xkb/compiled) echo /var/lib/xkb ;;
213
/etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;;
214
/usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;;
215
/usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;;
216
/usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;;
217
/usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;;
218
/usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;;
219
/usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;;
220
/usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;;
221
/usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;;
222
/usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;;
223
/usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;;
224
/usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;;
225
/usr/bin/X11) echo ../X11R6/bin ;;
226
/usr/bin/rstartd) echo ../X11R6/bin/rstartd ;;
227
/usr/include/X11) echo ../X11R6/include/X11 ;;
228
/usr/lib/X11) echo ../X11R6/lib/X11 ;;
229
*) internal_error "maplink() called with unknown path \"$1\"" ;;
234
# given a supplied set of pathnames, break each one up by directory and do an
235
# ls -dl on each component, cumulatively; i.e.
236
# analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin
237
# Thanks to Randolph Chung for this clever hack.
241
while [ -n "$1" ]; do
242
reject_whitespace "$1"
244
message "Analyzing $1:"
245
for f in $(echo "$1" | tr / \ ); do
246
if [ -e /$g$f ]; then
247
ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true
250
message "/$g$f: nonexistent; directory contents of /$g:"
260
local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \
263
reject_whitespace "$1"
264
message "Searching for overlapping packages..."
265
dpkg_info_dir=/var/lib/dpkg/info
266
if [ -d $dpkg_info_dir ]; then
267
if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then
268
possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \
269
"(xbase-clients|x11-common|xfs|xlibs)")
270
if [ -n "$possible_culprits" ]; then
271
smoking_guns=$(grep -l "$1" $possible_culprits || true)
272
if [ -n "$smoking_guns" ]; then
273
bad_packages=$(printf "\\n")
274
for f in $smoking_guns; do
275
# too bad you can't nest parameter expansion voodoo
276
p=${f%*.list} # strip off the trailing ".list"
277
package=${p##*/} # strip off the directories
278
bad_packages=$(printf "%s\n%s" "$bad_packages" "$package")
281
The following packages appear to have file overlaps with the X.Org packages;
282
these packages are either very old, or in violation of Debian Policy. Try
283
upgrading each of these packages to the latest available version if possible:
284
for example, with the command "apt-get install". If no newer version of a
285
package is available, you will have to remove it; for example, with the command
286
"apt-get remove". If even the latest available version of the package has
287
this file overlap, please file a bug against that package with the Debian Bug
288
Tracking System. You may want to refer the package maintainer to section 12.8
289
of the Debian Policy manual.
293
message "The overlapping packages are: $bad_packages"
295
message "no overlaps found."
299
message "cannot search; no matches for $dpkg_info_dir/*.list."
302
message "cannot search; $dpkg_info_dir does not exist."
307
# syntax: check_symlink symlink
309
# See if specified symlink points where it is supposed to. Return 0 if it
310
# does, and 1 if it does not.
312
# Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb().
317
if [ $# -ne 1 ]; then
318
usage_error "check_symlink() called with wrong number of arguments;" \
320
exit $SHELL_LIB_USAGE_ERROR
325
if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then
332
check_symlinks_and_warn () {
333
# syntax: check_symlinks_and_warn symlink ...
335
# For each argument, check for symlink sanity, and warn if it isn't sane.
337
# Call this function from a preinst script in the event $1 is "upgrade" or
343
if [ $# -lt 1 ]; then
344
usage_error "check_symlinks_and_warn() called with wrong number of" \
345
"arguments; expected at least 1, got $#"
346
exit $SHELL_LIB_USAGE_ERROR
349
while [ -n "$1" ]; do
351
if [ -L "$symlink" ]; then
352
if ! check_symlink "$symlink"; then
353
observe "$symlink symbolic link points to wrong location" \
354
"$(readlink "$symlink"); removing"
357
elif [ -e "$symlink" ]; then
358
errmsg="$symlink exists and is not a symbolic link; this package cannot"
359
errmsg="$errmsg be installed until this"
360
if [ -f "$symlink" ]; then
361
errmsg="$errmsg file"
362
elif [ -d "$symlink" ]; then
363
errmsg="$errmsg directory"
365
errmsg="$errmsg thing"
367
errmsg="$errmsg is removed"
374
check_symlinks_and_bomb () {
375
# syntax: check_symlinks_and_bomb symlink ...
377
# For each argument, check for symlink sanity, and bomb if it isn't sane.
379
# Call this function from a postinst script.
381
local problem symlink
384
if [ $# -lt 1 ]; then
385
usage_error "check_symlinks_and_bomb() called with wrong number of"
386
"arguments; expected at least 1, got $#"
387
exit $SHELL_LIB_USAGE_ERROR
390
while [ -n "$1" ]; do
393
if [ -L "$symlink" ]; then
394
if ! check_symlink "$symlink"; then
396
warn "$symlink symbolic link points to wrong location" \
397
"$(readlink "$symlink")"
399
elif [ -e "$symlink" ]; then
401
warn "$symlink is not a symbolic link"
404
warn "$symlink symbolic link does not exist"
406
if [ -n "$problem" ]; then
407
analyze_path "$symlink" "$(readlink "$symlink")"
408
find_culprits "$symlink"
409
die "bad symbolic links on system"
416
185
# run $UPDATECMDS in $FONTDIRS