Skip to content

Commit 4c60410

Browse files
committed
README: improve Installation and Updating guides
Responding to further user feedback... :-) Updates to README: * supply a simplified updater script (no comments / streamlined) that is easy to setup, for new users * credit to @kenorb for suggesting the use of curl (replacing use of: wget) * curl / install commands+options are available cross-platform on Linux / FreeBSD * note: `winetricks --self-update` is **not** the same - this will only update to a newer release and will not update the bash.completion script Fixes: Winetricks#1192 Signed-off-by: Rob Walker <[email protected]>
1 parent e3961e2 commit 4c60410

File tree

1 file changed

+73
-140
lines changed

1 file changed

+73
-140
lines changed

Diff for: README.md

+73-140
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
1313
Tagged releases are accessible here:
1414
https://github.com/Winetricks/winetricks/releases
1515

16-
# Installing
16+
# Installing (Package)
1717
The ```winetricks``` package should be used if it is available and up to date. The package is available in most mainstream (Unix-like) Operating Systems:
1818

1919
* Arch: https://www.archlinux.org/packages/community/any/winetricks/
@@ -28,151 +28,84 @@ The ```winetricks``` package should be used if it is available and up to date. T
2828

2929
Note: packaged Debian / Ubuntu winetricks versions are typically outdated, so a manual installation is recommended.
3030

31-
If the package is unavailable, outdated, or the latest version is desired, a manual installation of winetricks can be done.
32-
It is _highly_ recommended to uninstall any previously installed version of winetricks first.
31+
# Automating Installation & Updating
3332

34-
**_If you don't uninstall a previously installed, packaged version of winetricks... Well then you get to pick up the pieces!_**
33+
If the winetricks package is unavailable, outdated, or the latest version is desired, a manual auto-updating setup is recommended.
34+
It is _highly_ recommended to uninstall any previously installed version of winetricks first.
3535

36-
E.g. for Debian / Ubuntu:
36+
**_If you don't uninstall a previously installed, packaged version of winetricks... Well then you get to pick up the pieces!_** ... E.g. for Debian / Ubuntu:
3737
```
3838
sudo apt-get purge winetricks
3939
```
4040

