Skip to content

Commit

Permalink
ff3l-badblocks-disable-autoupdater: init
Browse files Browse the repository at this point in the history
  • Loading branch information
kpanic23 committed Jul 18, 2024
1 parent 3c85347 commit 77e4294
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ff3l-badblocks-disable-autoupdater/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ff3l-badblocks-disable-autoupdater
PKG_VERSION:=1

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include ../../../package/gluon.mk

define Package/ff3l-badblocks-disable-autoupdater
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Disable autoupdater if device has bad eraseblocks
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef

define Package/ff3l-badblocks-disable-autoupdater/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef

$(eval $(call BuildPackage,ff3l-badblocks-disable-autoupdater))
7 changes: 7 additions & 0 deletions ff3l-badblocks-disable-autoupdater/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ff3l-badblocks-disable-autoupdater
=============

Transitional package to be used with last Gluon v2019.1.x release
Simply disables the autoupdater for UBNT ERX devices with bad eraseblocks in flash and prefixes the node's name with "#BADBLOCKS".
This mitigates the issue that these devices would get bricked by an update to Gluon v2020.1 or newer, where the handling of bad eraseblocks has been changed.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/lua
local uci = require('simple-uci').cursor()
local eraseblock = io.popen("dmesg|grep \"Bad eraseblock\""):read('*a')
local hostname = uci:get_first('system', 'system', 'hostname')
if (eraseblock ~= '') then
io.write('has badblocks, disabling autoupdater...\n')
uci:set('autoupdater', 'settings', 'enabled', '0')
uci:save('autoupdater')
if hostname:find('BADBLOCKS') then
io.write('already prefixed\n')
else
io.write('changing hostname to "#BADBLOCKS '..hostname..'"...\n')
io.popen('pretty-hostname "#BADBLOCKS '..hostname..'"')
end
else
io.write('no badblocks\n')
end

0 comments on commit 77e4294

Please sign in to comment.