Minor armbianmonitor debug info improvements

This commit is contained in:
ThomasKaiser 2017-11-19 18:26:03 +01:00
parent ead8c7e6c6
commit ce884f630d

View File

@ -145,19 +145,28 @@ ParseOptions() {
NetworkMonitorMode ${OPTARG}
exit 0
;;
u|U)
# Upload /var/log/armhwinfo.log to be of help in support forum.
u)
# Upload /var/log/armhwinfo.log with additional support info
fping sprunge.us 2>/dev/null | grep -q alive || \
(echo "Network/firewall problem detected. Please fix this or upload /var/log/armhwinfo.log manually." >&2 ; exit 1)
(echo -e "\nNetwork/firewall problem detected. Not able to upload debug info.\nPlease fix this or use \"-U\" instead and upload ${BOLD}whole output${NC} manually\n" >&2 ; exit 1)
which curl >/dev/null 2>&1 || apt-get -f -qq -y install curl
echo -e "System diagnosis information has been uploaded to \c"
echo -e "System diagnosis information will now be uploaded to \c"
# we obfuscate IPv4 addresses somehow but not too much, MAC addresses have to remain
# in clear since otherwise the log becomes worthless due to randomly generated
# addresses here and there that might conflict
CollectSupportInfo \
| sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
| curl -F 'sprunge=<-' http://sprunge.us
echo -e "Please post the URL in the forum where you've been asked for."
echo -e "Please post the URL in the forum where you've been asked for.\n"
exit 0
;;
U)
# Send support info to stdout to be uploaded manually. Add line numbers to prevent
# users being creative and supressing everything that's important
CollectSupportInfo \
| sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
| awk '!NF{$0=" "}1' | nl -
echo -e "\nPlease upload the ${BOLD}whole output${NC} above to an online pasteboard service\nand provide the URL in the forum where you have been asked for this.\n"
exit 0
;;
r|R)