feature: add bootloader version to supporttool output (#8)

* feature: add U-Boot version to supporttool output

* feature: add bootloader version to supporttool output
This commit is contained in:
dman776 2018-05-13 23:02:57 -05:00 committed by GitHub
parent d33df3dab7
commit 3e4e6270b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View File

@ -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

View File

@ -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", "./");