-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·57 lines (43 loc) · 1.42 KB
/
install.sh
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
#!/usr/bin/env bash
launch_agent="$HOME/Library/LaunchAgents/com.dfb.fsd.plist"
app_path="/Applications/dfb.app"
bins_path="$app_path/Contents/Resources/bin"
symlink_target="/usr/local/bin"
if [ -f $launch_agent ]; then
launchctl stop $launch_agent
launchctl unload $launch_agent
fi
if [ -d $app_path ]; then
echo "removing old version"
rm -r $app_path
fi
printf "moving files... "
mv dfb.app /Applications
if [ -f "$symlink_target/dfb" ]; then
rm "$symlink_target/dfb"
fi
if [ -f "$symlink_target/dfb-progress-parser" ]; then
rm "$symlink_target/dfb-progress-parser"
fi
if [ -f "$symlink_target/dfb-progress-parser-gui" ]; then
rm "$symlink_target/dfb-progress-parser-gui"
fi
if [ -f "$symlink_target/dfb-stats" ]; then
rm "$symlink_target/dfb-stats"
fi
if [ -f "$symlink_target/dfb-fsd" ]; then
rm "$symlink_target/dfb-fsd"
fi
ln -s "$bins_path/dfb" "$symlink_target/dfb"
ln -s "$bins_path/dfb-progress-parser" "$symlink_target/dfb-progress-parser"
ln -s "$bins_path/dfb-progress-parser-gui" "$symlink_target/dfb-progress-parser-gui"
ln -s "$bins_path/dfb-stats" "$symlink_target/dfb-stats"
ln -s "$bins_path/dfb-fsd" "$symlink_target/dfb-fsd"
if [ ! -d "$HOME/.dfb.logs" ]; then
echo "creating logs directory at $HOME/.dfb.logs"
mkdir "$HOME/.dfb.logs"
fi
home=$(echo $HOME | sed 's_/_\\/_g')
sed -e "s/~/$home/g" resources/dfb-fsd.plist > $launch_agent
launchctl load $launch_agent
echo "done."