Skip to content

Commit

Permalink
winetricks: add "--country=" option and support config file "${WINETR…
Browse files Browse the repository at this point in the history
…ICKS_CONFIG}/country"

This option and config file allow users to specify their own location and
prevent access to ipinfo.io when retrying downloads.

The content of ${WINETRICKS_CONFIG}/country needs to be your country code.

e.g. If you're in Russia:

(Linux)
echo "RU" > "${XDG_CONFIG_HOME:-$HOME/.config}"/winetricks/country

(Mac)
echo "RU" > "${XDG_CONFIG_HOME:-$HOME/Library/Preferences}"/winetricks/country

Fixes #914
  • Loading branch information
kakurasan authored and austin987 committed Mar 19, 2018
1 parent 0dbcc45 commit 8d334db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/winetricks
Expand Up @@ -4951,6 +4951,11 @@ winetricks_init()
WINETRICKS_CONFIG="${XDG_CONFIG_HOME}/winetricks"
#test -d "$WINETRICKS_CONFIG" || mkdir -p "$WINETRICKS_CONFIG"

# Load country code from config file only when "--country=" option is not specified
if test -z "$W_COUNTRY" -a -f "${WINETRICKS_CONFIG}"/country; then
W_COUNTRY="$(cat "${WINETRICKS_CONFIG}"/country)"
fi

# Pin a task to a single cpu. Helps prevent race conditions.
#
# Linux/FreeBSD: supported
Expand Down Expand Up @@ -5129,6 +5134,7 @@ Usage: $0 [options] [command|verb|path-to-verb] ...
Executes given verbs. Each verb installs an application or changes a setting.

Options:
--country=CC Set country code to CC and don't detect your IP address
--force Don't check whether packages were already installed
--gui Show gui diagnostics even when driven by commandline
--isolate Install each app or game in its own bottle (WINEPREFIX)
Expand Down Expand Up @@ -5166,6 +5172,7 @@ _EOF_
winetricks_handle_option()
{
case "$1" in
--country=*) W_COUNTRY="${1##--country=}" ;;
--force) WINETRICKS_FORCE=1;;
--gui) winetricks_detect_gui;;
-h|--help) winetricks_usage ; exit 0 ;;
Expand Down
5 changes: 5 additions & 0 deletions src/winetricks.1
Expand Up @@ -22,6 +22,11 @@ with no arguments displays a GUI using either Zenity or Kdialog.
.SH OPTIONS
.TP
.B
\-\-country=CC
Set country code to CC and don't detect your IP address
when retrying downloads
.TP
.B
\-\-force
Don't check whether packages were already installed
.TP
Expand Down

0 comments on commit 8d334db

Please sign in to comment.