From 0f2b358b316ff96bd1b6011b268b1e509f2e1c6c Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Fri, 25 Aug 2023 14:27:31 +0200 Subject: [PATCH 1/5] Makefile: detect version 4 and bail out while soft-failing for version 3 We assume that the version 3 series is compatible, but still prompt the user if they are using a version that we have not yet tested. We know that version 4 is not compatible, so we bail out directly. The double-dollar is for escaping the Makefile. --- Makefile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5f420c0..6769229 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=blue-merle -PKG_VERSION:=1.0.0 +PKG_VERSION:=1.0.1 PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=Matthias @@ -96,13 +96,27 @@ define Package/blue-merle/preinst } if grep -q "GL.iNet GL-E750" /proc/cpuinfo; then - if grep -q -w "3.215" /etc/glversion; then - CHECK_MCUVERSION - echo "Device is supported, installing blue-merle." - exit 0 - else - ABORT_GLVERSION - fi + GL_VERSION=$$(cat /etc/glversion) + case $$GL_VERSION in + 4.*) + echo Version $$GL_VERSION is not supported + exit 1 + ;; + 3.125) + echo Version $$GL_VERSION is supported + CHECK_MCUVERSION + exit 0 + ;; + 3.*) + echo Version $$GL_VERSION is *probably* supported + ABORT_GLVERSION + ;; + *) + echo Unknown version $$GL_VERSION + ABORT_GLVERSION + ;; + esac + CHECK_MCUVERSION else ABORT_GLVERSION fi From 7aaf65e8bd0f8965b259c0ff69a709324566b5fc Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 28 Aug 2023 09:55:41 +0200 Subject: [PATCH 2/5] support a clean uninstall of blue-merle Before this change, uninstalling the package would complain about /tmp/sim_change_start not existing: root@GL-E750:/tmp# opkg remove blue-merle Removing package blue-merle from root... The /tmp/ directory exists. The /etc/ directory exists. killall: gltertf: no process killed No file found within /tmp/tertf. No shredding to be done there. No file found within /etc/tertf. No shredding to be done there. Looks like /tmp/ is clean! Looks like /etc/ is clean! rm: can't remove '/tmp/sim_change_start': No such file or directory rm: can't remove '/tmp/sim_change_switch': No such file or directory No packages removed. Collected errors: * pkg_run_script: package "blue-merle" postrm script returned status 1. root@GL-E750:/tmp# So we use -f to not raise an error if the file does not exist. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6769229..a1be19a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=blue-merle -PKG_VERSION:=1.0.1 +PKG_VERSION:=1.0.2 PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=Matthias @@ -144,8 +144,8 @@ define Package/blue-merle/postrm mv /usr/bin/switchaction.orig /usr/bin/switchaction mv /usr/bin/switch_queue.orig /usr/bin/switch_queue - rm /tmp/sim_change_start - rm /tmp/sim_change_switch + rm -f /tmp/sim_change_start + rm -f /tmp/sim_change_switch endef $(eval $(call BuildPackage,$(PKG_NAME))) From d934a6c028b2d50f8a695251e10de2b74833ea4a Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 28 Aug 2023 10:39:49 +0200 Subject: [PATCH 3/5] check for the actual version 3.215 I've made a typo in the previous attempt. Now I'm checking for the correct version and it works much better. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a1be19a..d7885fd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=blue-merle -PKG_VERSION:=1.0.2 +PKG_VERSION:=1.0.3 PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=Matthias @@ -102,7 +102,7 @@ define Package/blue-merle/preinst echo Version $$GL_VERSION is not supported exit 1 ;; - 3.125) + 3.215) echo Version $$GL_VERSION is supported CHECK_MCUVERSION exit 0 From 928d4360ca7620ec942b7e9dbdaf0d5b370cdf76 Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 28 Aug 2023 10:41:13 +0200 Subject: [PATCH 4/5] depend on gl-ui and gl-e750-mcu because we modify those packages We do need the MCU package and we modify the web UI so let's actually depend on the relevant packages. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d7885fd..50590b0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=blue-merle -PKG_VERSION:=1.0.3 +PKG_VERSION:=1.1.0 PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=Matthias @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/package.mk define Package/blue-merle SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+bash +coreutils-shred +python3 +python3-pyserial +patch + DEPENDS:=gl-ui gl-e750-mcu +bash +coreutils-shred +python3 +python3-pyserial +patch TITLE:=Anonymity Enhancements for GL-E750 Mudi endef From 187378a1d626e469d82f7c09222b8c1e454f3b1a Mon Sep 17 00:00:00 2001 From: nicholas Date: Fri, 13 Oct 2023 13:05:40 +0200 Subject: [PATCH 5/5] Added IMEI character length validation check in imei_generate.py which ensures IMEI has 14-char length, including validation digit --- files/lib/blue-merle/imei_generate.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/lib/blue-merle/imei_generate.py b/files/lib/blue-merle/imei_generate.py index 4fd7cfe..59db66c 100644 --- a/files/lib/blue-merle/imei_generate.py +++ b/files/lib/blue-merle/imei_generate.py @@ -141,6 +141,10 @@ def generate_imei(imei_prefix, imsi_d): def validate_imei(imei): + # before anything check if length is 14 characters + if len(imei) != 14: + print(f"NOT A VALID IMEI: {imei} - IMEI must be 14 characters in length") + return False # cut off last digit validation_digit = int(imei[-1]) imei_verify = imei[0:14]