←︎ tools :: 4baa2a5


1
commit 4baa2a56ecc4b338744f59e9c43664fbb5fec81e
2
Author: acidvegas <acid.vegas@acid.vegas>
3
Date:   Mon Aug 19 20:45:13 2019 -0400
4
5
    update
6
---
7
 deploy-anope      | 13 ++++++-------
8
 deploy-unrealircd | 49 ++++++++++++++++++++++++++-----------------------
9
 monitor           |  2 +-
10
 startbots         | 13 ++++++++-----
11
 4 files changed, 41 insertions(+), 36 deletions(-)
12
13
diff --git a/deploy-anope b/deploy-anope
14
index beffeb2..477d08c 100755
15
--- a/deploy-anope
16
+++ b/deploy-anope
17
@@ -1,20 +1,21 @@
18
 #!/bin/sh
19
 set -xev
20
 
21
+CURRENT='2.0.6'
22
 ANOPE=$HOME/services
23
 BACKUP=$HOME/services.backup
24
 SOURCE=$HOME/services.source
25
 
26
-setup() {
27
-	git clone --depth 1 https://github.com/supernets/anope.git $SOURCE
28
-	cd $SOURCE && $SOURCE/Config -nointro -quick && make && make install && cd $HOME && rm -rf $SOURCE
29
-}
30
-
31
 deploy() {
32
 	setup
33
 	#todo: edit services.conf here
34
 }
35
 
