[v2,15/15] bsp/default: remove/update etc/config/system

Submitted by Tim Niemeyer on Feb. 5, 2017, 6:13 p.m.

Details

Message ID 1486318428-7226-16-git-send-email-tim@tn-x.org
State Superseded
Headers show

Commit Message

Tim Niemeyer Feb. 5, 2017, 6:13 p.m.
- This will fix the LEDs on LEDE
- We will lose the power heartbeat trigger on the LED
- We will lose the VPN signaling on the LEDs

While remove the default system config, the LEDE system now
configures wrong ntp service. We fix this by deleting these
entries in the fff-timeserver package.

If the file is already present on the devices, we need to upgrade it.
Therefore the 05-config-system-migration is now part of the fff-sysupgrade
package.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
---

Changes in v2:
- New patch

 bsp/default/root_file_system/etc/config/system.tpl | 29 ----------------------
 .../etc/uci-defaults/05-config-system-migration    | 20 +++++++++++++++
 .../files/lib/functions/fff/timeserver             |  1 +
 3 files changed, 21 insertions(+), 29 deletions(-)
 delete mode 100644 bsp/default/root_file_system/etc/config/system.tpl
 create mode 100644 src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration

Patch hide | download patch | download mbox

diff --git a/bsp/default/root_file_system/etc/config/system.tpl b/bsp/default/root_file_system/etc/config/system.tpl
deleted file mode 100644
index 47e1a74..0000000
--- a/bsp/default/root_file_system/etc/config/system.tpl
+++ /dev/null
@@ -1,29 +0,0 @@ 
-config 'system'
-	option 'hostname' 'OpenWrt'
-	option 'timezone' 'CET-1CEST,M3.5.0,M10.5.0/3'
-
-config 'led' 'status_led_green'
-	option 'name' 'status'
-	option 'sysfs' 'tp-link:green:system'
-	option 'trigger' 'heartbeat'
-
-config 'led' 'status_led_blue'
-	option 'name' 'status'
-	option 'sysfs' 'tp-link:blue:system'
-	option 'trigger' 'heartbeat'
-
-config 'led' 'led_vpn_green'
-	option 'name' 'VPN'
-	option 'sysfs' 'tp-link:green:qss'
-	option 'trigger' 'netdev'
-	option 'dev' '${VPN_PROJECT}VPN'
-	option 'mode' 'link'
-
-config 'led' 'led_vpn_blue'
-	option 'name' 'VPN'
-	option 'sysfs' 'tp-link:blue:qss'
-	option 'trigger' 'netdev'
-	option 'dev' '${VPN_PROJECT}VPN'
-	option 'mode' 'link'
-
-# vim: noexpandtab
\ No newline at end of file
diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
new file mode 100644
index 0000000..653b5f1
--- /dev/null
+++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
@@ -0,0 +1,20 @@ 
+#!/bin/sh
+
+UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
+UPGRADE_description=$(uci -q get "system.@system[0].description")
+UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
+UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
+UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
+UPGRADE_contact=$(uci -q get "system.@system[0].contact")
+
+/bin/rm -rf /etc/config/system
+
+/bin/config_generate
+
+uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
+uci -q set "system.@system[0].description=${UPGRADE_description}"
+uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
+uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
+uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
+uci -q set "system.@system[0].contact=${UPGRADE_contact}"
+
diff --git a/src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver b/src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver
index fb69e71..d25b9be 100644
--- a/src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver
+++ b/src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver
@@ -12,6 +12,7 @@  setTimeserver() {
 	local ntp=$1
 
 	uci batch <<-__EOF__
+		delete system.ntp
 		set system.ntp='timeserver'
 		add_list system.ntp.server='$ntp'
 		set system.ntp.enable_server='0'