summaryrefslogtreecommitdiff
path: root/localbrotherfwfetch
diff options
context:
space:
mode:
Diffstat (limited to 'localbrotherfwfetch')
-rwxr-xr-xlocalbrotherfwfetch25
1 files changed, 13 insertions, 12 deletions
diff --git a/localbrotherfwfetch b/localbrotherfwfetch
index 3ef554c..ff7e4bb 100755
--- a/localbrotherfwfetch
+++ b/localbrotherfwfetch
@@ -38,22 +38,23 @@ do
echo -n '</VERSION></FIRM></FIRMINFO></MODELINFO><DRIVERCNT>1</DRIVERCNT><LOGNO>2</LOGNO><ERRBIT></ERRBIT><NEEDRESPONSE>1</NEEDRESPONSE></FIRMUPDATEINFO></REQUESTINFO>' >> 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 "<RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>0</VERSIONCHECK>" response.xml`
- if [ -n "$valid" ]
- then
+ case $(xmllint --xpath '/RESPONSEINFO/FIRMUPDATEINFO/VERSIONCHECK/text()' response.xml) in
+ 0)
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 "<RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK><FIRMID>" 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
+ ;;
+ 1)
+ echo "-- no firmware update available (name=$name, spec=$spec, firm=$firmid, version=$version) --"
+ ;;
+ 2)
+ echo "-- the request is partially incomplete (name=$name, spec=$spec, firm=$firmid, version=$version) --"
+ ;;
+ *)
+ echo "-- the request is invalid (name=$name, spec=$spec, firm=$firmid, version=$version) --"
+ ;;
+ esac
rm request.xml response.xml
done
done