forked from hitomi-team/discord-ipc-bridge
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall-bridge.sh
More file actions
executable file
·38 lines (29 loc) · 882 Bytes
/
install-bridge.sh
File metadata and controls
executable file
·38 lines (29 loc) · 882 Bytes
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
#!/bin/sh
set -e
# where are we?
basedir=$(dirname "$(readlink -f $0)")
action=$1
if [ -z "$action" ]; then
echo "usage: $0 [install/uninstall]"
exit 1
fi
[ -z "$wine_bin" ] && wine_bin="wine"
wine_ver=$($wine_bin --version | grep wine)
if [ -z "$wine_ver" ]; then
echo "$wine_bin: "'broken wine installation' >&2
exit 1
fi
echo "$wine_ver"
windows_dir=$($wine_bin winepath -u 'C:\windows' 2>/dev/null)
windows_dir="$(echo -n "$windows_dir" | sed 's/\r//g')"
install()
{
cp -v "$basedir/bridge.exe" "$windows_dir/bridge.exe"
$wine_bin reg add 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices' /v 'bridge' /d 'C:\windows\bridge.exe' /f >/dev/null 2>&1
}
uninstall()
{
rm -v "$windows_dir/bridge.exe"
$wine_bin reg delete 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices' /v 'bridge.exe' /f >/dev/null 2>&1
}
$action