-
Notifications
You must be signed in to change notification settings - Fork 13
/
znc-install.sh
executable file
·164 lines (160 loc) · 4.82 KB
/
znc-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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
# znc-install
scriptversion="0.5.0"
scriptname="znc-install"
# adamaze
#
# wget -qO ~/znc-install.sh http://git.io/hrKo && bash ~/znc-install.sh
#
############################
#### Script Notes Start ####
############################
#
# Todo:
# add configuring help?
#
############################
##### Script Notes End #####
############################
#
############################
## Version History Starts ##
############################
#
# 0.5.0 - initial commit
#
############################
### Version History Ends ###
############################
#
############################
###### Variable Start ######
############################
#
updaterenabled="0"
#
scripturl="https://raw.githubusercontent.com/frankthetank7254/feral/master/znc-install.sh"
#
############################
####### Variable End #######
############################
#
############################
#### Self Updater Start ####
############################
#
if [[ "$updaterenabled" -eq 1 ]]
then
[[ ! -d ~/bin ]] && mkdir -p ~/bin
[[ ! -f ~/bin/"$scriptname" ]] && wget -qO ~/bin/"$scriptname" "$scripturl"
#
wget -qO ~/.000"$scriptname" "$scripturl"
#
if [[ $(sha256sum ~/.000"$scriptname" | awk '{print $1}') != $(sha256sum ~/bin/"$scriptname" | awk '{print $1}') ]]
then
echo -e "#!/bin/bash\nwget -qO ~/bin/$scriptname $scripturl\ncd && rm -f $scriptname{.sh,}\nbash ~/bin/$scriptname\nexit" > ~/.111"$scriptname"
bash ~/.111"$scriptname"
exit
else
if [[ -z $(ps x | fgrep "bash $HOME/bin/$scriptname" | grep -v grep | head -n 1 | awk '{print $1}') && $(ps x | fgrep "bash $HOME/bin/$scriptname" | grep -v grep | head -n 1 | awk '{print $1}') -ne "$$" ]]
then
echo -e "#!/bin/bash\ncd && rm -f $scriptname{.sh,}\nbash ~/bin/$scriptname\nexit" > ~/.222"$scriptname"
bash ~/.222"$scriptname"
exit
fi
fi
cd && rm -f .{000,111,222}"$scriptname"
chmod -f 700 ~/bin/"$scriptname"
else
echo
echo "The Updater has been disabled"
fi
#
############################
##### Self Updater End #####
############################
#
############################
#### Core Script Starts ####
############################
#
#echo
#echo -e "Hello $(whoami), you have the latest version of the" "\033[36m""$scriptname""\e[0m" "script. This script version is:" "\033[31m""$scriptversion""\e[0m"
#echo
#read -ep "The script has been updated, enter [y] to continue or [q] to exit: " -i "y" updatestatus
#echo
#if [[ "$updatestatus" =~ ^[Yy]$ ]]
#then
#
############################
#### User Script Starts ####
############################
#
echo
REPLY="n"
read -p "Do you need the extra charset available in ZNC? (This is for non-english characters) [y/N]" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
if [ "$(dpkg-query -s libicu-dev 2>&1 | grep -c 'ok installed')" -eq 0 ]; then
echo -e "\033[33m""It looks like libicu-dev is not installed on your server.""\e[0m"
echo -e Please open a ticket: "\033[34m"https://www.feralhosting.com/manager/tickets/new"\e[0m"
echo "Paste the following into the ticket:"
echo
echo "Please can you install the ZNC 1.6 dependancy for charset
https://packages.debian.org/wheezy/libicu-dev
apt-get install libicu-dev
Thank you."
echo
echo -e "\033[33m""Once you are notified that the dependancy has been installed, you can re-run this script""\e[0m"
exit
fi
fi
echo -e "\033[33m""This script will download and install znc on your slot. It may take a few minutes...""\e[0m"
sleep 3
mkdir -p ~/bin
wget -qO ~/znc.tar.gz http://znc.in/releases/znc-latest.tar.gz
cd ~/
tar xf ~/znc.tar.gz && cd ~/znc-1.*
./configure --prefix=$HOME
make && make install
cd && rm -rf znc{-1.*,.tar.gz}
echo
echo -e "\033[33m""\nNow it is time for initial configuration...""\e[0m"
echo
~/bin/znc --makeconf
#
echo -e "\033[33m""\nNow that ZNC has been installed, configured, and started, we will make sure it starts if/when your server reboots.""\e[0m"
#
# adding to cron
tmpcron=$(mktemp)
if [ "$(crontab -l 2> /dev/null | grep -c znc)" == "0" ]; then
echo "appending znc to crontab."
crontab -l 2> /dev/null > "$tmpcron"
echo "@reboot ~/bin/znc" >> "$tmpcron"
crontab "$tmpcron"
rm "$tmpcron"
else
echo "znc is already in crontab"
fi
# give user the full URL
echo -e "\nClick on the URL below to do additional configuration if needed"
echo -e "\033[33m""https://$(hostname -f):$(grep Port ~/.znc/configs/znc.conf | awk '{print $3}')""\e[0m"
echo -e "\nSearch the ZNC wiki for help connecting with different clients. http://wiki.znc.in/"
#
#
############################
##### User Script End #####
############################
#
#else
# echo -e "You chose to exit after updating the scripts."
# echo
# cd && bash
# exit 1
#fi
#
############################
##### Core Script Ends #####
############################
#