-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_install.sh
86 lines (68 loc) · 2.03 KB
/
app_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
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
#!/usr/bin/env bash
set -e
# Function to check whether applications are installed
check_firefox_installed () {
if [ -d "/Applications/Firefox.app" ]
then
echo "Firefox is installed"
echo "----------------------"
return 0
else
echo "Firefox isn't installed"
echo "----------------------"
return 1
fi
}
check_discord_installed () {
if [ -d "/Applications/Discord.app" ]
then
echo "Discord is installed"
echo "----------------------"
return 0
else
echo "Discord isn't installed"
echo "----------------------"
return 1
fi
}
firefox_install () {
echo "Installing Firefox..."
# Download Firefox dmg file
echo "Downloading Firefox..."
curl -sL -o /tmp/firefox.dmg "https://download.mozilla.org/?product=firefox-latest-ssl&os=osx&lang=en-US"
# Mount the dmg file
echo "Mounting Firefox image..."
hdiutil attach /tmp/firefox.dmg -nobrowse -quiet
# Copy Firefox to Applications/
echo "Copying Firefox to Applications..."
cp -R "/Volumes/Firefox/Firefox.app" /Applications/
# Unmount the dmg file
echo "Unmounting Firefox image"
hdiutil detach "/Volumes/Firefox" -quiet
echo "Firefox installation complete..."
echo "----------------------------------"
}
discord_install () {
echo "Installing Discord..."
# Download Discord dmg file
echo "Downloading Discord imagine..."
curl -sL -o /tmp/discord.dmg "https://discord.com/api/download?platform=osx"
# Mount the dmg file
echo "Mounting Discord imagine..."
hdiutil attach /tmp/discord.dmg -nobrowse -quiet
# Copy Discord to Applications/
echo "Copying Discord to Applications"
cp -R "/Volumes/Discord/Discord.app" /Applications/
# Unmount the dmg file
echo "Unmounting Discord imagine"
hdiutil detach "/Volumes/Discord" -quiet
echo "Discord installation complete..."
}
if ! check_firefox_installed
then
firefox_install
fi
if ! check_discord_installed
then
discord_install
fi