This repository was archived by the owner on Jun 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOriginSetup
More file actions
240 lines (217 loc) · 8.21 KB
/
Copy pathOriginSetup
File metadata and controls
240 lines (217 loc) · 8.21 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
#!/bin/bash
# OriginSetup; This script installs the Origin Software of the EA network on almost any Linux distribution using the WINE compatibilitylayer.
# Copyright (C) 2018 LinuxSquare
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version
# This program is distributed in the hope it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTYBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Generel Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program, If not, see <https://www.gnu.org/licenses/>.
export WINEPREFIX=~/SquareGames/EA32
. /etc/os-release
OS=$ID
pkgname=OriginSetup
pkgver='Beta 4.9'
pkgdesc='Installs EA`s Origin on Arch Linux GNU/Linux'
license='GPLv3'
url="https://github.com/LinuxSquare/Origin"
LOCATION=$HOME/SquareGames
prefixname=EA32
archdepends="lib32-libldap lib32-gnutls wget git cabextract"
fedoradepends="openldap gnutls cabextract"
susedepends="gnutls openldap2 cabextract"
debdepends="libldap-2.4-2 gnutls-bin apt-transport-https cabextract"
WHITE='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\e[38;5;202m'
function redecho() {
echo -e "${RED}${*}${WHITE}"
}
function errorQuit() {
redecho "$1"
exit 1
}
function greenecho() {
echo -e "${GREEN}${*}${WHITE}"
}
function orangeecho() {
echo -e "${ORANGE}${*}${WHITE}"
}
function help() {
echo -e "OriginSetup: $1: invalid option"
echo -e " -i, --install\t\t\t Installs the software"
echo -e " -u, --update\t\t\t Updates the software"
echo -e " -v, --version\t\t\t Shows the current version and the license of the software."
echo -e " --uninstall\t\t\t Uninstalls the software"
}
function version() {
echo -e " ${pkgname}, $pkgver
Copyright (C) 2018 LinuxSquare
License ${license}: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it."
}
function uninstall() {
export WINEPREFIX=~/SquareGames/EA32
pushd "${WINEPREFIX}/drive_c/Program Files/Origin"
wineserver -f &
wineserver_pid=$!
orangeecho "Starting Origin Uninstaller"
wine start 'OriginUninstall.exe'
while kill -0 ${wineserver_pid} 2>/dev/null; do
sleep 1
done
popd
rm -rf ~/SquareGames/EA32/
}
function checkConnection() {
orangeecho "Checking your internet-connection"
wget --spider --quiet http://example.com
if [[ $? != 0 ]]; then
REASON="Either no internet-connection or wget not installed"
errorQuit "Uh oh, and error occured during installation, please fix the problem first, before you retry.
\nErrorCode: $REASON"
else
greenecho "Connection OK"
fi
}
function dependencies() {
if [[ -d $LOCATION/$prefixname ]]; then
errorQuit "It seems that you have already used this script.
\nPlease uninstall the software first before you try again."
fi
greenecho "Installing missing dependencies. This may take a while, depending on your internet-connection..."
if [[ $OS = "arch" ]]; then
sudo pacman -S "${archdepends}" --quiet --noconfirm --noprogressbar
elif [[ $OS = "debian" || $OS = "ubuntu" || $OS = "linuxmint" ]]; then
sudo apt-get -qq install "${debdepends}" -y
elif [[ $OS = "fedora" ]]; then
sudo dnf -q install "${fedoradepends}" -y
elif [[ $OS = "opensuse-tumbleweed" || $OS = "opensuse-leap" ]]; then
sudo zypper in --no-confirm "${susedepends}"
fi
}
function buildwine() {
greenecho "Installing Wine from the repository"
if [[ $OS = "arch" ]]; then
sudo pacman -Syu --quiet --noconfirm --noprogressbar
sudo pacman -S wine-staging --quiet --noconfirm --noprogressbar
elif [[ $OS = "debian" || $OS = "ubuntu" || $OS = "linuxmint" ]]; then
DEBVER=$VERSION_ID
sudo dpkg --add-architecture i386
wget -nc --quiet https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
rm -f Release.key
if [[ $DEBVER = "9" ]]; then
echo "deb https://dl.winehq.org/wine-builds/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/wine.list
elif [[ $DEBVER = "8" ]]; then
echo "deb https://dl.winehq.org/wine-builds/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/wine.list
elif [[ $OS = "ubuntu" ]]; then
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
elif [[ $DEBVER = "19" ]]; then
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main"
elif [[ $DEBVER = "18.3" || $DEBVER = "18.2" || $DEBVER = "18.1" || $DEBVER = "18" ]]; then
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main"
else
errorQuit "Unsupported distro version. This script currently supports only:
\nDebian 9 and 8
\nAny kind of Ubuntu version
\nLinux Mi nt 18.x and 19.0"
fi
sudo apt-get -qq update
sudo apt-get -qq upgrade -y
sudo apt-get -qq install --install-recommends winehq-staging -y
elif [[ $OS = "fedora" ]]; then
FEDORAVER=$VERSION_ID
if [[ $FEDORAVER = "29" ]]; then
sudo dnf -q config-manager --add-repo https://download.opensuse.org/repositories/Emulators:/Wine:/Fedora/Fedora_29_standard/Emulators:Wine:Fedora.repo
elif [[ $FEDORAVER = "28" ]]; then
sudo dnf -q config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/28/winehq.repo
else
errorQuit "Unsupported Fedora version. Please make sure you're using either version 28 or 29"
fi
sudo dnf -q install winehq-staging -y
elif [[ $OS = "opensuse-tumbleweed" ]]; then
sudo zypper dup -y
sudo zypper ar -f http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_Tumbleweed/Emulators:Wine.repo | echo 'a'
sudo zypper in -y wine-staging
elif [[ $OS = "opensuse-leap" ]]; then
SUSEVER=$VERSION
if [[ $SUSEVER = "15.0" ]]; then
sudo zypper ar -f http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_Leap_15.0/Emulators:Wine.repo | echo 'a'
elif [[ $SUSEVER = "42.3" ]]; then
sudo zypper ar -f http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_Leap_42.3/Emulators:Wine.repo | echo 'a'
else
errorQuit "Unsupported openSUSE version. Please make sure you're using either version 42.3, 15.0 or Tumbleweed"
fi
sudo zypper in -y wine-staging
fi
}
function preparePrefix() {
greenecho "Cloning winetricks from githubusercontent"
wget --quiet --no-check-certificate https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
mkdir -p ~/SquareGames
orangeecho "Downloading dlls to generate Wineprefix. Please select Windows 7 as your operating system inside winecfg.
\nBe sure you have removed the ticks for sending data and crash reports to Microsoft, while installing the DLL files.
\nPress [RETURN] when you've finished reading."
read
WINEPREFIX=~/SquareGames/EA32 wine
WINEARCH=win32 wineboot -u
WINEPREFIX=~/SquareGames/EA32 ./winetricks vcrun2010
WINEPREFIX=~/SquareGames/EA32 ./winetricks vcrun2013
WINEPREFIX=~/SquareGames/EA32 ./winetricks vcrun2017
WINEPREFIX=~/SquareGames/EA32 ./winetricks d3dx9
WINEPREFIX=~/SquareGames/EA32 wine winecfg
rm -f winetricks
}
function install() {
pushd "${WINEPREFIX}/drive_c"
greenecho "Getting Origin installation-file"
wget --quiet https://origin-a.akamaihd.net/Origin-Client-Download/origin/live/OriginThinSetup.exe
sleep 2
wineserver -f &
wineserver_pid=$!
greenecho "Starting Origin Installer"
sleep 3
wine start 'C:\OriginThinSetup.exe'
while kill -0 ${wineserver_pid} 2>/dev/null; do
sleep 1
done
rm -f OriginThinSetup.exe
popd
}
function update() {
git clone https://github.com/DrDoctor13/wine-origin-updater.git && cd wine-origin-updater
WINEPREFIX=~/SquareGames/EA32 ./updateorigin.sh && cd ..
rm -f wine-origin-updater
}
case $1 in
-i|--install)
checkConnection
dependencies
buildwine
preparePrefix
install
;;
-u|--update)
update
;;
--uninstall)
uninstall
;;
-h|--help)
help
;;
-v|--version)
version
;;
*)
orangeecho "Type $0 --help for more information"
;;
esac