wineinstall improvements, mostly for usage in package postinstall

scripts.
This commit is contained in:
Ove Kaaven 2000-10-29 18:02:53 +00:00 committed by Alexandre Julliard
parent aa5a1162a3
commit 2c76752ada

View file

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
# WINE Installation script # WINE Installation script
# Can do almost everything from compiling to configuring...
# Mar 31 1999 - Ove Kåven # Mar 31 1999 - Ove Kåven
# First version # First version
@ -22,9 +23,13 @@
# May 9 2000 - Ove Kåven # May 9 2000 - Ove Kåven
# use ttydrv when running regapi, so we don't have to run from X # use ttydrv when running regapi, so we don't have to run from X
# change debugger path in registry # change debugger path in registry
# Oct 29 2000 - Ove Kåven
# added --enable-opengl to default confargs
# added conf_question, conf_yesno_answer, and conf_string_answer functions
# added DEFCAT variable
#--- defaults (change these if you are a packager) #--- defaults (change these if you are a packager)
CONFARGS= # configure args, e.g. --prefix=/usr --sysconfdir=/etc CONFARGS=--enable-opengl # configure args, e.g. --prefix=/usr --sysconfdir=/etc
prefix=/usr/local # installation prefix prefix=/usr/local # installation prefix
sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be sysconfdir=$prefix/etc # where wine.conf and global registry is supposed to be
bindir=$prefix/bin # where winelib apps will be (or is) installed bindir=$prefix/bin # where winelib apps will be (or is) installed
@ -56,15 +61,48 @@ SYSTEMINI=$exdir/system.ini # the path of default system.ini
REGAPI=programs/regapi/regapi # the path of regapi winelib application REGAPI=programs/regapi/regapi # the path of regapi winelib application
DEFREG=winedefault.reg # the path of the registry file to be fed to regapi DEFREG=winedefault.reg # the path of the registry file to be fed to regapi
# CROOT=/var/wine # the path of the fake Drive C (asks user if not set) # CROOT=/var/wine # the path of the fake Drive C (asks user if not set)
DEFCAT=cat # program to cat $DEFREG with (some packages need zcat)
#--- end of defaults #--- end of defaults
# temporary files used by the installer # temporary files used by the installer
TMPCONF=/tmp/wineinstall.conf TMPCONF=/tmp/wineinstall.conf
TMPREG=/tmp/wineinstall.reg TMPREG=/tmp/wineinstall.reg
# functions
function conf_question {
# parameters: $1 = importance, $2 = question-id, $3+ = message lines
# the first two parameters can be used by e.g. debconf in debian packages
# but here we just print the message
shift 2
echo
local LINE="$1"
while shift
do {
echo "$LINE"
LINE="$1"
}
done
}
function conf_yesno_answer {
unset ANSWER
while [ "$ANSWER" != 'yes' ] && [ "$ANSWER" != 'no' ]
do {
echo -n "$1"
read ANSWER
}
done
}
function conf_string_answer {
echo -n "$1"
read ANSWER
}
# startup... # startup...
echo "WINE Installer v0.4" echo "WINE Installer v0.5"
echo echo
if [ "$BINDIST" = 'no' ] if [ "$BINDIST" = 'no' ]
@ -79,13 +117,13 @@ then {
fi fi
# check whether RPM installed, and if it is, remove any old wine rpm. # check whether RPM installed, and if it is, remove any old wine rpm.
hash rpm; RET=$? &>/dev/null hash rpm &>/dev/null
RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then if [ -n "`rpm -qi wine 2>/dev/null|grep "^Name"`" ]; then
echo "Warning: Old Wine RPM install detected. We want to get rid of it first." echo "Warning: Old Wine RPM install detected. Do you want to remove it first?"
echo -n "ok (Y/n) ? " conf_yesno_answer "(yes/no) "
read DOWINE if [ "$ANSWER" = 'yes' ]; then
if [ "$DOWINE" != 'n' -a "$DOWINE" != 'N' ]; then
echo Starting wine rpm removal... echo Starting wine rpm removal...
rpm -e wine; RET=$? rpm -e wine; RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
@ -200,7 +238,6 @@ else {
fi fi
} }
fi fi
echo
} }
fi # BINDIST fi # BINDIST
@ -228,16 +265,17 @@ then {
then { then {
if [ "$DOCONF" != 'yes' ] if [ "$DOCONF" != 'yes' ]
then { then {
echo "Since you aren't root, and there's no system wine.conf, I assume" conf_question medium make_user_winerc \
echo "you want a user-specific .winerc. Am I correct? (yes/no)" "Since you aren't root, and there's no system wine.conf, I assume" \
while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ] "you want a user-specific .winerc. Am I correct?"
do read DOCONF conf_yesno_answer "(yes/no) "
done DOCONF="$ANSWER"
} }
fi fi
if [ "$DOCONF" = 'no' ] if [ "$DOCONF" = 'no' ]
then { then {
echo "Aborting install. Try again as root to generate a system wine.conf." conf_question high need_root \
"Aborting install. Try again as root to generate a system wine.conf."
exit 1 exit 1
} }
fi fi
@ -258,32 +296,34 @@ if [ "$DOCONF" = 'yes' ]
then { then {
if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ] if [ "$DOWCHK" = 'yes' ] || [ "$DOWCHK" = 'auto' ]
then { then {
echo "Searching for an existing Windows installation..." echo
echo -n "Searching for an existing Windows installation..."
if ! $WINECONF > $CONF 2>/dev/null if ! $WINECONF > $CONF 2>/dev/null
then { then {
rm -f $CONF rm -f $CONF
echo echo " not found."
echo "Windows was not found on your system, so I assume you want a Wine-only installation." conf_question low do_without_windows \
echo "Am I correct? (yes/no)" "Windows was not found on your system, so I assume you want a Wine-only installation." \
while [ "$DOWINE" != 'yes' ] && [ "$DOWINE" != 'no' ] "Am I correct?"
do read DOWINE conf_yesno_answer "(yes/no) "
done if [ "$ANSWER" = 'no' ]
if [ "$DOWINE" = 'no' ]
then { then {
echo "Aborting install. Make sure your Windows partition is mounted and try again," conf_question high windows_not_found \
echo "or create $CONF manually by copying from $WINEINI and adapting the drive paths." "Aborting install. Make sure your Windows partition is mounted and try again," \
"or create $CONF manually by copying from $WINEINI and adapting the drive paths."
exit 1 exit 1
} }
fi fi
DOWINE=yes
} }
else { else {
echo echo " found."
echo "Created $CONF using your existing Windows installation." conf_question low windows_found \
echo "You probably want to review the file, though." "Created $CONF using your existing Windows installation." \
"You probably want to review the file, though."
DOWINE=no DOWINE=no
} }
fi fi
echo
} }
elif [ "$DOWINE" = 'auto' ] elif [ "$DOWINE" = 'auto' ]
then DOWINE=yes then DOWINE=yes
@ -300,19 +340,19 @@ then {
then DCROOT=~/c then DCROOT=~/c
else DCROOT=/c else DCROOT=/c
fi fi
echo "Configuring Wine without Windows. Some fake Windows directories must be created, to" conf_question low drivec_path \
echo "hold any .ini files, DLLs, and start menu entries your applications may need to install." "Configuring Wine without Windows. Some fake Windows directories must be created, to" \
"hold any .ini files, DLLs, and start menu entries your applications may need to install."
while [ -z "$CROOT" ] while [ -z "$CROOT" ]
do { do {
echo "Where would you like your fake C drive to be placed? (default is $DCROOT)" conf_string_answer "Where would you like your fake C drive to be placed? (default is $DCROOT)"
read CROOT if [ -z "$ANSWER" ]
if [ -z "$CROOT" ]
then CROOT="$DCROOT" then CROOT="$DCROOT"
fi fi
if ! [ -d "$CROOT" ] if ! [ -d "$ANSWER" ]
then { then {
if ! mkdir -p "$CROOT" if mkdir -p "$ANSWER"
then unset CROOT then CROOT="$ANSWER"
fi fi
} }
fi fi
@ -327,8 +367,9 @@ then {
if [ "$DOCONF" = 'yes' ] if [ "$DOCONF" = 'yes' ]
then { then {
sed "s|Path=/c\$|Path=${CROOT}|" $WINEINI > $CONF sed "s|Path=/c\$|Path=${CROOT}|" $WINEINI > $CONF
echo "Created $CONF using default Wine configuration." conf_question low default_config \
echo "You probably want to review the file, though." "Created $CONF using default Wine configuration." \
"You probably want to review the file, though."
} }
fi fi
# now we really should install the registry # now we really should install the registry
@ -338,6 +379,7 @@ then {
} }
elif [ -z "$CROOT" ] elif [ -z "$CROOT" ]
then { then {
echo
echo "Reading current Wine configuration from $CONF..." echo "Reading current Wine configuration from $CONF..."
CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^Path=\(.*\)/\1/p' $CONF` CROOT=`sed -n '/^\[Drive C\]$/,/^\[.*\]$/ s/^Path=\(.*\)/\1/p' $CONF`
echo "Drive C is configured at $CROOT." echo "Drive C is configured at $CROOT."
@ -392,15 +434,15 @@ then {
sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $CONF > $TMPCONF sed "s/GraphicsDriver=.*/GraphicsDriver=ttydrv/" $CONF > $TMPCONF
# create a temporary wineinstall.reg with fixed debugger path # create a temporary wineinstall.reg with fixed debugger path
sed "s|debugger/winedbg|${DEBUGGER}|" $DEFREG > $TMPREG $DEFCAT $DEFREG | sed "s|debugger/winedbg|${DEBUGGER}|" > $TMPREG
echo "Installing default Wine registry entries..." echo "Installing default Wine registry entries..."
echo echo
if ! $REGAPI --config $TMPCONF setValue < $TMPREG > /dev/null if ! $REGAPI --config $TMPCONF setValue < $TMPREG > /dev/null
then { then {
rm -f $TMPCONF $TMPREG rm -f $TMPCONF $TMPREG
echo
echo "Registry install failed." echo "Registry install failed."
conf_question high regapi_error
exit 1 exit 1
} }
else echo "Registry entries successfully installed." else echo "Registry entries successfully installed."