diff --git a/packages/bsp/common/usr/bin/armbianmonitor b/packages/bsp/common/usr/bin/armbianmonitor index 575f83829f..8caa101382 100755 --- a/packages/bsp/common/usr/bin/armbianmonitor +++ b/packages/bsp/common/usr/bin/armbianmonitor @@ -146,24 +146,40 @@ ParseOptions() { exit 0 ;; u) - # Upload /var/log/armbian-hardware-monitor.log with additional support info - fping ix.io 2>/dev/null | grep -q alive - if [ $? != 0 ]; then - 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 - fi - which curl >/dev/null 2>&1 || apt-get -f -qq -y install curl - 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 'f:1=<-' ix.io - echo -e "Please post the URL in the forum where you've been asked for.\n" - exit 0 - ;; - U) + # Upload /var/log/armbian-hardware-monitor.log with additional support info + which curl >/dev/null 2>&1 || apt-get -f -qq -y install curl + echo -e "System diagnosis information will now be uploaded to \c" + fping paste.armbian.com 2>/dev/null | grep -q alive + if [ $? != 0 ]; then + echo -e "\nNetwork/firewall problem detected.\nTrying fallback..." >&2 + fping ix.io 2>/dev/null | grep -q alive + if [ $? != 0 ]; then + 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 to an online pasteboard service\nand provide the URL in the forum where you have been asked for this.\n" + exit 1 + fi + + # 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 'f:1=<-' ix.io + echo -e "Please post the URL in the forum where you've been asked for.\n" + exit 0 + fi + + # 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 -s --data-binary @- "https://paste.armbian.com/documents" \ + | awk -F'"' '{ print "https://paste.armbian.com/" $4 }' + 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 \ @@ -858,7 +874,8 @@ gwYNGjRo0KBBw1eEfwH4UoBHAKAAAA==" | base64 --decode | tar xzf - CollectSupportInfo() { [[ -s /var/log/armbian-hardware-monitor.log ]] && cat /var/log/armbian-hardware-monitor.log || zcat /var/log/armbian-hardware-monitor.log.1.gz 2>/dev/null - [[ -f /boot/armbianEnv.txt ]] && LOGLEVEL=$(awk -F'=' '/^verbosity/ {print $2}' /boot/armbianEnv.txt) || LOGLEVEL=1 + [[ -f /boot/armbianEnv.txt ]] && LOGLEVEL=$(awk -F'=' '/^verbosity/ {print $2}' /boot/armbianEnv.txt) + LOGLEVEL=${LOGLEVEL:-1} if [ ${LOGLEVEL} -gt 4 ]; then VERBOSE='-v' which lshw >/dev/null 2>&1 && (echo -e "\n### lshw:" ; lshw -quiet -sanitize -numeric)