forked from vchelaru/Gum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_gum_linux.sh
More file actions
executable file
·262 lines (228 loc) · 11.7 KB
/
setup_gum_linux.sh
File metadata and controls
executable file
·262 lines (228 loc) · 11.7 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/bash
################################################################################
### Check if wine-stable is installed
################################################################################
set -e
GUM_WINE_PREFIX_PATH=$HOME/.wine_gum_prefix/
echo "This is an experimental script."
echo "Script last updated on the 4th of October 2025!"
read -p "Do you wish to continue? (y/n): " choice
case "$choice" in
y|Y ) echo "Continuing...";;
n|N ) echo "Exiting."; exit 0;;
* ) echo "Invalid option. Exiting."; exit 1;;
esac
echo -e "\nVerifying that WINE is installed..."
WINE_VERSION=$(wine --version 2>/dev/null | grep -Eo '[0-9]+' | head -n1)
INSTALL_OR_UPGRADE_NEEDED="N"
if [[ ! "${WINE_VERSION}" ]]; then
echo "Wine is not installed!"
INSTALL_OR_UPGRADE_NEEDED="Y"
elif [[ "${WINE_VERSION}" -lt 10 ]]; then
echo "Wine is version [${WINE_VERSION}] and must be at least 10!"
INSTALL_OR_UPGRADE_NEEDED="Y"
else
echo "Wine version [${WINE_VERSION}] found!"
fi
DISTRO=$(( lsb_release -si 2>/dev/null || grep '^ID=' /etc/os-release 2>/dev/null || echo "${OSTYPE//[0-9\.]/}" 2>/dev/null || name ) | cut -d= -f2 | tr -d '"' | tr '[:upper:]' '[:lower:]')
VERSION=$(( lsb_release -sr 2>/dev/null || grep '^VERSION_ID=' /etc/os-release 2>/dev/null || echo "${OSTYPE//[A-Za-z]/}" 2>/dev/null | cut -d '.' -f1 || sw_vers --productVersion ) | cut -d= -f2 | tr -d '"' | cut -c1-2 )
# Install or update wine
if [[ "${INSTALL_OR_UPGRADE_NEEDED}" == "Y" ]]; then
echo ""
read -p "Do you wish to install the latest version of wine? (Y/n): " choice
case "$choice" in
""|y|Y ) echo "INFO: Installing latest Wine";;
n|N ) echo "WARN: Unable to continue, GUM requires Wine on Linux!"; exit 0;;
* ) echo "ERROR: Invalid option. Exiting."; exit 1;;
esac
case "$DISTRO" in
ubuntu)
if [[ "$VERSION" == "22" ]]; then
echo "Installing Wine for Ubuntu 22.xx"
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt update
sudo apt install --install-recommends winehq-stable -y
elif [[ "$VERSION" == "24" ]]; then
echo "Installing Wine for Ubuntu 24.xx"
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
sudo apt update
sudo apt install --install-recommends winehq-stable -y
fi
;;
linuxmint)
if [[ "$VERSION" == "20" ]]; then
BASE="focal"
elif [[ "$VERSION" == "21" ]]; then
BASE="jammy"
elif [[ "$VERSION" == "22" ]]; then
BASE="noble"
else
echo "Unsupported Linux Mint version: $VERSION"
exit 1
fi
echo "Installing Wine for Linux Mint $VERSION ($BASE)"
sudo apt install -y dirmngr ca-certificates software-properties-common apt-transport-https curl
sudo dpkg --add-architecture i386
curl -s https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/winehq.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/winehq.gpg] http://dl.winehq.org/wine-builds/ubuntu/ $BASE main" | sudo tee /etc/apt/sources.list.d/winehq.list
sudo apt update
sudo apt install --install-recommends winehq-stable -y
;;
fedora|nobara)
echo "Installing Wine for Fedora/Nobara"
sudo dnf install -y wine
;;
darwin)
echo -e "\nDetected macOS Version ${VERSION}"
echo -e "\nVerifying that BREW is installed..."
BREW_VERSION=$(brew --version 2>/dev/null | grep -Eo '[0-9]+' | head -n1)
BREW_INSTALL_REQUIRED="N"
if [[ ! "${BREW_VERSION}" ]]; then
echo "Brew is not installed!"
BREW_INSTALL_REQUIRED="Y"
else
echo "Brew version [${BREW_VERSION}] found!"
fi
if [[ "${BREW_INSTALL_REQUIRED}" == "Y" ]]; then
read -p "Do you wish to install brew (home brew)? (Y/n): " choice
case "$choice" in
""|y|Y ) echo "INFO: Installing brew";;
n|N ) echo "WARN: Unable to continue, GUM requires Wine on Mac which is installed with brew!"; exit 0;;
* ) echo "ERROR: Invalid option. Exiting."; exit 1;;
esac
echo -e "\nAttempting to install brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo -e "\nAttempting to install Wine-stable"
brew install --cask --no-quarantine wine-stable
;;
*)
echo "Unsupported or unknown distribution: $DISTRO"
echo "Please install wine manually!"
echo "https://duckduckgo.com/?t=h_&q=Insert+Your+Linux+Distro+Here+How+To+Install+Wine"
exit 1
;;
esac
fi
################################################################################
### Check if winetricks is installed
################################################################################
if ! winetricks --version &> /dev/null; then
echo -e "\nWinetricks is not installed. Attempting to install..."
case "$DISTRO" in
ubuntu|linuxmint)
sudo apt install -y winetricks
;;
fedora|nobara)
sudo dnf install -y winetricks
;;
darwin)
brew install winetricks
;;
*)
echo "Unsupported distribution [${DISTRO}] for automated winetricks install."
exit 1
;;
esac
fi
echo "Winetricks is installed"
################################################################################
### Install windows allfonts with winetricks. They can take a few minutes to finish, please be patient
################################################################################
echo "Installing all fonts using winetricks"
echo "An installer dialog may appear, follow the steps to install"
echo "They may take a few minutes to install, please be patient"
WINEPREFIX=$GUM_WINE_PREFIX_PATH winetricks allfonts &> /dev/null
################################################################################
### Install dotnet48 with winetricks. This will cause two installation prompts
### to appear. They can take a few minutes to finish, please be patient
################################################################################
echo "Installing .NET Framework 4.8 using winetricks"
echo "Two installer dialogs will appear, follow the steps for both to install"
echo "They may take a few minutes to install, please be patient"
WINEPREFIX=$GUM_WINE_PREFIX_PATH winetricks dotnet48 &> /dev/null
################################################################################
### Download the gum.zip file from the FRB site into the Program Files directory
### of the wine folder
################################################################################
echo "Installing GUM Tool..."
GUM_ZIP_FILE="$GUM_WINE_PREFIX_PATH/drive_c/Program Files/Gum.zip"
GUM_ZIP_DOWNLOAD="https://github.com/vchelaru/gum/releases/latest/download/gum.zip"
if ! curl --version &> /dev/null; then
wget -O "$GUM_ZIP_FILE" "$GUM_ZIP_DOWNLOAD" \
&& echo "Download completed." || { echo "Download failed using WGET."; exit 1; }
else
curl -L -o "$GUM_ZIP_FILE" "$GUM_ZIP_DOWNLOAD" \
&& echo "Download completed." || { echo "Download failed using CURL."; exit 1; }
fi
################################################################################
### Unzip the gum.zip file into Program Files/Gum
################################################################################
echo "Extracting GUM Tool..."
GUM_WINE_EXTRACT_DIR="$GUM_WINE_PREFIX_PATH/drive_c/Program Files/Gum"
rm -rf "$GUM_WINE_EXTRACT_DIR"
unzip -q "$GUM_ZIP_FILE" -d "$GUM_WINE_EXTRACT_DIR" \
&& echo "Extraction completed." || { echo "Extraction failed."; exit 1; }
echo "Cleaning up..."
rm -f "$GUM_ZIP_FILE" \
&& echo "Cleanup completed." || { echo "Cleanup failed."; exit 1; }
echo "Adding Gum to path"
################################################################################
### Define the script content
################################################################################
GUM_EXE_PATH=$(find "$GUM_WINE_EXTRACT_DIR" -name "Gum.exe" -type f)
SCRIPT_CONTENT="#!/bin/bash
WINEPREFIX=\"$GUM_WINE_PREFIX_PATH\" wine \"$GUM_EXE_PATH\""
################################################################################
### Create the ~/bin directory if it doesn't exist
################################################################################
mkdir -p ~/bin &> /dev/null
################################################################################
### Create the Gum script in the ~/bin directory
################################################################################
printf "%s\n" "$SCRIPT_CONTENT" > ~/bin/gum
################################################################################
### Make the Gum script executable
################################################################################
chmod +x ~/bin/gum &> /dev/null
################################################################################
### Check if the bin directory is in PATH based on the shell being used
### If not, add it to PATH and reload the shell configuration.
################################################################################
if [[ $SHELL == *"bash"* ]]; then
if ! grep -q 'export PATH="$HOME/bin:$PATH"' ~/.bashrc 2>/dev/null; then
echo "Adding ~/bin to PATH in ~/.bashrc, please wait..."
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
echo source ~/.bashrc
fi
echo "Reloading ~/.bashrc, please wait..."
source ~/.bash_profile &> /dev/null
elif [[ $SHELL == *"zsh"* ]]; then
if ! grep -q 'export PATH="$HOME/bin:$PATH"' ~/.zshrc 2>/dev/null; then
echo "Adding ~/bin to PATH in ~/.zshrc, please wait..."
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
fi
echo "Reloading ~/.zshrc, please wait..."
source ~/.zshrc &> /dev/null
elif [[ $SHELL == *"fish"* ]]; then
if ! grep -q 'set -x PATH $HOME/bin $PATH' ~/.config/fish/config.fish 2>/dev/null; then
echo "Adding ~/bin to PATH in config.fish, please wait..."
echo 'set -x PATH $HOME/bin $PATH' >> ~/.config/fish/config.fish
fi
echo "Reloading config.fish, please wait..."
source ~/.config/fish/config.fish &> /dev/null
fi
################################################################################
### Finished
################################################################################
echo "SUCCESS: Gum setup on Linux using WINE is now complete. You can open the GUM Tool by using the command 'gum'."
echo "TIP: To start Gum: in a terminal type ~/bin/gum"
echo "TIP: You may need to restart the terminal or your computer if it doesn't work at first"
echo "-------------------"
echo "TIP: Install dxvk with the command winetricks dxvk, if you can use Vulkan on your system! (It handles better than OpenGL)."