Sophie

Sophie

distrib > Mandriva > 7.2 > i586 > media > main-src > by-pkgid > c768a55a790c29f21e625b2febf7a703 > files > 2

wine-20000909-1mdk.src.rpm

#!/bin/sh
# (c) MandrakeSoft.
# search the dos partition on /etc/fstab
# Search where Windows is located and config the wine.conf

if [ ! -d ~/tmp ] ; then mkdir -p ~/tmp ; fi

[ "$UID" = "0" ] || { echo "You must be root"; exit 1;}

DOSPATH=$(egrep 'dos|vfat' /etc/fstab|awk '{print $2}' |  perl -p -i -e "s|\/mnt\/floppy||")

if [ ! -z "$DOSPATH" ]; then
for VAR in $DOSPATH; do cd $VAR
	if [ -r msdos.sys ]; then
	# Grepping The Windir, Removing the ^M dos character & add a \/ for sed expression
	WINDIR=$(grep WinDir msdos.sys | sed -e 's/.*=//g' -e 's/
//g' -e 's/:/:\\/g'|tr A-Z a-z)
	PARTC=$(grep "$VAR\>" /etc/fstab|awk '{ print $2 }'|sed 's/\//\\\//g')
	fi
done; cd $OLDPWD
fi

# where the CDROM & floppy are.
# We need to translate the / to \/ for sed expression.
FLOPPY=$(egrep fd0 /etc/fstab|awk '{ print $2 }'|sed -e 's/\//\\\//g')
CDPATH=$(egrep iso9660 /etc/fstab|awk '{ print $2 }'|sed -e 's/\//\\\//g')

# Sedding the wine.conf with function & variables.

function replace() {
    sed 's/'$GREP'/'$REPL'/g' /etc/wine.conf > ~/tmp/wine.tmp
    mv -f ~/tmp/wine.tmp /etc/wine.conf
}

test -z $FLOPPY && FLOPPY="\/mnt\/floppy"
GREP=MANDRAKE_FLOPPY; REPL=$FLOPPY; replace

test -z $CDPATH && CDPATH="\/mnt\/cdrom"
GREP=MANDRAKE_CDPATH; REPL=$CDPATH; replace

test -z $PARTC && PARTC="\/var\/lib\/wine"
GREP=MANDRAKE_PARTC; REPL=$PARTC; replace

test -z $WINDIR && WINDIR="c:\\\windows"
GREP=MANDRAKE_WINDIR; REPL=$WINDIR; replace

chmod -x /usr/X11R6/bin/wine-config

[ -d /var/lib/wine/windows/system ] || mkdir -p /var/lib/wine/windows/system
[ -d /var/lib/wine/windows/Fonts ] || mkdir -p /var/lib/wine/windows/Fonts