@cryptotaxi247 / netdata-1 / commits / cfb9800f7

netdata-installer.sh banner is not a snake; fixes #1023

Costa Tsaousis (ktsaou) committed Sep 26, 2016 at 02:10 UTC cfb9800f7b56ea515adf5169a99e1db76bb31e78
1 file changed +46 -37
netdata-installer.sh
+46 -37
@@ -28,6 +28,29 @@ printf "\n" >>netdata-installer.log
28 REINSTALL_PWD="${PWD}"
29 REINSTALL_COMMAND="$(printf "%q " "$0" "${@}"; printf "\n")"
30
31 +banner() {
32 + local l1=" ^" \
33 + l2=" |.-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-" \
34 + l3=" | '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' " \
35 + l4=" +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->" \
36 + sp=" " \
37 + netdata="netdata" start end msg="${*}"
38 +
39 + [ ${#msg} -lt ${#netdata} ] && msg="${msg}${sp:0:$(( ${#netdata} - ${#msg}))}"
40 + [ ${#msg} -gt $(( ${#l2} - 20 )) ] && msg="${msg:0:$(( ${#l2} - 23 ))}..."
41 +
42 + start="$(( ${#l2} / 2 - 4 ))"
43 + [ $(( start + ${#msg} + 4 )) -gt ${#l2} ] && start=$((${#l2} - ${#msg} - 4))
44 + end=$(( ${start} + ${#msg} + 4 ))
45 +
46 + echo >&2
47 + echo >&2 "${l1}"
48 + echo >&2 "${l2:0:start}${sp:0:2}${netdata}${sp:0:$((end - start - 2 - ${#netdata}))}${l2:end:$((${#l2} - end))}"
49 + echo >&2 "${l3:0:start}${sp:0:2}${msg}${sp:0:2}${l3:end:$((${#l2} - end))}"
50 + echo >&2 "${l4}"
51 + echo >&2
52 +}
53 +
54 service="$(which service 2>/dev/null || command -v service 2>/dev/null)"
55 systemctl="$(which systemctl 2>/dev/null || command -v systemctl 2>/dev/null)"
56 service() {
@@ -52,6 +75,7 @@ NETDATA_PREFIX=
75 LIBS_ARE_HERE=0
76
77 usage() {
78 + banner "installer command line options"
79 cat <<USAGE
80
81 ${ME} <installer options>
@@ -177,26 +201,24 @@ do
201 fi
202 done
203
204 +banner "real-time performance monitoring, done right!"
205 cat <<BANNER
206
182 -Welcome to netdata!
183 -The real-time performance monitoring system.
184 -
185 -You are about to build and install netdata to your system.
207 + You are about to build and install netdata to your system.
208
187 -It will be installed at these locations:
209 + It will be installed at these locations:
210
189 - - the daemon at ${NETDATA_PREFIX}/usr/sbin/netdata
190 - - config files at ${NETDATA_PREFIX}/etc/netdata
191 - - web files at ${NETDATA_PREFIX}/usr/share/netdata
192 - - plugins at ${NETDATA_PREFIX}/usr/libexec/netdata
193 - - cache files at ${NETDATA_PREFIX}/var/cache/netdata
194 - - db files at ${NETDATA_PREFIX}/var/lib/netdata
195 - - log files at ${NETDATA_PREFIX}/var/log/netdata
196 - - pid file at ${NETDATA_PREFIX}/var/run
211 + - the daemon at ${NETDATA_PREFIX}/usr/sbin/netdata
212 + - config files at ${NETDATA_PREFIX}/etc/netdata
213 + - web files at ${NETDATA_PREFIX}/usr/share/netdata
214 + - plugins at ${NETDATA_PREFIX}/usr/libexec/netdata
215 + - cache files at ${NETDATA_PREFIX}/var/cache/netdata
216 + - db files at ${NETDATA_PREFIX}/var/lib/netdata
217 + - log files at ${NETDATA_PREFIX}/var/log/netdata
218 + - pid file at ${NETDATA_PREFIX}/var/run
219
198 -This installer allows you to change the installation path.
199 -Press Control-C and run the same command with --help for help.
220 + This installer allows you to change the installation path.
221 + Press Control-C and run the same command with --help for help.
222
223 BANNER
224
@@ -204,6 +226,7 @@ if [ "${UID}" -ne 0 ]
226 then
227 if [ -z "${NETDATA_PREFIX}" ]
228 then
229 + banner "wrong command line options!"
230 cat <<NONROOTNOPREFIX
231
232 Sorry! This will fail!
@@ -276,6 +299,7 @@ then
299 then
300 echo "Will skip autoreconf step"
301 else
302 + banner "autotools v2.60 required"
303 cat <<"EOF"
304
305 -------------------------------------------------------------------------------
@@ -309,11 +333,12 @@ if [ ${DONOTWAIT} -eq 0 ]
333 fi
334
335 build_error() {
336 + banner "sorry, it failed to build..."
337 cat <<EOF
338
339 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
340
316 -Sorry! NetData failed to build...
341 +Sorry! netdata failed to build...
342
343 You many need to check these:
344
@@ -673,17 +698,8 @@ if [ ${DONOTSTART} -eq 1 ]
698 fi
699 chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
700 fi
676 - cat >&2 <<"DONE1"
677 -
678 -
679 - ^
680 - |.-. .-. .-. .-. .-. netdata .-. .-. .-. .-
681 - | '-' '-' '-' '-' ' is installed now! '-' '-' '-'
682 - +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->
683 -
684 - enjoy real-time performance and health monitoring...
685 -
686 -DONE1
701 + banner "is installed now!"
702 + echo >&2 " enjoy real-time performance and health monitoring..."
703 exit 0
704 fi
705
@@ -1202,14 +1218,7 @@ elif [ -f "netdata-updater.sh" ]
1218 rm "netdata-updater.sh"
1219 fi
1220
1205 -cat >&2 <<"DONE"
1206 -
1207 - ^
1208 - |.-. .-. .-. .-. .-. netdata .-. .-
1209 - | '-' '-' '-' '-' ' is installed and running now! '-'
1210 - +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->
1211 -
1212 - enjoy real-time performance and health monitoring...
1213 -
1214 -DONE
1221 +banner "is installed and running now!"
1222 +echo >&2 " enjoy real-time performance and health monitoring..."
1223 +echo >&2
1224 exit 0