-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ff3l-badblocks-disable-autoupdater: init
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
17 changes: 17 additions & 0 deletions
17
...-badblocks-disable-autoupdater/luasrc/lib/gluon/upgrade/590-badblocks-disable-autoupdater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |