luci-theme-*: set mediaurlbase if it is the first time to be installed 3819/head
authorChen Minqiang <ptpt52@gmail.com>
Fri, 3 Apr 2020 10:10:04 +0000 (18:10 +0800)
committerChen Minqiang <ptpt52@gmail.com>
Fri, 3 Apr 2020 13:44:28 +0000 (21:44 +0800)
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>
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-2020/root/etc/uci-defaults/30_luci-theme-openwrt-2020
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 45e742ad73f9cf6f8e90403549f61cf3fff8909a..7c49acfda9e49ee50b037f623ba10554cbe1972a 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 if [ "$PKG_UPGRADE" != 1 ]; then
+       uci get luci.themes.OpenWrt2020 >/dev/null 2>&1 || \
        uci batch <<-EOF
                set luci.themes.OpenWrt2020=/luci-static/openwrt2020
                set luci.main.mediaurlbase=/luci-static/openwrt2020
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