From 1ee7931647ebbb757ec803cef94dc1901f2810d0 Mon Sep 17 00:00:00 2001 From: viktorxda <35473052+viktorxda@users.noreply.github.com> Date: Tue, 5 Dec 2023 18:48:34 +0100 Subject: [PATCH] [no ci] Package: simplify quirc-openipc (#1183) Co-authored-by: Signor Pellegrino <68112357+FlyRouter@users.noreply.github.com> --- general/package/quirc-openipc/Config.in | 5 +- general/package/quirc-openipc/files/qrparse | 113 ------------------ .../package/quirc-openipc/quirc-openipc.mk | 21 ++-- general/package/quirc-openipc/readme.md | 11 -- 4 files changed, 8 insertions(+), 142 deletions(-) delete mode 100755 general/package/quirc-openipc/files/qrparse delete mode 100644 general/package/quirc-openipc/readme.md diff --git a/general/package/quirc-openipc/Config.in b/general/package/quirc-openipc/Config.in index f791ce3c5..04308fdcb 100644 --- a/general/package/quirc-openipc/Config.in +++ b/general/package/quirc-openipc/Config.in @@ -1,8 +1,5 @@ config BR2_PACKAGE_QUIRC_OPENIPC - bool "quirc" - select BR2_PACKAGE_JPEG - select BR2_PACKAGE_LIBJPEG + bool "quirc-openipc" help QR codes are a type of high-density matrix barcodes, and quirc is a library for extracting and decoding them from images. - https://github.com/dlbeer/quirc diff --git a/general/package/quirc-openipc/files/qrparse b/general/package/quirc-openipc/files/qrparse deleted file mode 100755 index fdbb36a22..000000000 --- a/general/package/quirc-openipc/files/qrparse +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh - -################################################################################ -# -# THIS SCRIPT WILL PARSE AN ZXING FORMAT QR CODE PAYLOAD FOR WIFI CREDENTIALS -# -# INPUT MUST BE PASSED IN SINGLE QUOTES -# -# BARCODE CONTENTS CAN BE FOUND HERE -# https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 -# -# THIS SCRIPT USES SIMILAR LOGIC TO: -# https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/WifiResultParser.java -# -# @author jayfan0 -# -# OPENIPC USAGE: qrparse $(qrscan -p /mnt/mmcblk0p1/qrcode2.jpg | head -n 1) -# OPENIPC FULL USAGE: curl -s -o /tmp/img.jpg http://127.0.0.1/image.jpg ; qrparse $(qrscan -p /tmp/img.jpg | head -n 1) -################################################################################ - -if [ "$1" = "help" ]; then - echo -e "\n================= QRPARSER usage =================\n" - echo -e "Parse the QR code scanned by qrscan and extract wifi credentials\n" - echo -e "INPUT MUST BE PASSED IN SINGLE QUOTES\n" - echo -e "USAGE EXAMPLES:\n" - echo -e 'Standalone:\t\t qrparse $(qrscan -p /mnt/mmcblk0p1/qrcode2.jpg | head -n 1)\n' - echo -e 'With camera sensor:\t curl -s -o /tmp/img.jpg http://127.0.0.1/image.jpg ; qrparse $(qrscan -p /tmp/img.jpg | head -n 1)\n' - exit -fi - -# scan='WIFI:S:thi$iSmdsywifi;H:false;T:WPA2;P:$e£cr3tt;PH2:MSCHAPv2;;' -scan=$1 - -if [[ ${scan:0:5} == "WIFI:" ]]; then - - trunc=$(echo $scan | sed 's/WIFI://') - - delims=${trunc//[^;]} - - count=${#delims} - - fields=$(( $count-1 )) - - for i in $(seq 1 $fields); - do - line=$(echo $trunc | cut -d ';' -f $i) - - for j in $(seq 1 2); - do - single=$(echo $line | cut -d ':' -f $j) - - case $single in - S) - SSID=$(echo $line | cut -d ':' -f $(( j + 1 ))) - [ -z $SSID ] && echo "SSID Empty. Aborting" && exit - echo "SSID = $SSID" - ;; - - P) - password=$(echo $line | cut -d ':' -f $(( j + 1 ))) - echo "Password = $password" - ;; - - T) - auth=$(echo $line | cut -d ':' -f $(( j + 1 ))) - [ -z $auth ] && auth = "nopass" - echo "Authentication type = $auth" - ;; - - H) - hidden=$(echo $line | cut -d ':' -f $(( j + 1 ))) -# echo "Hidden SSID = $hidden" - ;; - - E) - eap=$(echo $line | cut -d ':' -f $(( j + 1 ))) - echo "EAP method = $eap" - ;; - - A) - anon=$(echo $line | cut -d ':' -f $(( j + 1 ))) - echo "Anonymous identity = $anon" - ;; - - I) - identity=$(echo $line | cut -d ':' -f $(( j + 1 ))) - echo "Identity = $identity" - ;; - - PH2) - ph2=$(echo $line | cut -d ':' -f $(( j + 1 ))) - echo "PH2 = $ph2" - ;; - esac - done - done - - # Unfortunately, in the past, H: was not just used for boolean 'hidden', but 'phase 2 method'. - # To try to retain backwards compatibility, we set one or the other based on whether the string - #is 'true' or 'false': - if [ ! -z $hidden ]; then - # If PH2 was specified separately, or if the value is clearly boolean, interpret it as 'hidden' - if [ ! -z "$ph2" ] || [[ $(echo "$hidden" | tr '[:upper:]' '[:lower:]') = $(echo "true") ]] || [[ $(echo "$hidden" | tr '[:upper:]' '[:lower:]') = $(echo "false") ]]; then - hidden=$hidden - echo "Hidden = $hidden" - else - ph2=$hidden - echo "PH2 = $ph2" - fi - fi -else - echo "Invalid QR Code" -fi diff --git a/general/package/quirc-openipc/quirc-openipc.mk b/general/package/quirc-openipc/quirc-openipc.mk index f0c35f86c..3936f29f4 100644 --- a/general/package/quirc-openipc/quirc-openipc.mk +++ b/general/package/quirc-openipc/quirc-openipc.mk @@ -4,31 +4,24 @@ # ################################################################################ -ifeq ($(LOCAL_DOWNLOAD),y) -QUIRC_OPENIPC_SITE_METHOD = git -QUIRC_OPENIPC_SITE = https://github.com/openipc/quirc -QUIRC_OPENIPC_VERSION = $(shell git ls-remote $(QUIRC_OPENIPC_SITE) HEAD | head -1 | cut -f1) -else QUIRC_OPENIPC_SITE = https://github.com/openipc/quirc/archive QUIRC_OPENIPC_SOURCE = master.tar.gz -endif -QUIRC_OPENIPC_DEPENDENCIES += libjpeg -QUIRC_OPENIPC_LICENSE = ISC -QUIRC_OPENIPC_LICENSE_FILES = LICENSE.txt +QUIRC_OPENIPC_DEPENDENCIES = libjpeg +LIBJPEG_CONF_OPTS = --disable-shared QUIRC_OPENIPC_MAKE_OPTS = \ - CC="$(TARGET_CC)" \ - AR="$(TARGET_AR)" + CC=$(TARGET_CC) \ + AR=$(TARGET_AR) \ + LDFLAGS="-s" define QUIRC_OPENIPC_BUILD_CMDS $(MAKE) $(QUIRC_OPENIPC_MAKE_OPTS) -C $(@D) all endef define QUIRC_OPENIPC_INSTALL_TARGET_CMDS - $(INSTALL) -m 0755 -D $(@D)/qrscan $(TARGET_DIR)/usr/sbin - $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin - $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/sbin $(QUIRC_OPENIPC_PKGDIR)files/qrparse + $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin + $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/qrscan endef $(eval $(generic-package)) diff --git a/general/package/quirc-openipc/readme.md b/general/package/quirc-openipc/readme.md deleted file mode 100644 index e8ecfb195..000000000 --- a/general/package/quirc-openipc/readme.md +++ /dev/null @@ -1,11 +0,0 @@ - -### Sample usage - -``` -#!/bin/sh - -while true ; do - sleep 1 - curl -s -o /tmp/img.jpg http://127.0.0.1/image.jpg ; qrscan -p /tmp/img.jpg -done -```