File: wineprefixcreate.in

package info (click to toggle)
wine 1.0.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 108,580 kB
  • ctags: 210,474
  • sloc: ansic: 1,461,628; perl: 17,558; makefile: 8,856; yacc: 7,992; sh: 3,864; lex: 2,919; cpp: 499; awk: 69
file content (141 lines) | stat: -rw-r--r-- 3,385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh
#
# Script to create the initial WINEPREFIX directory
#
# Copyright 1999 Ove Kven
# Copyright 2004 Chris Morgan
# Copyright 2004 Alexandre Julliard
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#

usage()
{
    echo "Usage: $0 [options]"
    echo ""
    echo "Options:"
    echo "  -h, --help                 Display this message"
    echo "      --prefix <dir>         Directory to create (default: \$WINEPREFIX or ~/.wine)"
    echo "  -q, --quiet                Don't print status messages"
    echo "  -w, --wait                 Wait for the wineserver to exit before returning"
    echo ""
}

set -e

bindir=""
case "$0" in
  */*)
    # $0 contains a path, use it
    bindir=`dirname "$0"`
    ;;
  *)
    # no directory in $0, search in PATH
    saved_ifs=$IFS
    IFS=:
    for d in $PATH
    do
      IFS=$saved_ifs
      if [ -x "$d/$0" ]
      then
        bindir="$d"
        break
      fi
    done
    ;;
esac

bindir=`cd "$bindir" && pwd`
dlldir="$bindir/@bintodlldir@"

do_wait=0
quiet=0

if [ ! -f "$dlldir/ntdll.dll.so" -a \
     -x "$bindir/../server/wineserver" -a \
     -f "$bindir/../dlls/ntdll/ntdll.dll.so" ]
then
    # running from the wine source tree
    topdir=`cd "$bindir/.." && pwd`
    WINELOADER="$topdir/wine"
    WINESERVER="$topdir/server/wineserver"
    if [ -n "$LD_LIBRARY_PATH" ]
    then
        LD_LIBRARY_PATH="$topdir/libs/wine:$LD_LIBRARY_PATH"
    else
        LD_LIBRARY_PATH="$topdir/libs/wine"
    fi
    export LD_LIBRARY_PATH
fi

while [ $# -gt 0 ]
do
    case "$1" in
        -h|--help)
            usage
            exit 0
            ;;
        --prefix)
            WINEPREFIX="$2"
            shift 2
            ;;
        -q|--quiet)
            quiet=1
            shift
            ;;
        -w|--wait)
            do_wait=1
            shift
            ;;
        --use-wine-tree)
            # ignored, autodetected now
            shift 2
            ;;
        *)
            echo "Unknown option $1"
            usage
            exit 1
            ;;
  esac
done

echo "Note: wineprefixcreate is deprecated and shouldn't be needed anymore." 1>&2
echo "      WINEPREFIX creation and updates now happen automatically when needed." 1>&2
echo 1>&2

WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"

if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then :
else
    echo "Could not create $WINEPREFIX, aborting"
    exit 1
fi

WINEPREFIX=`cd "$WINEPREFIX" && pwd`
export WINEPREFIX

if [ -d "$WINEPREFIX/dosdevices" ]
then
    "${WINELOADER:-$bindir/wine}" wineboot.exe --update
else
    "${WINELOADER:-$bindir/wine}" wineboot.exe
fi

# Wait for the wineserver to finish

if [ $do_wait = 1 ]
then
    "${WINESERVER:-$bindir/wineserver}" -w
fi