36
+setup() {
37
+	git clone --depth 1 https://github.com/supernets/anope.git $SOURCE
38
+	cd $SOURCE && $SOURCE/Config -nointro -quick && make && make install && cd $HOME && rm -rf $SOURCE
39
+}
40
+
41
 update() {
42
 	[ ! -z $(screen -ls | grep ircdwatchdog) ] && screen -S ircdwatchdog -X quit #todo: check & kill abduco watchdog process
43
 	mkdir $BACKUP
44
@@ -33,8 +34,6 @@ watchdog() {
45
 		abduco -fnr ircdwatchdog     bash -c "while true; do [ ! -f $HOME/services/data/services.pid ] && $HOME/services/bin/services; sleep 15; done"
46
 	elif command -v screen >/dev/null 2>&1; then
47
 		screen -S   ircdwatchdog -dm bash -c "while true; do [ ! -f $HOME/services/data/services.pid ] && $HOME/services/bin/services; sleep 15; done"
48
-	else
49
-		echo "[!] - install abduco or screen"
50
 	fi
51
 }
52
 
53
diff --git a/deploy-unrealircd b/deploy-unrealircd
54
index ab75880..49831d4 100755
55
--- a/deploy-unrealircd
56
+++ b/deploy-unrealircd
57
@@ -1,28 +1,10 @@
58
 #!/bin/sh
59
 set -xev
60
 
61
+CURRENT='4.2.4.1'
62
+BACKUP=$HOME/unrealircd.backup
63
+SOURCE=$HOME/unrealircd.source
64
 UNREAL=$HOME/unrealircd
65
-BACKUP=$UNREAL.backup
66
-SOURCE=$UNREAL.source
67
-
68
-#LATEST=$(curl -s https://www.unrealircd.org/downloads/list.json | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^version/ {print $2}' | sed 's/\(^"\|"$\)//g')
69
-
70
-update_source() {
71
-	wget -O $SOURCE.tar.gz https://www.unrealircd.org/downloads/unrealircd-latest.tar.gz
72
-	tar -xvf $SOURCE.tar.gz --one-top-level --strip-components=1
73
-	rm $SOURCE.tar.gz
74
-	sed -i 's/NICKNAMEHISTORYLENGTH="2000"/NICKNAMEHISTORYLENGTH="100"/g' $SOURCE/Config
75
-	sed -i 's/REMOTEINC=""/REMOTEINC="1"/g' $SOURCE/Config
76
-	sed -i 's/PREFIXAQ="1"/PREFIXAQ="0"/g' $SOURCE/Config
77
-	sed -i 's/SHOWLISTMODES="1"/SHOWLISTMODES="0"/g' $SOURCE/Config
78
-	sed -i 's;//#undef FAKELAG_CONFIGURABLE;#define FAKELAG_CONFIGURABLE;g' $SOURCE/include/config.h
79
-	sed -i 's_\t\t\tsendnotice(acptr, "*** You were forced to join %s", jbuf);_\t\t\t//sendnotice(acptr, "*** You were forced to join %s", jbuf);_g' $SOURCE/src/modules/m_sapart.c
80
-	rm -r $SOURCE/doc/conf/aliases $SOURCE/doc/conf/examples $SOURCE/doc/conf/help
81
-	rm -r $SOURCE/doc/conf/*.conf
82
-	cp $HOME/dev/git/supernets/unrealircd/doc/conf/*.conf $SOURCE/doc/conf/
83
-	cp $HOME/dev/git/supernets/unrealircd/src/ssl.cnf $SOURCE/src/ssl.cnf
84
-	echo "edit your Makefile.in"
85
-}
86
 
87
 deploy() {
88
 	git clone --depth 1 https://github.com/supernets/unrealircd.git $SOURCE
89
@@ -39,6 +21,11 @@ deploy() {
90
 	$UNREAL/unrealircd start &
91
 }
92
 
93
+latest() {
94
+	local LATEST=$(curl -s https://www.unrealircd.org/downloads/list.json | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^version/ {print $2}' | sed 's/\(^"\|"$\)//g')
95
+	[ $LATEST != $CURRENT ] && echo "new version available: $LATEST"
96
+}
97
+
98
 update() {
99
 	[ ! -z $(screen -ls | grep ircdwatchdog) ] && screen -S ircdwatchdog -X quit
100
 	[ ! -z $(abduco     | grep ircdwatchdog) ] && pkill -9 $(abduco | grep ircdwatchdog | awk '{print $4}')
101
@@ -55,16 +42,32 @@ update() {
102
 	watchdog
103
 }
104
 
105
+update_source() {
106
+	wget -O $SOURCE.tar.gz https://www.unrealircd.org/downloads/unrealircd-latest.tar.gz
107
+	tar -xvf $SOURCE.tar.gz --one-top-level --strip-components=1
108
+	rm $SOURCE.tar.gz
109
+	sed -i 's/NICKNAMEHISTORYLENGTH="2000"/NICKNAMEHISTORYLENGTH="100"/g' $SOURCE/Config
110
+	sed -i 's/REMOTEINC=""/REMOTEINC="1"/g' $SOURCE/Config
111
+	sed -i 's/PREFIXAQ="1"/PREFIXAQ="0"/g' $SOURCE/Config
112
+	sed -i 's/SHOWLISTMODES="1"/SHOWLISTMODES="0"/g' $SOURCE/Config
113
+	sed -i 's;//#undef FAKELAG_CONFIGURABLE;#define FAKELAG_CONFIGURABLE;g' $SOURCE/include/config.h
114
+	sed -i 's_\t\t\tsendnotice(acptr, "*** You were forced to join %s", jbuf);_\t\t\t//sendnotice(acptr, "*** You were forced to join %s", jbuf);_g' $SOURCE/src/modules/m_sapart.c
115
+	rm -r $SOURCE/doc/conf/aliases $SOURCE/doc/conf/examples $SOURCE/doc/conf/help
116
+	rm -r $SOURCE/doc/conf/*.conf
117
+	cp $HOME/dev/git/supernets/unrealircd/doc/conf/*.conf $SOURCE/doc/conf/
118
+	cp $HOME/dev/git/supernets/unrealircd/src/ssl.cnf $SOURCE/src/ssl.cnf
119
+	echo "edit your Makefile.in"
120
+}
121
+
122
 watchdog() {
123
 	if command -v abduco >/dev/null 2>&1; then
124
 		abduco -fnr ircdwatchdog     bash -c "while true; do [ ! -f $HOME/unrealircd/data/unrealircd.pid ] && $HOME/unrealircd/unrealircd start; sleep 15; done"
125
 	elif command -v screen >/dev/null 2>&1; then
126
 		screen -S   ircdwatchdog -dm bash -c "while true; do [ ! -f $HOME/unrealircd/data/unrealircd.pid ] && $HOME/unrealircd/unrealircd start; sleep 15; done"
127
-	else
128
-		echo "[!] - install abduco or screen"
129
 	fi
130
 }
131
 
132
 [ $1 = "deploy"   ] && deploy   && exit 1
133
+[ $1 = "latest"   ] && latest   && exit 1
134
 [ $1 = "update"   ] && update   && exit 1
135
 [ $1 = "watchdog" ] && watchdog && exit 1
136
diff --git a/monitor b/monitor
137
index fe4cbf1..e78c2a6 100755
138
--- a/monitor
139
+++ b/monitor
140
@@ -1,7 +1,7 @@
141
 #!/bin/sh
142
 while true; do
143
 	for i in $(dig irc.supernets.org A irc.supernets.org AAAA +short); do
144
-		ping -c 1 $i &> /dev/null
145
+		ping -c 1 $i 2>&1 >/dev/null
146
 		[ $? -ne 0 ] && echo "`date`: ping failed! ($i)" #&& notify-send "`date`: ping failed! ($i)"
147
 		sleep 1
148
 	done
149
diff --git a/startbots b/startbots
150
index 57dee8a..85a016c 100755
151
--- a/startbots
152
+++ b/startbots
153
@@ -17,10 +17,10 @@ get() {
154
 	wget -O $HOME/bots/5000.py https://raw.githubusercontent.com/acidvegas/trollbots/master/5000.py
155
 	mkdir -P $HOME/bots/anythinggoes/data
156
 	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/anythinggoes.py
157
-	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/banana.txt
158
-	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crab.txt
159
-	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crate.txt
160
-	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/worms.txt
161
+	wget -O $HOME/bots/anythinggoes/data/banana.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/banana.txt
162
+	wget -O $HOME/bots/anythinggoes/data/crab.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crab.txt
163
+	wget -O $HOME/bots/anythinggoes/data/crate.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crate.txt
164
+	wget -O $HOME/bots/anythinggoes/data/worms.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/worms.txt
165
 	wget -O $HOME/bots/cancer.py https://raw.githubusercontent.com/acidvegas/random/master/irc/cancer.py
166
 	git clone --depth 1 https://github.com/acidvegas/dickserv.git $HOME/bots/dickserv
167
 	mkdir $HOME/bots/irccex
168
@@ -31,4 +31,7 @@ get() {
169
 	rm -r $HOME/bots/scroll/scroll/data/art
170
 	git clone --depth 1 https://github.com/ircart/ircart.git $HOME/bots/scroll/scroll/data/art
171
 	wget -O $HOME/bots/spiderweb.py https://raw.githubusercontent.com/acidvegas/trollbots/master/spiderweb.py
172
-}
173
+}
174
+
175
+[ $1 = "start" ] && start && exit 1
176
+[ $1 = "get"   ] && get   && exit 1