From ce884f630dac324eab264db1cdc31e82171975ba Mon Sep 17 00:00:00 2001 From: ThomasKaiser Date: Sun, 19 Nov 2017 18:26:03 +0100 Subject: [PATCH] Minor armbianmonitor debug info improvements --- packages/bsp/common/usr/bin/armbianmonitor | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/bsp/common/usr/bin/armbianmonitor b/packages/bsp/common/usr/bin/armbianmonitor index c82d25b3f4..674d1705b7 100755 --- a/packages/bsp/common/usr/bin/armbianmonitor +++ b/packages/bsp/common/usr/bin/armbianmonitor @@ -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)