From 48fa837254b5503503eae450b0458eb3169ff120 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Mon, 25 Nov 2024 21:20:55 +0100 Subject: [PATCH 1/7] file from LibreRouterOS for checking internet connection https://gitlab.com/librerouter/librerouteros/-/blob/d40c2d26c9b3dd65153d862ded1c554cc3e0a71c/files/etc/uci-defaults/90-cron-defer-reboot --- .../files/etc/uci-defaults/90-cron-defer-reboot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot new file mode 100644 index 000000000..e7a904d47 --- /dev/null +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -0,0 +1,13 @@ +#!/bin/sh + +internet_gw_ip=8.8.8.8 + +unique_append() +{ + grep -qF "$1" "$2" || echo "$1" >> "$2" +} + +unique_append \ + "*/3 * * * * ((if ping -c 10 -W 10 $internet_gw_ip &> /dev/null; then awk '{print \$1 + 800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ + /etc/crontabs/root + From 9ac006246cfcb3ede328494b1aaa8b55b0f4e1ae Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Mon, 25 Nov 2024 21:23:11 +0100 Subject: [PATCH 2/7] avoid using Google IP, use the one from DNS in lime-defaults --- .../files/etc/uci-defaults/90-cron-defer-reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot index e7a904d47..c607c6a8d 100644 --- a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -1,6 +1,6 @@ #!/bin/sh -internet_gw_ip=8.8.8.8 +internet_gw_ip=4.2.2.2 unique_append() { From 89f9170b49c8464cbb7161177baea0ceea4517f4 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Mon, 25 Nov 2024 22:01:41 +0100 Subject: [PATCH 3/7] de-hardcoded the ping target: moved to lime's system section --- .../files/etc/uci-defaults/90-cron-defer-reboot | 4 +--- packages/lime-docs/files/www/docs/lime-example.txt | 1 + packages/lime-system/files/etc/config/lime-defaults | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot index c607c6a8d..265cef0d2 100644 --- a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -1,13 +1,11 @@ #!/bin/sh -internet_gw_ip=4.2.2.2 - unique_append() { grep -qF "$1" "$2" || echo "$1" >> "$2" } unique_append \ - "*/3 * * * * ((if ping -c 10 -W 10 $internet_gw_ip &> /dev/null; then awk '{print \$1 + 800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ + "*/3 * * * * ((if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ /etc/crontabs/root diff --git a/packages/lime-docs/files/www/docs/lime-example.txt b/packages/lime-docs/files/www/docs/lime-example.txt index 15659d107..507a0c029 100644 --- a/packages/lime-docs/files/www/docs/lime-example.txt +++ b/packages/lime-docs/files/www/docs/lime-example.txt @@ -22,6 +22,7 @@ config lime system option root_password_policy 'DO_NOTHING' # When configured to SET_SECRET, the root password secret will be configured as specified in root_password_secret. When set to RANDOM a strong random password will be set if root has no password, use this if your firmware is built with the ssh keys inside. DO_NOTHING does nothing, leaving the root password empty (you will have to set it manually or through FirstBootWizard). option root_password_secret '' # This is the password hash as stored in /etc/shadow, it is only used when root_password_policy=SET_SECRET. You can generate the secret with 'openssl passwd -1' to be compatible with most openwrt firmwares, use a strong password with at least 10 numbers and letters, the longer the better!. For improved security use "openssl passwd -6" for SHA512 (or -5 for SHA256) but be aware that not all firmwares support this. option deferable_reboot_uptime_s '97200' + option deferable_reboot_ping_target '4.2.2.2' # b.resolvers.Level3.net # the reboot scheduled by deferable_reboot, if installed, will be deferred if the ping to this IP is succesful option firstbootwizard_configured false option firstbootwizard_dismissed false # When true fbw banner will be hidden. diff --git a/packages/lime-system/files/etc/config/lime-defaults b/packages/lime-system/files/etc/config/lime-defaults index 5f5c4a31f..b575e1616 100644 --- a/packages/lime-system/files/etc/config/lime-defaults +++ b/packages/lime-system/files/etc/config/lime-defaults @@ -12,6 +12,7 @@ config lime system option root_password_policy 'DO_NOTHING' option root_password_secret '' option deferable_reboot_uptime_s '97200' + option deferable_reboot_ping_target '4.2.2.2' option firstbootwizard_configured false option firstbootwizard_dismissed false From 93a15d8fde17ec903fa543cde727e418a4c347fc Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Mon, 2 Dec 2024 09:57:36 +0100 Subject: [PATCH 4/7] cron deferable-reboot increase time to delay reboot --- .../files/etc/uci-defaults/90-cron-defer-reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot index 265cef0d2..86cf919da 100644 --- a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -6,6 +6,6 @@ unique_append() } unique_append \ - "*/3 * * * * ((if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ + "*/3 * * * * ((if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ /etc/crontabs/root From 20be3bf6233e028d8ef3d954607312b2ab155189 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Mon, 2 Dec 2024 09:58:42 +0100 Subject: [PATCH 5/7] cron deferable-reboot execute at random times --- .../files/etc/uci-defaults/90-cron-defer-reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot index 86cf919da..bb14c3cb5 100644 --- a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -6,6 +6,6 @@ unique_append() } unique_append \ - "*/3 * * * * ((if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ + "*/3 * * * * ((sleep $((RANDOM % 120)); if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ /etc/crontabs/root From 9f6d3466afdc4c1af4ede1a1f346833947c4d32f Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 31 Dec 2024 09:53:25 +0100 Subject: [PATCH 6/7] deferable-reboot move cron command to file --- .../files/etc/uci-defaults/90-cron-defer-reboot | 3 +-- .../files/usr/bin/deferable-reboot-check | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 packages/deferable-reboot/files/usr/bin/deferable-reboot-check diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot index bb14c3cb5..9523dedc1 100644 --- a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot +++ b/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot @@ -6,6 +6,5 @@ unique_append() } unique_append \ - "*/3 * * * * ((sleep $((RANDOM % 120)); if ping -c 10 -W 10 \$(uci -q get lime-autogen.system.deferable_reboot_ping_target) &> /dev/null; then awk '{print \$1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer ; fi )&) "\ - /etc/crontabs/root + "*/3 * * * * ((sleep $((RANDOM % 120)); /usr/bin/deferable-reboot-check )&)" /etc/crontabs/root diff --git a/packages/deferable-reboot/files/usr/bin/deferable-reboot-check b/packages/deferable-reboot/files/usr/bin/deferable-reboot-check new file mode 100755 index 000000000..85b5187a0 --- /dev/null +++ b/packages/deferable-reboot/files/usr/bin/deferable-reboot-check @@ -0,0 +1,17 @@ +#!/bin/sh + +uci_config_path="lime-autogen.system.deferable_reboot_ping_target" +target=$(uci -q get $uci_config_path &> /dev/null) + +if [ -n "$target" ]; then + if ping -c 10 -W 10 $target; then + action=defer + fi +else + echo "deferable-reboot: Could not get the ping target from UCI $uci_config_path, deferring anyway" + action=defer +fi + +if [ "$action" == "defer" ]; then + awk '{print $1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer +fi From 6c9a20a2861f2e34ff0f82d63c99c06215f826d9 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 31 Dec 2024 10:15:34 +0100 Subject: [PATCH 7/7] fix typo in package name deferable-reboot -> deferrable-reboot --- .../files/etc/config/deferable-reboot | 3 --- .../files/usr/bin/deferable-reboot | 10 -------- .../files/usr/bin/deferable-reboot-check | 17 ------------- .../Makefile | 10 ++++---- .../files/etc/config/deferrable-reboot | 3 +++ .../etc/uci-defaults/90-cron-defer-reboot | 0 .../etc/uci-defaults/deferrable-reboot-cron} | 2 +- .../files/usr/bin/deferrable-reboot | 10 ++++++++ .../files/usr/bin/deferrable-reboot-check | 17 +++++++++++++ .../files/usr/lib/lua/deferrable_reboot.lua} | 8 +++---- .../tests/test_deferrable_reboot.lua} | 24 +++++++++---------- .../lime-docs/files/www/docs/lime-example.txt | 4 ++-- .../files/etc/config/lime-defaults | 4 ++-- .../safe-upgrade/files/usr/sbin/safe-upgrade | 2 +- tests/utils.lua | 2 +- 15 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 packages/deferable-reboot/files/etc/config/deferable-reboot delete mode 100755 packages/deferable-reboot/files/usr/bin/deferable-reboot delete mode 100755 packages/deferable-reboot/files/usr/bin/deferable-reboot-check rename packages/{deferable-reboot => deferrable-reboot}/Makefile (82%) create mode 100644 packages/deferrable-reboot/files/etc/config/deferrable-reboot rename packages/{deferable-reboot => deferrable-reboot}/files/etc/uci-defaults/90-cron-defer-reboot (100%) rename packages/{deferable-reboot/files/etc/uci-defaults/deferable-reboot-cron => deferrable-reboot/files/etc/uci-defaults/deferrable-reboot-cron} (67%) create mode 100755 packages/deferrable-reboot/files/usr/bin/deferrable-reboot create mode 100755 packages/deferrable-reboot/files/usr/bin/deferrable-reboot-check rename packages/{deferable-reboot/files/usr/lib/lua/deferable_reboot.lua => deferrable-reboot/files/usr/lib/lua/deferrable_reboot.lua} (84%) rename packages/{deferable-reboot/tests/test_deferable_reboot.lua => deferrable-reboot/tests/test_deferrable_reboot.lua} (74%) diff --git a/packages/deferable-reboot/files/etc/config/deferable-reboot b/packages/deferable-reboot/files/etc/config/deferable-reboot deleted file mode 100644 index df44de6d2..000000000 --- a/packages/deferable-reboot/files/etc/config/deferable-reboot +++ /dev/null @@ -1,3 +0,0 @@ -config deferable-reboot 'options' - #option deferable_reboot_uptime '97200' - diff --git a/packages/deferable-reboot/files/usr/bin/deferable-reboot b/packages/deferable-reboot/files/usr/bin/deferable-reboot deleted file mode 100755 index 70e0b6a0c..000000000 --- a/packages/deferable-reboot/files/usr/bin/deferable-reboot +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/lua - -local defreboot = require 'deferable_reboot' - -defreboot.config() - -if defreboot.should_reboot() then - os.execute('logger -t deferable-reboot -p ALERT Rebooting in 30 seconds!') - defreboot.reboot() -end diff --git a/packages/deferable-reboot/files/usr/bin/deferable-reboot-check b/packages/deferable-reboot/files/usr/bin/deferable-reboot-check deleted file mode 100755 index 85b5187a0..000000000 --- a/packages/deferable-reboot/files/usr/bin/deferable-reboot-check +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -uci_config_path="lime-autogen.system.deferable_reboot_ping_target" -target=$(uci -q get $uci_config_path &> /dev/null) - -if [ -n "$target" ]; then - if ping -c 10 -W 10 $target; then - action=defer - fi -else - echo "deferable-reboot: Could not get the ping target from UCI $uci_config_path, deferring anyway" - action=defer -fi - -if [ "$action" == "defer" ]; then - awk '{print $1 + 1800}' /proc/uptime > /tmp/deferable-reboot.defer -fi diff --git a/packages/deferable-reboot/Makefile b/packages/deferrable-reboot/Makefile similarity index 82% rename from packages/deferable-reboot/Makefile rename to packages/deferrable-reboot/Makefile index 94097d07b..45c02cde1 100644 --- a/packages/deferable-reboot/Makefile +++ b/packages/deferrable-reboot/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . ) GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . ) -PKG_NAME:=deferable-reboot +PKG_NAME:=deferrable-reboot PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP) include $(INCLUDE_DIR)/package.mk @@ -17,21 +17,21 @@ include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME) SECTION:=utils CATEGORY:=Utilities - TITLE:=$(PKG_NAME) provides a deferable reboot. + TITLE:=$(PKG_NAME) provides a deferrable reboot. MAINTAINER:=Santiago Piccinini DEPENDS:=+lua +lime-system PKGARCH:=all endef define Package/$(PKG_NAME)/description - This $(PKG_NAME) provides a deferable reboot mechanism. The system + This $(PKG_NAME) provides a deferrable reboot mechanism. The system will be rebooted when the uptime of the system reach a specified amount - of seconds and if /tmp/deferable-reboot.defer file does not contain a + of seconds and if /tmp/deferrable-reboot.defer file does not contain a number that is greater than the current uptime. This way if anyone wants to postpone the reboot, the way is to store the next checkpoint in seconds. For example if the system must not reboot from now and up to 120 seconds in the future then something like this can be donde - awk '{print $1 + 120}' /proc/uptime > /tmp/deferable-reboot.defer + awk '{print $1 + 120}' /proc/uptime > /tmp/deferrable-reboot.defer endef define Build/Configure diff --git a/packages/deferrable-reboot/files/etc/config/deferrable-reboot b/packages/deferrable-reboot/files/etc/config/deferrable-reboot new file mode 100644 index 000000000..4bff11507 --- /dev/null +++ b/packages/deferrable-reboot/files/etc/config/deferrable-reboot @@ -0,0 +1,3 @@ +config deferrable-reboot 'options' + #option deferrable_reboot_uptime '97200' + diff --git a/packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot b/packages/deferrable-reboot/files/etc/uci-defaults/90-cron-defer-reboot similarity index 100% rename from packages/deferable-reboot/files/etc/uci-defaults/90-cron-defer-reboot rename to packages/deferrable-reboot/files/etc/uci-defaults/90-cron-defer-reboot diff --git a/packages/deferable-reboot/files/etc/uci-defaults/deferable-reboot-cron b/packages/deferrable-reboot/files/etc/uci-defaults/deferrable-reboot-cron similarity index 67% rename from packages/deferable-reboot/files/etc/uci-defaults/deferable-reboot-cron rename to packages/deferrable-reboot/files/etc/uci-defaults/deferrable-reboot-cron index 53faaf926..a164d6b97 100755 --- a/packages/deferable-reboot/files/etc/uci-defaults/deferable-reboot-cron +++ b/packages/deferrable-reboot/files/etc/uci-defaults/deferrable-reboot-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/1 * * * * ((deferable-reboot &> /dev/null)&)'\ + '*/1 * * * * ((deferrable-reboot &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/deferrable-reboot/files/usr/bin/deferrable-reboot b/packages/deferrable-reboot/files/usr/bin/deferrable-reboot new file mode 100755 index 000000000..5e73ddeab --- /dev/null +++ b/packages/deferrable-reboot/files/usr/bin/deferrable-reboot @@ -0,0 +1,10 @@ +#!/usr/bin/lua + +local defreboot = require 'deferrable_reboot' + +defreboot.config() + +if defreboot.should_reboot() then + os.execute('logger -t deferrable-reboot -p ALERT Rebooting in 30 seconds!') + defreboot.reboot() +end diff --git a/packages/deferrable-reboot/files/usr/bin/deferrable-reboot-check b/packages/deferrable-reboot/files/usr/bin/deferrable-reboot-check new file mode 100755 index 000000000..7f273c6ff --- /dev/null +++ b/packages/deferrable-reboot/files/usr/bin/deferrable-reboot-check @@ -0,0 +1,17 @@ +#!/bin/sh + +uci_config_path="lime-autogen.system.deferrable_reboot_ping_target" +target=$(uci -q get $uci_config_path &> /dev/null) + +if [ -n "$target" ]; then + if ping -c 10 -W 10 $target; then + action=defer + fi +else + echo "deferrable-reboot: Could not get the ping target from UCI $uci_config_path, deferring anyway" + action=defer +fi + +if [ "$action" == "defer" ]; then + awk '{print $1 + 1800}' /proc/uptime > /tmp/deferrable-reboot.defer +fi diff --git a/packages/deferable-reboot/files/usr/lib/lua/deferable_reboot.lua b/packages/deferrable-reboot/files/usr/lib/lua/deferrable_reboot.lua similarity index 84% rename from packages/deferable-reboot/files/usr/lib/lua/deferable_reboot.lua rename to packages/deferrable-reboot/files/usr/lib/lua/deferrable_reboot.lua index 1fc1fa39b..b5296b8bc 100644 --- a/packages/deferable-reboot/files/usr/lib/lua/deferable_reboot.lua +++ b/packages/deferrable-reboot/files/usr/lib/lua/deferrable_reboot.lua @@ -6,13 +6,13 @@ local defreboot = {} defreboot.DEFAULT_REBOOT_UPTIME = 60*60*27 defreboot.SLEEP_BEFORE_REBOOT_S = 30 -defreboot.POSTPONE_FILE_PATH = '/tmp/deferable-reboot.defer' +defreboot.POSTPONE_FILE_PATH = '/tmp/deferrable-reboot.defer' function defreboot.config(min_uptime) if min_uptime == nil then local uci = config.get_uci_cursor() - local lime_min_uptime = config.get("system", "deferable_reboot_uptime_s", false) - local general_min_uptime = uci:get("deferable-reboot", "options", "deferable_reboot_uptime_s") + local lime_min_uptime = config.get("system", "deferrable_reboot_uptime_s", false) + local general_min_uptime = uci:get("deferrable-reboot", "options", "deferrable_reboot_uptime_s") min_uptime = tonumber(lime_min_uptime or general_min_uptime or defreboot.DEFAULT_REBOOT_UPTIME) end assert(type(min_uptime) == "number", "min_uptime must be a number") @@ -39,7 +39,7 @@ end --! use this function to postpone the reboot, also the following command can be used ---! replacing SECONDS: # awk '{print $1 + SECONDS}' /proc/uptime > /tmp/deferable-reboot.defer +--! replacing SECONDS: # awk '{print $1 + SECONDS}' /proc/uptime > /tmp/deferrable-reboot.defer function defreboot.read_postpone_file() local f = io.open(defreboot.POSTPONE_FILE_PATH) if f ~= nil then diff --git a/packages/deferable-reboot/tests/test_deferable_reboot.lua b/packages/deferrable-reboot/tests/test_deferrable_reboot.lua similarity index 74% rename from packages/deferable-reboot/tests/test_deferable_reboot.lua rename to packages/deferrable-reboot/tests/test_deferrable_reboot.lua index eae4a1032..87568e7a5 100644 --- a/packages/deferable-reboot/tests/test_deferable_reboot.lua +++ b/packages/deferrable-reboot/tests/test_deferrable_reboot.lua @@ -1,10 +1,10 @@ local config = require "lime.config" local test_utils = require 'tests.utils' -local defreboot = require 'deferable_reboot' +local defreboot = require 'deferrable_reboot' local uci = nil -describe('Deferable Reboot tests #defreboot', function() +describe('Deferrable Reboot tests #defreboot', function() it('test load config from lime.config default value', function() defreboot.config() @@ -13,25 +13,25 @@ describe('Deferable Reboot tests #defreboot', function() it('test load config from lime.config', function() config.set('system', 'lime') - config.set('system', 'deferable_reboot_uptime_s', '120') + config.set('system', 'deferrable_reboot_uptime_s', '120') defreboot.config() assert.is.equal(120, defreboot.min_uptime) end) - it('test load config from config/deferable-reboot', function() - uci:set('deferable-reboot', 'options', 'deferable-reboot') - uci:set('deferable-reboot', 'options', 'deferable_reboot_uptime_s', '99') - uci:commit('deferable-reboot') + it('test load config from config/deferrable-reboot', function() + uci:set('deferrable-reboot', 'options', 'deferrable-reboot') + uci:set('deferrable-reboot', 'options', 'deferrable_reboot_uptime_s', '99') + uci:commit('deferrable-reboot') defreboot.config() assert.is.equal(99, defreboot.min_uptime) end) - it('test lime.config has precedence over config/deferable-reboot ', function() + it('test lime.config has precedence over config/deferrable-reboot ', function() config.set('system', 'lime') - config.set('system', 'deferable_reboot_uptime_s', '120') - uci:set('deferable-reboot', 'options', 'deferable-reboot') - uci:set('deferable-reboot', 'options', 'deferable_reboot_uptime_s', '99') - uci:commit('deferable-reboot') + config.set('system', 'deferrable_reboot_uptime_s', '120') + uci:set('deferrable-reboot', 'options', 'deferrable-reboot') + uci:set('deferrable-reboot', 'options', 'deferrable_reboot_uptime_s', '99') + uci:commit('deferrable-reboot') defreboot.config() assert.is.equal(120, defreboot.min_uptime) end) diff --git a/packages/lime-docs/files/www/docs/lime-example.txt b/packages/lime-docs/files/www/docs/lime-example.txt index 507a0c029..e57047353 100644 --- a/packages/lime-docs/files/www/docs/lime-example.txt +++ b/packages/lime-docs/files/www/docs/lime-example.txt @@ -21,8 +21,8 @@ config lime system option keep_on_upgrade 'libremesh dropbear minimum-essential /etc/sysupgrade.conf' # Files defining the list of files and directories to backup when upgrade. Relative to /lib/upgrade/keep.d if no '/' defined. option root_password_policy 'DO_NOTHING' # When configured to SET_SECRET, the root password secret will be configured as specified in root_password_secret. When set to RANDOM a strong random password will be set if root has no password, use this if your firmware is built with the ssh keys inside. DO_NOTHING does nothing, leaving the root password empty (you will have to set it manually or through FirstBootWizard). option root_password_secret '' # This is the password hash as stored in /etc/shadow, it is only used when root_password_policy=SET_SECRET. You can generate the secret with 'openssl passwd -1' to be compatible with most openwrt firmwares, use a strong password with at least 10 numbers and letters, the longer the better!. For improved security use "openssl passwd -6" for SHA512 (or -5 for SHA256) but be aware that not all firmwares support this. - option deferable_reboot_uptime_s '97200' - option deferable_reboot_ping_target '4.2.2.2' # b.resolvers.Level3.net # the reboot scheduled by deferable_reboot, if installed, will be deferred if the ping to this IP is succesful + option deferrable_reboot_uptime_s '97200' + option deferrable_reboot_ping_target '4.2.2.2' # b.resolvers.Level3.net # the reboot scheduled by deferrable_reboot, if installed, will be deferred if the ping to this IP is succesful option firstbootwizard_configured false option firstbootwizard_dismissed false # When true fbw banner will be hidden. diff --git a/packages/lime-system/files/etc/config/lime-defaults b/packages/lime-system/files/etc/config/lime-defaults index b575e1616..922b8db3a 100644 --- a/packages/lime-system/files/etc/config/lime-defaults +++ b/packages/lime-system/files/etc/config/lime-defaults @@ -11,8 +11,8 @@ config lime system option keep_on_upgrade 'libremesh dropbear minimum-essential /etc/sysupgrade.conf' option root_password_policy 'DO_NOTHING' option root_password_secret '' - option deferable_reboot_uptime_s '97200' - option deferable_reboot_ping_target '4.2.2.2' + option deferrable_reboot_uptime_s '97200' + option deferrable_reboot_ping_target '4.2.2.2' option firstbootwizard_configured false option firstbootwizard_dismissed false diff --git a/packages/safe-upgrade/files/usr/sbin/safe-upgrade b/packages/safe-upgrade/files/usr/sbin/safe-upgrade index 34a07fd66..1be358b39 100755 --- a/packages/safe-upgrade/files/usr/sbin/safe-upgrade +++ b/packages/safe-upgrade/files/usr/sbin/safe-upgrade @@ -327,7 +327,7 @@ local function upgrade(args) su.preserve_files_to_new_partition(args) -- postpone 10m defarable-reboot - os.execute("awk '{print $1 + 600}' /proc/uptime > /tmp/deferable-reboot.defer") + os.execute("awk '{print $1 + 600}' /proc/uptime > /tmp/deferrable-reboot.defer") print(string.format("erasing partition %d", partitions.other)) os.execute(string.format("mtd erase fw%d", partitions.other)) diff --git a/tests/utils.lua b/tests/utils.lua index ed64806fa..ae1a81a9e 100644 --- a/tests/utils.lua +++ b/tests/utils.lua @@ -11,7 +11,7 @@ UCI_CONFIG_FILES = { "6relayd", "babeld", "batman-adv", "check-date", "dhcp", "dropbear", "fstab", "firewall", "libremap", "lime", "lime-app", "location", "luci", "network", "pirania", "rpcd", "shared-state", "system", "ucitrack", - "uhttpd", "wireless", "deferable-reboot", config.UCI_AUTOGEN_NAME, config.UCI_NODE_NAME, + "uhttpd", "wireless", "deferrable-reboot", config.UCI_AUTOGEN_NAME, config.UCI_NODE_NAME, config.UCI_COMMUNITY_NAME, config.UCI_DEFAULTS_NAME }