From 0aae1da7899179a0678bc77c6733cfe461f4c58e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 10 Oct 2015 21:42:28 +0200 Subject: Initial inclusion of Brother printer firmware download tool. --- localbrotherfwfetch | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 localbrotherfwfetch (limited to 'localbrotherfwfetch') diff --git a/localbrotherfwfetch b/localbrotherfwfetch new file mode 100755 index 0000000..808304c --- /dev/null +++ b/localbrotherfwfetch @@ -0,0 +1,57 @@ +#!/bin/bash + +name= +spec= +firms= + +while getopts ":n:s:f:" opt; do + case $opt in + n) + name=$OPTARG + ;; + s) + spec=$OPTARG + ;; + f) + firms=$OPTARG + ;; + esac +done + +IFS=',' read -a firmids <<< "$firms" +for firmid in "${firmids[@]}" +do + for version in "0" "B0000000000" + do + echo -n '' >> request.xml + echo -n $firmid >> request.xml + echo -n 'LINUX1' >> request.xml + echo -n $name >> request.xml + echo -n '' >> request.xml + echo -n $spec >> request.xml + echo -n '' >> request.xml + echo -n $firmid >> request.xml + echo -n '' >> request.xml + echo -n $version >> request.xml + echo -n '121' >> request.xml + + curl -X POST -d @request.xml https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate -H "Content-Type:text/xml" --sslv3 -o response.xml -s + valid=`grep "0" response.xml` + if [ -n "$valid" ] + then + echo "--- request (name=$name, spec=$spec, firm=$firmid, version=$version) ---" + cat request.xml | xmllint --format - + echo "--- response ---" + cat response.xml | xmllint --format - + else + partial=`grep "2" response.xml` + if [ -n "$partial" ] + then + echo "-- the request is partially incomplete (name=$name, spec=$spec, firm=$firmid, version=$version) --" + else + echo "-- the request is invalid (name=$name, spec=$spec, firm=$firmid, version=$version) --" + fi + fi + rm request.xml response.xml + done +done -- cgit v1.2.3