forked from fusion809/vscode-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquick-install.sh
executable file
·100 lines (79 loc) · 3.3 KB
/
quick-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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# This is a quick install script to install VSCode ASAP
export lowedit=vscode
export REPO=https://github.com/fusion809/${lowedit}-installer
export UPSRC=https://github.com/Microsoft/${lowedit}
export GHUB=$HOME/GitHub
export GHUBM=$HOME/GitHub/mine
if ! [[ -d $GHUB ]]; then
mkdir $GHUB
fi
###########################################################################################################################################
# Get the ${lowedit}-installer repo if not present and update it, if not.
if [[ -d $GHUBM ]]; then
cd $GHUBM
if ! [[ -d $GHUBM/${lowedit}-installer ]]; then # Get the repository, if necessary
printf "Getting the ${lowedit}-installer repository locally. ==>\n"
## git
if which git >/dev/null 2>&1; then
git clone $REPO $GHUBM/${lowedit}-installer
## cURL
elif which curl >/dev/null 2>&1; then
curl -sL $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUBM
## wget
elif which wget >/dev/null 2>&1; then
wget -cqO- $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUBM
fi
else
printf "Updating your local copy of ${lowedit}-installer. ==>\n"
## git
if [[ -d $GHUBM/${lowedit}-installer/.git ]]; then
cd $GHUBM/${lowedit}-installer
git pull origin master
cd .
## cURL
elif which curl >/dev/null 2>&1; then
rm -rf $GHUBM/${lowedit}-installer
curl -sL $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUBM
## wget
elif which wget >/dev/null 2>&1; then
rm -rf $GHUBM/${lowedit}-installer
wget -cqO- $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUBM
fi
fi
cd $GHUBM/${lowedit}-installer
./installer.sh
else
cd $GHUB
if ! [[ -d $GHUB/${lowedit}-installer ]]; then # Get the repository, if necessary
printf "Getting the ${lowedit}-installer repository locally. ==>\n"
## git
if which git >/dev/null 2>&1; then
git clone $REPO $GHUB/${lowedit}-installer
## cURL
elif which curl >/dev/null 2>&1; then
curl -sL $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUB
## wget
elif which wget >/dev/null 2>&1; then
wget -cqO- $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUB
fi
else
printf "Updating your local copy of ${lowedit}-installer. ==>\n"
## git
if [[ -d $GHUB/${lowedit}-installer/.git ]]; then
cd $GHUB/${lowedit}-installer
git pull origin master
cd .
## cURL
elif which curl >/dev/null 2>&1; then
rm -rf $GHUB/${lowedit}-installer
curl -sL $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUB
## wget
elif which wget >/dev/null 2>&1; then
rm -rf $GHUB/${lowedit}-installer
wget -cqO- $REPO/archive/master.tar.gz | tar xz --transform=s/${lowedit}-installer-master/${lowedit}-installer/ -C $GHUB
fi
fi
cd $GHUB/${lowedit}-installer
./installer.sh
fi