41-
Then, for Ubuntu, use a shell script to download the current winetricks script(s).
42-
E.g.:
43-
44-
```
45-
# Create and switch to a temporary directory writeable by current user. See:
46-
# https://www.tldp.org/LDP/abs/html/subshells.html
47-
cd "$(mktemp -d)"
48-
49-
# Use a BASH "here document" to create an updater shell script file.
50-
# See:
51-
# https://www.tldp.org/LDP/abs/html/here-docs.html
52-
# > outputs stdout to a file, overwriting any pre-existing file
53-
# << takes input, directly from the script itself, till the second '_EOF_SCRIPT' marker, as stdin
54-
# the cat command hooks these 2 streams up (stdin and stdout)
55-
###### create update_winetricks START ########
56-
cat > update_winetricks <<_EOF_SCRIPT
57-
#!/bin/sh
58-
59-
# Create and switch to a temporary directory writeable by current user. See:
60-
# https://www.tldp.org/LDP/abs/html/subshells.html
61-
cd "$(mktemp -d)"
62-
63-
# Download the latest winetricks script (master="latest version") from Github.
64-
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
65-
66-
# Mark the winetricks script (we've just downloaded) as executable. See:
67-
# https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x9543.htm
68-
chmod +x winetricks
69-
70-
# Move the winetricks script to a location which will be in the standard user PATH. See:
71-
# https://www.tldp.org/LDP/abs/html/internalvariables.html
72-
sudo mv winetricks /usr/bin
73-
74-
# Download the latest winetricks BASH completion script (master="latest version") from Github.
75-
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion
76-
77-
# Move the winetricks BASH completion script to a standard location for BASH completion modules. See:
78-
# https://www.tldp.org/LDP/abs/html/tabexpansion.html
79-
sudo mv winetricks.bash-completion /usr/share/bash-completion/completions/winetricks
80-
_EOF_SCRIPT
81-
###### create update_winetricks FINISH ########
82-
83-
# Mark the update_winetricks script (we've just written out) as executable. See:
84-
# https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x9543.htm
85-
chmod +x update_winetricks
86-
87-
# We must escalate privileges to root, as regular Linux users do not have write access to '/usr/bin'.
88-
sudo mv update_winetricks /usr/bin/
89-
```
90-
91-
See the manpages for the individual functions, if you are not clear how they are being used, e.g.
92-
```
93-
man mktemp
94-
man mv
95-
man wget
96-
man sudo
97-
...
98-
```
99-
100-
An alternative updater script implementation, using **su** in place of **sudo**, is also possible:
101-
102-
```
103-
cd "$(mktemp -d)"
104-
cat > update_winetricks <<_EOF_SCRIPT
105-
#!/bin/sh
106-
107-
cd "$(mktemp -d)"
108-
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
109-
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion
110-
chmod +x winetricks
111-
su root sh -c 'mv winetricks /usr/bin ; mv winetricks.bash-completion /usr/share/bash-completion/completions/winetricks'
112-
_EOF_SCRIPT
113-
114-
chmod +x update_winetricks
115-
su root sh -c 'mv update_winetricks /usr/bin/'
116-
```
117-
118-
To use ```curl``` instead of ```wget```: subsitute all ```wget``` calls with ```curl -O```, in the winetricks update script.
119-
120-
121-
# Updating
122-
Using the traditional Unix crontab...
123-
```
124-
sudo ln "/usr/bin/update_winetricks" "/etc/cron.weekly/update_winetricks"
125-
```
126-
Note: ensure you have a cron utility installed and enabled, on systems utilizing **systemd** by default.
127-
128-
The update script can be automated, to run on a set schedule, via (where available) **systemd** units.
129-
E.g. to create a scheduled winetricks updater **systemd** **timer** unit, and an associated **systemd** **service** unit:
130-
```
131-
cd "$(mktemp -d)"
132-
cat > winetricks_update.timer <<_EOF_TIMER_UNIT
133-
[Unit]
134-
Description=Run winetricks update script weekly (Saturday)
135-
136-
[Timer]
137-
OnCalendar=Sat
138-
Persistent=true
139-
140-
[Install]
141-
WantedBy=timers.target
142-
_EOF_TIMER_UNIT
143-
144-
cat > winetricks_update.service <<_EOF_SERVICE_UNIT
145-
[Unit]
146-
Description=Run winetricks update script
147-
After=network.target
148-
149-
[Service]
150-
ExecStart=/usr/bin/update_winetricks
151-
Type=oneshot
152-
_EOF_SERVICE_UNIT
153-
154-
sudo mv winetricks_update.timer winetricks_update.service /etc/systemd/system/
155-
```
156-
See:
157-
* [freedesktop.org: systemd service unit](https://www.freedesktop.org/software/systemd/man/systemd.service.html)
158-
* [freedesktop.org: systemd timer unit](https://www.freedesktop.org/software/systemd/man/systemd.timer.html)
159-
160-
To start and enable the winetricks update timer:
161-
```
162-
sudo systemctl daemon-reload
163-
sudo systemctl enable winetricks_update.timer
164-
sudo systemctl start winetricks_update.timer
165-
```
166-
167-
The core winetricks script can also be updated by simply doing:
168-
```
169-
winetricks --self-update
170-
```
171-
or:
172-
```
173-
sudo winetricks --self-update
174-
```
175-
for a system-wide winetricks installation.
41+
<hr />
42+
43+
Steps to setup a winetricks auto-updater script, which pulls from the winetricks Git Master, running on a weekly basis...
44+
45+
1. Shell script to download and install the current winetricks script(s):
46+
```
47+
cat <<_EOF_SCRIPT | sudo install /dev/stdin /usr/bin/update_winetricks
48+
#!/bin/sh
49+
50+
curl -sL https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
51+
| sudo install /dev/stdin /usr/bin/winetricks
52+
curl -sL https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion \
53+
| sudo install /dev/stdin /usr/share/bash-completion/completions/winetricks
54+
_EOF_SCRIPT
55+
```
56+
57+
2. Automate running the winetricks updater (**update_winetricks**) script - see step _1._ above.
58+
59+
Use only **one** of the **two** service options:
60+
61+
* Option _i._ [Cron](https://en.wikipedia.org/wiki/Cron)-based.
62+
63+
* Option _ii._ [systemd](https://en.wikipedia.org/wiki/Systemd)-based (**Linux -only**).
64+
65+
<hr />
66+
67+
1. Use Cron to auto-update winetricks (weekly):
68+
69+
```
70+
sudo ln -s "/usr/bin/update_winetricks" "/etc/cron.weekly/update_winetricks"
71+
```
72+
73+
<hr />
74+
75+
2. Use a **systemd timer unit** and **systemd service unit** to auto-update winetricks (weekly).
76+
77+
**systemd timer unit** (calls the **systemd service unit** at a specified interval):
78+
```
79+
cat <<_EOF_TIMER_UNIT | sudo install /dev/stdin /etc/systemd/system/winetricks_update.timer
80+
[Unit]
81+
Description=Run winetricks update script weekly (Saturday)
82+
83+
[Timer]
84+
OnCalendar=Sat
85+
Persistent=true
86+
87+
[Install]
88+
WantedBy=timers.target
89+
_EOF_TIMER_UNIT
90+
```
91+
**systemd service unit** (this service unit file does the work - it is called automatically, at a specified interval, by the **systemd timer unit**):
92+
```
93+
cat << _EOF_SERVICE_UNIT | sudo install /dev/stdin /etc/systemd/system/winetricks_update.service
94+
[Unit]
95+
Description=Run winetricks update script
96+
After=network.target
97+
98+
[Service]
99+
ExecStart=/usr/bin/update_winetricks
100+
Type=oneshot
101+
_EOF_SERVICE_UNIT
102+
```
103+
Enable and start the **systemd timer unit**:
104+
```
105+
sudo systemctl daemon-reload
106+
sudo systemctl enable winetricks_update.timer
107+
sudo systemctl start winetricks_update.timer
108+
```
176109
177110
# Custom .verb files
178111
New dll/settings/programs can be added to Winetricks by passing a custom .verb (format below)

0 commit comments

Comments
 (0)