-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
96 lines (96 loc) · 3.27 KB
/
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
#!/bin/bash
#
# Copyright 2016 Abraham Massry
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
#
bashInstall () {
als_set=`grep "alias wsend-gpg=" $HOME/.bashrc`
if [ "$als_set" ]; then
#do nothing
true
else
echo "alias wsend='$HOME/.wsend/wsend'" >> $HOME/.bashrc
echo "alias wsend='$HOME/.wsend/wsend'" >> $HOME/.bash_profile
echo "alias wsend-gpg='$HOME/.wsend/wsend-gpg'" >> $HOME/.bashrc
echo "alias wget-gpg='$HOME/.wsend/wget-gpg'" >> $HOME/.bashrc
echo "alias wsend-gpg='$HOME/.wsend/wsend-gpg'" >> $HOME/.bash_profile
echo "alias wget-gpg='$HOME/.wsend/wget-gpg'" >> $HOME/.bash_profile
fi
}
cshInstall () {
als_set=`grep "alias wsend-gpg=" $HOME/.cshrc`
if [ "$als_set" ]; then
#do nothing
true
else
echo "alias wsend='$HOME/.wsend/wsend'" >> $HOME/.cshrc
echo "alias wsend-gpg='$HOME/.wsend/wsend-gpg'" >> $HOME/.cshrc
echo "alias wget-gpg='$HOME/.wsend/wget-gpg'" >> $HOME/.cshrc
fi
}
kshInstall () {
als_set=`grep "alias wsend-gpg=" $HOME/.kshrc`
if [ "$als_set" ]; then
#do nothing
true
else
echo "alias wsend='$HOME/.wsend/wsend'" >> $HOME/.kshrc
echo "alias wsend-gpg='$HOME/.wsend/wsend-gpg'" >> $HOME/.kshrc
echo "alias wget-gpg='$HOME/.wsend/wget-gpg'" >> $HOME/.kshrc
fi
}
zshInstall () {
als_set=`grep "alias wsend-gpg=" $HOME/.zshrc`
if [ "$als_set" ]; then
#do nothing
true
else
echo "alias wsend='$HOME/.wsend/wsend'" >> $HOME/.zshrc
echo "alias wsend-gpg='$HOME/.wsend/wsend-gpg'" >> $HOME/.zshrc
echo "alias wget-gpg='$HOME/.wsend/wget-gpg'" >> $HOME/.zshrc
fi
}
# check to see if directory exists
if [ -d "$HOME/.wsend" ]; then
wsend_dir="$HOME/.wsend"
else
# if not, install
mkdir $HOME/.wsend
fi # check for directory exists done
#download wsend and put it in directory
wsDL=`curl -s -L -o $HOME/.wsend/wsend https://raw.githubusercontent.com/abemassry/wsend/master/wsend 2>/dev/null`
chmod +x $HOME/.wsend/wsend
newLatestVersionDL=`curl -s -L -o $HOME/.wsend/version https://raw.githubusercontent.com/abemassry/wsend/master/version 2>/dev/null`
#download wsend-gpg and wget-gpg
wsgpgDL=`curl -s -L -o $HOME/.wsend/wsend-gpg https://raw.githubusercontent.com/abemassry/wsend-gpg/master/wsend-gpg 2>/dev/null`
chmod +x $HOME/.wsend/wsend-gpg
wgpgDL=`curl -s -L -o $HOME/.wsend/wget-gpg https://raw.githubusercontent.com/abemassry/wsend-gpg/master/wget-gpg 2>/dev/null`
chmod +x $HOME/.wsend/wget-gpg
#add alias to shell
#execute alias command
if [ $SHELL == "/bin/bash" ]; then
bashInstall
elif [ $SHELL == "/bin/csh" ]; then
cshInstall
elif [ $SHELL == "/bin/tcsh" ]; then
cshInstall
elif [ $SHELL == "/bin/ksh" ]; then
kshInstall
elif [ $SHELL == "/bin/zsh" ]; then
zshInstall
fi # install done
echo ''
echo "done"