forked from omgmog/install-all-firefox
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirefoxes.sh
More file actions
executable file
·49 lines (40 loc) · 1.42 KB
/
Copy pathfirefoxes.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.42 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
#!/bin/bash
default_github_user=boretom
if [[ "${GITHUB_USER}x" == "x" ]]; then
echo -e "GITHUB_USER environment variable not set. Use default user '${default_github_user}'."
GITHUB_USER=$default_github_user
fi
echo -e "Use ${GITHUB_USER}'s github repository as source"
main () {
local remote_dir="https://raw.githubusercontent.com/${GITHUB_USER}/install-all-firefox/master/"
local temp_dir="/tmp/"
local output_dir="${temp_dir}firefoxes/"
local script_name="install-all-firefox.sh"
local remote_script="${remote_dir}${script_name}"
local local_script="${temp_dir}${script_name}"
local script_output="${output_dir}${script_name}"
local existing_script_md5=""
local remote_script_md5=""
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "This script is designed to be used on OS X only."
echo "Exiting..."
exit 1
fi
mkdir -p "${output_dir}"
if [[ -e "${script_output}" ]]; then
existing_script_md5="$(md5 -q "${script_output}")"
fi
if curl -L "${remote_script}" -o "${local_script}"; then
remote_script_md5="$(md5 -q "${local_script}")"
fi
if [[ "${existing_script_md5}" != "${remote_script_md5}" ]]; then
mv "${local_script}" "${script_output}"
chmod +x "${script_output}"
fi
if [[ "$@" == "" ]]; then
sh "${script_output}" "status"
else
sh "${script_output}" "$@"
fi
}
main "$@"