luci-theme-*: set mediaurlbase if it is the first time to be installed

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>
This commit is contained in:
Chen Minqiang 2020-04-03 18:10:04 +08:00
parent 3c4bc228a1
commit fc150636b9
5 changed files with 5 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.Bootstrap >/dev/null 2>&1 || \
uci batch <<-EOF uci batch <<-EOF
set luci.themes.Bootstrap=/luci-static/bootstrap set luci.themes.Bootstrap=/luci-static/bootstrap
set luci.main.mediaurlbase=/luci-static/bootstrap set luci.main.mediaurlbase=/luci-static/bootstrap

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.Material >/dev/null 2>&1 || \
uci batch <<-EOF uci batch <<-EOF
set luci.themes.Material=/luci-static/material set luci.themes.Material=/luci-static/material
set luci.main.mediaurlbase=/luci-static/material set luci.main.mediaurlbase=/luci-static/material

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.OpenWrt2020 >/dev/null 2>&1 || \
uci batch <<-EOF uci batch <<-EOF
set luci.themes.OpenWrt2020=/luci-static/openwrt2020 set luci.themes.OpenWrt2020=/luci-static/openwrt2020
set luci.main.mediaurlbase=/luci-static/openwrt2020 set luci.main.mediaurlbase=/luci-static/openwrt2020

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.OpenWrt >/dev/null 2>&1 || \
uci batch <<-EOF uci batch <<-EOF
set luci.themes.OpenWrt=/luci-static/openwrt.org set luci.themes.OpenWrt=/luci-static/openwrt.org
set luci.main.mediaurlbase=/luci-static/openwrt.org set luci.main.mediaurlbase=/luci-static/openwrt.org

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.Rosy >/dev/null 2>&1 || \
uci batch <<-EOF uci batch <<-EOF
set luci.themes.Rosy=/luci-static/rosy set luci.themes.Rosy=/luci-static/rosy
set luci.main.mediaurlbase=/luci-static/rosy set luci.main.mediaurlbase=/luci-static/rosy