Skip to content

Commit

Permalink
winetricks: add initial embedded wine cmd support
Browse files Browse the repository at this point in the history
  • Loading branch information
austin987 committed Jul 19, 2016
1 parent ad469c2 commit c527086
Showing 1 changed file with 51 additions and 34 deletions.
85 changes: 51 additions & 34 deletions src/winetricks
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ w_try_msiexec64()

w_try_regedit()
{
# On Windows, doesn't work without cmd /c
case "$OS" in
"Windows_NT") cmdc="cmd /c";;
# on windows, doesn't work without cmd /c
case "$W_PLATFORM" in
windows_cmd|wine_cmd) cmdc="cmd /c";;
*) unset cmdc ;;
esac

Expand Down Expand Up @@ -496,8 +496,8 @@ winetricks_wintounix()
# so -u to convert to Unix, and -w to convert to Windows
w_pathconv()
{
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
# for some reason, cygpath turns some spaces into newlines?!
cygpath "$@" | tr '\012' '\040' | sed 's/ $//'
;;
Expand Down Expand Up @@ -1530,8 +1530,8 @@ _EOF_

w_skip_windows()
{
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
echo "Skipping operation '$1' on Windows"
return 0
;;
Expand Down Expand Up @@ -2205,8 +2205,8 @@ w_metadata()
# so check for lines that aren't properly quoted.

# Do sanity check unless running on Cygwin, where it's way too slow.
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
;;
*)
if grep '[^"]$' "$file"
Expand Down Expand Up @@ -2298,8 +2298,8 @@ w_do_call()
fi

# If needed, set the app's wineprefix
case "$OS" in
Windows_NT)
case "$W_PLATFORM" in
windows_cmd|wine_cmd)
;;
*)
case "$category"-"$WINETRICKS_OPT_SHAREDPREFIX" in
Expand Down Expand Up @@ -2458,6 +2458,21 @@ winetricks_get_sha1sum_prog() {
fi
}

winetricks_get_platform()
{
if [ "${OS}" = "Windows_NT" ]
then
if [ ! -v ${WINELOADERNOEXEC} ]
then
export W_PLATFORM="windows_cmd"
else
export W_PLATFORM="wine_cmd"
fi
else
export W_PLATFORM="wine"
fi
}

winetricks_print_version() {
# Normally done by winetricks_init, but we don't want to set up the WINEPREFIX
# just to get the winetricks version:
Expand Down Expand Up @@ -3331,8 +3346,8 @@ winetricks_is_installed()
return 1 # not installed
fi

case "$OS" in
Windows_NT)
case "$W_PLATFORM" in
windows_cmd|wine_cmd)
# On Windows, there's no wineprefix, just check if file's there
_W_file_unix="$(w_pathconv -u "$_W_file")"
if test -f "$_W_file_unix"
Expand Down Expand Up @@ -4031,8 +4046,8 @@ winetricks_set_wineprefix()
*unknown*) w_die "$WINE cmd.exe /c echo '%ProgramFiles%' returned a string containing the word 'unknown', as if a voice had cried out in terror, and was suddenly silenced." ;;
esac

case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
W_DRIVE_C="/cygdrive/c" ;;
*)
W_DRIVE_C="$WINEPREFIX/dosdevices/c:" ;;
Expand All @@ -4051,8 +4066,8 @@ winetricks_set_wineprefix()
W_TMP_WIN="C:\\windows\\Temp\\_$1"
fi

case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
"windows_cmd|wine_cmd")
W_CACHE_WIN="$(w_pathconv -w $W_CACHE)"
;;
*)
Expand Down Expand Up @@ -4201,6 +4216,8 @@ winetricks_init()

winetricks_get_sha1sum_prog

winetricks_get_platform

#---- Public Variables ----

# Where application installers are cached
Expand All @@ -4225,8 +4242,8 @@ winetricks_init()
WINETRICKS_AUTH="${WINETRICKS_AUTH:-$XDG_DATA_HOME/winetricks/auth}"

# System-specific variables
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
WINE=""
WINESERVER=""
W_DRIVE_C="C:/"
Expand Down Expand Up @@ -5937,8 +5954,8 @@ load_dotnet30()
esac
fi

case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
osver="$(cmd /c ver)"
case "$osver" in
*Version?6*) w_die "Vista and up bundle .NET 3.0, so you can't install it like this" ;;
Expand Down Expand Up @@ -6037,8 +6054,8 @@ w_metadata dotnet35 dlls \

load_dotnet35()
{
case "$OS" in
"Windows_NT") ;;
case "$W_PLATFORM" in
windows_cmd) ;;
*) w_warn "dotnet35 does not yet fully work or install on wine. Caveat emptor." ;;
esac

Expand Down Expand Up @@ -6085,8 +6102,8 @@ w_metadata dotnet35sp1 dlls \

load_dotnet35sp1()
{
case "$OS" in
"Windows_NT") ;;
case "$W_PLATFORM" in
windows_cmd) ;;
*) w_warn "dotnet35sp1 does not yet fully work or install on wine. Caveat emptor." ;;
esac

Expand Down Expand Up @@ -6153,9 +6170,9 @@ load_dotnet40()
w_die "This package does not work on a 64-bit installation"
fi

case "$OS" in
"Windows_NT") ;;
*) w_warn "dotnet40 does not yet fully work or install on Wine. Caveat emptor." ;;
case "$W_PLATFORM" in
windows_cmd) ;;
*) w_warn "dotnet40 does not yet fully work or install on wine. Caveat emptor." ;;
esac

# http://www.microsoft.com/download/en/details.aspx?id=17718
Expand Down Expand Up @@ -15315,8 +15332,8 @@ load_masseffect2_demo()
fi

# Don't let self-extractor write into $W_CACHE
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd|wine_cmd)
cp "$W_CACHE/$W_PACKAGE/MassEffect2DemoEN.exe" "$W_TMP"
chmod +x "$W_TMP"/MassEffect2DemoEN.exe ;;
*)
Expand Down Expand Up @@ -18824,8 +18841,8 @@ winetricks_stats_init()
winetricks_os_description()
{
(
case "$OS" in
"Windows_NT")
case "$W_PLATFORM" in
windows_cmd)
echo windows ;;
*) echo "$WINETRICKS_WINE_VERSION" ;;
esac
Expand Down Expand Up @@ -18862,8 +18879,8 @@ winetricks_stats_log_command()
echo "$*" >> "$WINETRICKS_WORKDIR"/breadcrumbs

# and for the user's own reference later, when figuring out what he did
case "$OS" in
"Windows_NT") _W_LOGDIR="$W_WINDIR_UNIX"/Temp ;;
case "$W_PLATFORM" in
windows_cmd) _W_LOGDIR="$W_WINDIR_UNIX"/Temp ;;
*) _W_LOGDIR="$WINEPREFIX" ;;
esac
mkdir -p "$_W_LOGDIR"
Expand Down

0 comments on commit c527086

Please sign in to comment.