From 3e4e6270b74c3e7de2d49a25777f2d30aae121f1 Mon Sep 17 00:00:00 2001 From: dman776 Date: Sun, 13 May 2018 23:02:57 -0500 Subject: [PATCH] feature: add bootloader version to supporttool output (#8) * feature: add U-Boot version to supporttool output * feature: add bootloader version to supporttool output --- files/usr/local/bin/get_hardware_mfg | 14 ++++++++++++++ files/www/cgi-bin/supporttool | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 files/usr/local/bin/get_hardware_mfg diff --git a/files/usr/local/bin/get_hardware_mfg b/files/usr/local/bin/get_hardware_mfg new file mode 100755 index 00000000..e2e8ef7f --- /dev/null +++ b/files/usr/local/bin/get_hardware_mfg @@ -0,0 +1,14 @@ +#!/bin/sh + +CFG=/etc/board.json + +. /usr/share/libubox/jshn.sh + +[ -f $CFG ] || exit 1 +json_init +json_load "$(cat ${CFG})" +json_select model +json_get_vars name +set -- $name +echo "$1" > /tmp/sysinfo/hardware_mfg +cat /tmp/sysinfo/hardware_mfg \ No newline at end of file diff --git a/files/www/cgi-bin/supporttool b/files/www/cgi-bin/supporttool index 0c2d1271..6ddb6732 100755 --- a/files/www/cgi-bin/supporttool +++ b/files/www/cgi-bin/supporttool @@ -88,10 +88,18 @@ use perlfunc; "/usr/local/bin/get_hardwaretype", "/usr/local/bin/get_boardid", "/usr/local/bin/get_model", + "/usr/local/bin/get_hardware_mfg", + ); + +@cmds_ubnt = ( + "cat /dev/mtd0|grep 'U-Boot'|head -n1", ); $FREE_SPACE_TMP=get_free_space("/tmp"); +$mfg = `/usr/local/bin/get_hardware_mfg`; +chomp($mfg); + if ($FREE_SPACE_TMP eq "N/A" || $FREE_SPACE_TMP <= 2*1024) { exit 1; } @@ -133,6 +141,16 @@ foreach $cmd (@cmds) { } } +if ( $mfg eq "Ubiquiti" ) { + foreach $cmd (@cmds_ubnt) { + print $CMDS_OUT "========== $cmd (UBNT only) ==========\n"; + open(my $CMD_PIPE, "-|", $cmd ) or next; + while (<$CMD_PIPE>) { + print { $CMDS_OUT } $_; + } + } +} + close ($CMDS_OUT); system("tar", "-zcf", "/tmp/supportdata.tgz", "-C", "/tmp/sd", "./");