-
Notifications
You must be signed in to change notification settings - Fork 0
/
vg.sh
executable file
·39 lines (35 loc) · 996 Bytes
/
vg.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
#!/bin/bash
# Secret command of uninstalling
if [[ $1 == "uninstall" ]]
then printf "are you sure? (y/n) "
read -n 1 ans
# Confirmation of uninstalling
if [[ $ans == "y" ]]
then printf "\nuninstalling...\n"
rm -rf /usr/local/lib/vg
rm /usr/local/bin/vg
echo "uninstalled!"
else printf "\naborted!\n"
fi
exit 0
fi
# Secret command of upgrading the version
if [[ $1 == "upgrade" ]]
then echo "uninstalling current version..."
SAVE_CONFIG=$(cat /usr/local/lib/vg/config.json)
rm -rf /usr/local/lib/vg
rm /usr/local/bin/vg
echo "clonning new version..."
git clone https://github.com/Vicente-G/vg-cli.git /usr/local/lib/vg
rm /usr/local/lib/vg/setup.sh \
/usr/local/lib/vg/README.md \
/usr/local/lib/vg/.gitignore
rm -rf /usr/local/lib/vg/.git
mv /usr/local/lib/vg/vg.sh /usr/local/bin/vg.sh
cd /usr/local/bin
mv vg.sh vg ; cd
chmod +x /usr/local/bin/vg
echo $SAVE_CONFIG > /usr/local/lib/vg/config.json
echo "newer version of CLI succesfully upgraded!"
fi
python3 /usr/local/lib/vg/src/cli.py $@