-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboot
51 lines (45 loc) · 1.31 KB
/
boot
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
#!/bin/bash
#? Description:
#? Bootstrap script for xsh.
#?
#? Usage:
#? boot [OPTION]
#?
#? Option:
#? [-f]
#? Force to uninstall xsh before to install it.
#? This is default option.
#?
#? [-s]
#? Skip the step to upgrade xsh to the latest stable version.
#? This lets the installation reflect the exact status of the installing files.
#? Use this option to test the project.
#?
#? [-b BRANCH]
#? Upgrade xsh to the BRANCH's latest state.
#? This option is ignored if `-s` presents.
#? Use this option to test the project on a specific branch.
#?
#? [-u]
#? Uninstall xsh from your environment.
#? All the loaded libraries will be removed along with xsh.
#?
#? [-h]
#? This help.
#?
#? Example:
#? curl -s https://raw.githubusercontent.com/alexzhangs/xsh/master/boot | bash && . ~/.xshrc
#? curl -s https://raw.githubusercontent.com/alexzhangs/xsh/master/boot | bash -s -- -s && . ~/.xshrc
#? curl -s https://raw.githubusercontent.com/alexzhangs/xsh/master/boot | bash -s -- -b <BRANCH> && . ~/.xshrc
#?
# exit on any error
set -e -o pipefail
declare repo='https://github.com/alexzhangs/xsh'
declare cmds=(bash install.sh -f "$@")
declare clonedir=/tmp/xsh-${RANDOM}
# never use a shallow clone here
git clone "${repo}" "${clonedir}"
cd "${clonedir}"
"${cmds[@]}"
rm -rf "${clonedir}"
exit