This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ct_installer
42 lines (42 loc) · 1.83 KB
/
ct_installer
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
#!/bin/bash
if [ -z $1 ]; then
echo "Usage: 'ct_installer COMMAND'"
echo "To install run 'ct_instaler install'"
echo "To install to a custom location, run 'ct_installer install_to LOCATION'"
echo "To update the installer call 'ct_installer update_installer'"
return
fi
COMMAND=$1
shift
case $COMMAND in
'install')
source ct_installer install_to ~/.commandstool/ct ;;
'install_to')
read -n1 -p "Are you sure you want to do this? [y/n]:" call_safetey && echo
if [ "$call_safetey" = "y" ]; then
commandstool uninstall &> /dev/null # If commandstool was installed before, remove it.
sed -n '/'1495246'/!p' ~/.bashrc >> ~/.tmp_bashrc && mv ~/.tmp_bashrc ~/.bashrc &> /dev/null
mkdir -p `dirname $1`
wget -O $1 https://raw.githubusercontent.com/AdrianVovk/BashCommands/master/commandstool &> /dev/null
chmod +x $1
mkdir ~/.commandstool &> /dev/null
mkdir ~/.commandstool/config &> /dev/null
echo $1 > ~/.commandstool/config/script_location
source $1 init_ct
echo "source $1 init_ct \#1495246 CommandsTool" >> ~/.bashrc
commandstool test_install
update_bash
else
echo Abort Installation
fi
;;
'update_installer')
rm ct_installer
wget https://raw.githubusercontent.com/AdrianVovk/BashCommands/master/ct_installer
chmod +rwx ct_installer
source ct_installer
;;
*)
echo "Invalid command"
;;
esac