forked from Ekultek/WhatWaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·69 lines (63 loc) · 2.02 KB
/
setup.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
#!/bin/bash
function helpPage {
echo -e "\n./setup.sh {install|remove}\n";
}
function install {
home="$HOME/.whatwaf";
exec_dir="$home/.install/bin";
exec_filename="$exec_dir/whatwaf"
copy_dir="$home/.install/etc";
mkdir $home;
mkdir $home/.install
mkdir $exec_dir;
mkdir $copy_dir;
chmod +x ./whatwaf.py
echo "copying files over..";
rsync -drq . $copy_dir
echo "creating executable";
cat << EOF > $exec_filename
#!/bin/bash
# this is the execution script for whatwaf
# created by the whatwaf installer on $(date +%F)
cd $copy_dir
exec python whatwaf.py \$@
EOF
echo "editing file stats";
chmod +x $exec_filename;
echo "export PATH=\"$PATH:$exec_dir\"" >> $HOME/.bash_profile;
echo "installed, you need to run: source ~/.bash_profile";
}
function uninstall {
rm -rf ~/.whatwaf
echo "home directory removed, manually remove the export PATH pertaining to $HOME/.whatwaf/bin"
}
function main {
if [[ "$1" == "install" ]]; then
echo -e " Installing:";
echo -e " ,------. ";
echo -e " ' .--. '";
echo -e " ,--. .--. ,--. .--.| | | |";
echo -e " | | | | | | | |'--' | |";
echo -e " | | | | | | | | __. |";
echo -e " | |.'.| | | |.'.| | | .' ";
echo -e " | | | | |___| ";
echo -e " | ,'. |hat| ,'. |af .---. ";
echo -e " '--' '--' '--' '--' '---' ";
install;
elif [[ "$1" == "remove" ]]; then
echo -e " Uninstalling:";
echo -e " ,------. ";
echo -e " ' .--. '";
echo -e " ,--. .--. ,--. .--.| | | |";
echo -e " | | | | | | | |'--' | |";
echo -e " | | | | | | | | __. |";
echo -e " | |.'.| | | |.'.| | | .' ";
echo -e " | | | | |___| ";
echo -e " | ,'. |hat| ,'. |af .---. ";
echo -e " '--' '--' '--' '--' '---' ";
uninstall;
else
helpPage;
fi;
}
main $@;