Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Script to create the initial WINEPREFIX directory |
| 4 | # |
| 5 | # Copyright 1999 Ove Kåven |
| 6 | # Copyright 2004 Chris Morgan |
| 7 | # Copyright 2004 Alexandre Julliard |
| 8 | # |
| 9 | # This library is free software; you can redistribute it and/or |
| 10 | # modify it under the terms of the GNU Lesser General Public |
| 11 | # License as published by the Free Software Foundation; either |
| 12 | # version 2.1 of the License, or (at your option) any later version. |
| 13 | # |
| 14 | # This library is distributed in the hope that it will be useful, |
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | # Lesser General Public License for more details. |
| 18 | # |
| 19 | # You should have received a copy of the GNU Lesser General Public |
| 20 | # License along with this library; if not, write to the Free Software |
| 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | # |
| 23 | |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 24 | usage() |
| 25 | { |
| 26 | echo "Usage: $0 [options]" |
| 27 | echo "" |
| 28 | echo "Options:" |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 29 | echo " -h, --help Display this message" |
| 30 | echo " --prefix <dir> Directory to create (default: \$WINEPREFIX or ~/.wine)" |
| 31 | echo " -q, --quiet Don't print status messages" |
| 32 | echo " -u, --update Update the prefix directory if it already exists" |
| 33 | echo " --use-wine-tree <dir> Run from the Wine source tree <dir>" |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 34 | echo "" |
| 35 | } |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 37 | set -e |
| 38 | |
| 39 | dlldir="@dlldir@" |
| 40 | datadir="@datadir@/wine" |
| 41 | |
| 42 | do_update=0 |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 43 | quiet=0 |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 44 | |
| 45 | while [ $# -gt 0 ] |
| 46 | do |
| 47 | case "$1" in |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 48 | -h|--help) |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 49 | usage |
| 50 | exit 0 |
| 51 | ;; |
| 52 | --prefix) |
| 53 | WINEPREFIX="$2" |
| 54 | shift 2 |
| 55 | ;; |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 56 | -u|--update) |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 57 | do_update=1 |
| 58 | shift |
| 59 | ;; |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 60 | -q|--quiet) |
| 61 | quiet=1 |
| 62 | shift |
| 63 | ;; |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 64 | --use-wine-tree) |
| 65 | topdir=`cd "$2" && pwd` |
| 66 | if [ -x "$topdir/server/wineserver" ] |
| 67 | then |
| 68 | WINELOADER="$topdir/wine" |
| 69 | dlldir="$topdir/programs" |
| 70 | datadir="$topdir/tools" |
| 71 | else |
| 72 | echo "$2 is not a valid Wine source tree" |
| 73 | exit 1 |
| 74 | fi |
| 75 | shift 2 |
| 76 | ;; |
| 77 | *) |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 78 | echo "Unknown option $1" |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 79 | usage |
| 80 | exit 1 |
| 81 | ;; |
| 82 | esac |
| 83 | done |
| 84 | |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 85 | WINEPREFIX="${WINEPREFIX:-$HOME/.wine}" |
| 86 | |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 87 | if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then : |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 88 | else |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 89 | echo "Could not create $WINEPREFIX, aborting" |
| 90 | exit 1 |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 91 | fi |
| 92 | |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 93 | WINEPREFIX=`cd "$WINEPREFIX" && pwd` |
Alexandre Julliard | 1c5b8b1 | 2004-05-14 00:43:50 +0000 | [diff] [blame] | 94 | |
| 95 | # Create the drive symlinks |
| 96 | |
| 97 | if [ ! -d "$WINEPREFIX/dosdevices" ] |
| 98 | then |
| 99 | mkdir "$WINEPREFIX/dosdevices" |
| 100 | [ -d "$WINEPREFIX/drive_c" ] || mkdir "$WINEPREFIX/drive_c" |
| 101 | ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:" |
| 102 | ln -s "/" "$WINEPREFIX/dosdevices/z:" |
| 103 | fi |
| 104 | |
| 105 | CROOT="$WINEPREFIX/dosdevices/c:" |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 106 | |
| 107 | # Create the directory tree |
| 108 | |
| 109 | for i in \ |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 110 | "$CROOT/windows" \ |
| 111 | "$CROOT/windows/command" \ |
| 112 | "$CROOT/windows/fonts" \ |
| 113 | "$CROOT/windows/inf" \ |
| 114 | "$CROOT/windows/profiles" \ |
| 115 | "$CROOT/windows/profiles/Administrator" \ |
| 116 | "$CROOT/windows/Program Files" \ |
| 117 | "$CROOT/windows/Program Files/Common Files" \ |
| 118 | "$CROOT/windows/Start Menu" \ |
| 119 | "$CROOT/windows/Start Menu/Programs" \ |
| 120 | "$CROOT/windows/Start Menu/Programs/Startup" \ |
| 121 | "$CROOT/windows/system" \ |
| 122 | "$CROOT/windows/temp" |
| 123 | do |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 124 | [ -d "$i" ] || mkdir "$i" |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 125 | done |
| 126 | |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 127 | # Create the application symlinks |
| 128 | |
| 129 | link_app() |
| 130 | { |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 131 | rm -f "$2" && ln -s "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2" |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | link_app start "$CROOT/windows/command/start.exe" |
| 135 | link_app notepad "$CROOT/windows/notepad.exe" |
| 136 | link_app regedit "$CROOT/windows/regedit.exe" |
| 137 | link_app rundll32 "$CROOT/windows/rundll32.exe" |
| 138 | link_app wcmd "$CROOT/windows/system/wcmd.exe" |
| 139 | link_app control "$CROOT/windows/system/control.exe" |
| 140 | link_app winhelp "$CROOT/windows/system/help.exe" |
| 141 | link_app notepad "$CROOT/windows/system/notepad.exe" |
| 142 | link_app progman "$CROOT/windows/system/progman.exe" |
| 143 | link_app regsvr32 "$CROOT/windows/system/regsvr32.exe" |
| 144 | link_app winemine "$CROOT/windows/system/winmine.exe" |
| 145 | link_app winver "$CROOT/windows/system/winver.exe" |
| 146 | link_app uninstaller "$CROOT/windows/uninstall.exe" |
| 147 | link_app winhelp "$CROOT/windows/winhelp.exe" |
| 148 | link_app winhelp "$CROOT/windows/winhlp32.exe" |
| 149 | link_app winebrowser "$CROOT/windows/winebrowser.exe" |
| 150 | |
| 151 | # Copy the .inf script and run it |
| 152 | |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 153 | cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf" |
Alexandre Julliard | bd60364 | 2004-04-01 05:03:27 +0000 | [diff] [blame] | 154 | export WINEPREFIX |
| 155 | ${WINELOADER:-wine} rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf |
| 156 | |
| 157 | # Wait for the wineserver to finish |
| 158 | |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 159 | if [ $do_update = 0 ] |
| 160 | then |
| 161 | ${WINESERVER:-wineserver} -w |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 162 | if [ $quiet = 0 ] |
| 163 | then |
| 164 | echo "$WINEPREFIX created successfully." |
| 165 | fi |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 166 | else |
Alexandre Julliard | 04869eb | 2004-05-11 04:29:18 +0000 | [diff] [blame] | 167 | if [ $quiet = 0 ] |
| 168 | then |
| 169 | echo "$WINEPREFIX updated successfully." |
| 170 | fi |
Alexandre Julliard | 5f27ca2 | 2004-05-05 22:09:09 +0000 | [diff] [blame] | 171 | fi |