From: Chen Minqiang Date: Fri, 3 Apr 2020 10:10:04 +0000 (+0800) Subject: luci-theme-*: set mediaurlbase if it is the first time to be installed X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a47df9f07846903fc1dd6bbec7d3c079d13f679;p=oweals%2Fluci.git 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 (backported from commit fc150636b9393e31aa7d5a8d8320b111476ba2f1) --- diff --git a/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap b/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap index b5161843f..4381a15c2 100755 --- a/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap +++ b/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap @@ -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 diff --git a/themes/luci-theme-material/root/etc/uci-defaults/30_luci-theme-material b/themes/luci-theme-material/root/etc/uci-defaults/30_luci-theme-material index 96ab46185..7f07239ec 100755 --- a/themes/luci-theme-material/root/etc/uci-defaults/30_luci-theme-material +++ b/themes/luci-theme-material/root/etc/uci-defaults/30_luci-theme-material @@ -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 diff --git a/themes/luci-theme-openwrt/root/etc/uci-defaults/30_luci-theme-openwrt b/themes/luci-theme-openwrt/root/etc/uci-defaults/30_luci-theme-openwrt index 77e2f6064..7ee8c193d 100755 --- a/themes/luci-theme-openwrt/root/etc/uci-defaults/30_luci-theme-openwrt +++ b/themes/luci-theme-openwrt/root/etc/uci-defaults/30_luci-theme-openwrt @@ -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 diff --git a/themes/luci-theme-rosy/root/etc/uci-defaults/30_luci-theme-rosy b/themes/luci-theme-rosy/root/etc/uci-defaults/30_luci-theme-rosy index ab0299a9c..8c21ddddd 100755 --- a/themes/luci-theme-rosy/root/etc/uci-defaults/30_luci-theme-rosy +++ b/themes/luci-theme-rosy/root/etc/uci-defaults/30_luci-theme-rosy @@ -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