Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ff3l-badblocks-disable-autoupdater: init #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make sure that this package does nothing on later releases? Can we somehow check the current version and if >2019 just don't add any files?

endef

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

$(eval $(call BuildPackage,ff3l-badblocks-disable-autoupdater))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure, but I think you can remove L16 to L29 and use BuildPackageGluon which does similar things?

Suggested change
$(eval $(call BuildPackage,ff3l-badblocks-disable-autoupdater))
$(eval $(call BuildPackageGluon,$(PKG_NAME)))

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.
(see: https://github.com/oszilloskop/UBNT_ERX_Gluon_Factory-Image/blob/master/ERX-Sysupgrade-Problem.md)
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