luci-theme-*: set mediaurlbase if it is the first time to be installed
authorChen Minqiang <ptpt52@gmail.com>
Fri, 3 Apr 2020 10:10:04 +0000 (18:10 +0800)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:49 +0000 (19:40 +0200)
If we build multi-themes into firmware, each of them set itself
to be the default theme, what theme should it be?

To make it clear, we only set mediaurlbase if the theme is the
first time to be installed/built-in.

This resolve the issue that theme always change to somewhat default
after upgrading the firmware even with a config-keep-upgrade

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
(backported from commit fc150636b9393e31aa7d5a8d8320b111476ba2f1)

themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap
themes/luci-theme-material/root/etc/uci-defaults/30_luci-theme-material
themes/luci-theme-openwrt/root/etc/uci-defaults/30_luci-theme-openwrt
themes/luci-theme-rosy/root/etc/uci-defaults/30_luci-theme-rosy

index b5161843fea9b3eef064ce4f56a4f0612a8e7349..4381a15c2e7d1185dd4e32ac3399a0fa73c2cae8 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 if [ "$PKG_UPGRADE" != 1 ]; then
+       uci get luci.themes.Bootstrap >/dev/null 2>&1 || \
        uci batch <<-EOF
                set luci.themes.Bootstrap=/luci-static/bootstrap
                set luci.main.mediaurlbase=/luci-static/bootstrap
index 96ab461859f1ec648cda161e56b605530f2b73cf..7f07239ec0aa3601f2fced8c250ce8abd433fdf9 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 if [ "$PKG_UPGRADE" != 1 ]; then
+       uci get luci.themes.Material >/dev/null 2>&1 || \
        uci batch <<-EOF
                set luci.themes.Material=/luci-static/material
                set luci.main.mediaurlbase=/luci-static/material
index 77e2f6064bf77cf1b5809e5a3c1c88ca1557b2c2..7ee8c193d79b9b91cd9827695340ce9cd4f7e653 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 if [ "$PKG_UPGRADE" != 1 ]; then
+       uci get luci.themes.OpenWrt >/dev/null 2>&1 || \
        uci batch <<-EOF
                set luci.themes.OpenWrt=/luci-static/openwrt.org
                set luci.main.mediaurlbase=/luci-static/openwrt.org
index ab0299a9c3c8c2eff538e4aa41c86fa30dc02c99..8c21ddddd661c2906117a48ca383a136886bcf66 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 if [ "$PKG_UPGRADE" != 1 ]; then
+       uci get luci.themes.Rosy >/dev/null 2>&1 || \
        uci batch <<-EOF
                set luci.themes.Rosy=/luci-static/rosy
                set luci.main.mediaurlbase=/luci-static/rosy