forked from omgmog/install-all-firefox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.sh
executable file
·53 lines (43 loc) · 1.69 KB
/
bootstrap.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
#!/bin/bash
readonly PROGNAME=$(basename $0)
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 script_name="firefoxes.sh"
local temp_dir="/tmp/"
local remote_script="${remote_dir}${script_name}"
local local_script="${temp_dir}${script_name}"
local choice_made=0
local current_dir="${PWD}/"
echo -e "You should be using ${script_name} not ${PROGNAME}."
echo -e "I'll download the new script for you now."
if curl -L "${remote_script}" -o "${local_script}"; then
echo -e "Successfully downloaded ${script_name} to ${local_script}"
chmod +x "${local_script}"
echo -e "Do you want to copy ${local_script} to your current directory?"
read user_choice
while [[ "${choice_made}" < 1 ]]; do
case "$(echo ${user_choice} | tr '[:upper:]' '[:lower:]')" in
"y" | "yes")
choice_made=1
echo -e "Copying ${script_name} to ${current_dir}"
cp "${local_script}" "${current_dir}${script_name}"
;;
"n" | "no")
choice_made=1
echo -e "Okay, I'll leave it in ${local_script}"
;;
*)
echo -e "Please enter 'y' or 'n'."
read user_choice
;;
esac
done
fi
}
main "$@"