All pastes #962032 Raw Edit

VMWare libraries swapper

public shellscript v1 · immutable
#962032 ·published 2008-03-29 12:46 UTC
rendered paste body
#! /bin/sh# (c) 2004-2008. Artem S. Tashkinov <t.artem[remove@this]mailcity.com>. This script is not covered by any license.# This script is only intended to be run in the i386 environment. Feel free to adjust it for x86-64 version of VMWare# Uncomment the next line if you'd like to see what this scipt does without actually altering your system# DEBUG=echoS="\\033[40G"vm_libsdir=/usr/lib/vmware/libvm_fontdir=/usr/lib/vmware/libconf/etcif [ -d "/etc/ld.so.conf.d" ]; then	searchpath=`cat /etc/ld.so.conf.d/*`else	searchpath=`cat ld.so.conf`fisearchpath="$searchpath /lib /usr/lib"fail(){	echo -e "$S Error: $1. Exiting"	exit 1}myecho(){	echo -e "$S $1"}findlib(){	for i in $searchpath; do		test -e "$i/$1" && echo $i && return 0	done}test "$UID" != "0" && fail "You must be root to continue"cd "$vm_libsdir" 2>/dev/null || fail "cannot find '$libsdir' directory. VMWare is probably not installed"for i in *.so.*; do	syslibpath=`findlib $i`	if [ -n "$syslibpath" ]; then		echo -n "Swapping $i ..."		wdir="$vm_libsdir/$i"		destdir="$wdir/save"		test -L "$wdir/$i" && myecho "has already been swapped" && continue		$DEBUG mkdir -p "$destdir" || fail "Failed creating $destdir"		file="$wdir/$i"		$DEBUG /bin/mv -i "$file" "$destdir" || fail "Failed moving library $file to $destdir"		$DEBUG /bin/ln -s "$syslibpath/$i" "$i/$i" || fail "Failed copying symbolic link $i/$i to $wdir"		echo -e	"$S OK"	else		skipped="$skipped\n\t$i"	fidoneif [ -n "$skipped" ]; then	echo	echo -n "Skipped libraries:"	echo -e "$skipped"	echo	echo "It's usually safe to swap VMWare's old SSL, expat and curl libraries with those that come with your distro. But you have to do that manually"	echofiif [ -L "$vm_fontdir/fonts" ]; then	echo "Fonts dir has already been swapped"else	answer=y	while ! [ "$answer" = "n" -o "$answer" = "N" -o -z "$answer" ]; do		echo -n "Please, enter a location of your fonts configuration directory (usually it's /etc/fonts): "		read answer		if [ -d "$answer" ]; then			$DEBUG /bin/mv "$vm_fontdir/fonts" "$vm_fontdir/fonts.save" || fail "Failed saving fonts dir"			$DEBUG /bin/ln -s "$answer" "$vm_fontdir/fonts" && echo "Fonts directory has been swapped successfully" || fail "Failed updating fonts dir"			answer=n		else			echo -n "Cannot find \"$answer\" directory. Would you like to enter it again (y/n)? "			read answer		fi	donefiecho "ALL OK"