diff --git a/target/linux/realtek/base-files/etc/init.d/rtk_upgrade b/target/linux/realtek/base-files/etc/init.d/rtk_upgrade index 9b8fc47aef..ec45e2093e 100755 --- a/target/linux/realtek/base-files/etc/init.d/rtk_upgrade +++ b/target/linux/realtek/base-files/etc/init.d/rtk_upgrade @@ -62,6 +62,19 @@ clean_tmp_files() { rm -rf /tmp/romopkgstatus } +clean_themes() { + local line + local name + local path + uci show luci.themes | tail -n +2 | sed "s/^luci.themes.//g; s/'//g" | while read; do + line="$REPLY" + name=`echo "$line" | cut -d= -f 1` + path=`echo "$line" | cut -d= -f 2` + [ "x$path" != "x" -a -d /www$path ] || uci delete "luci.themes.$name" + done + uci commit luci +} + boot() { [ -f /.recovery_mode ] && return 0 @@ -70,5 +83,7 @@ boot() { split_both_status rebuild_opkg_status > /usr/lib/opkg/status clean_tmp_files + + clean_themes fi } diff --git a/target/linux/realtek/base-files/etc/uci-defaults/08_upgrade21 b/target/linux/realtek/base-files/etc/uci-defaults/08_upgrade21 index e907ea91fb..aca38b6121 100644 --- a/target/linux/realtek/base-files/etc/uci-defaults/08_upgrade21 +++ b/target/linux/realtek/base-files/etc/uci-defaults/08_upgrade21 @@ -1,5 +1,44 @@ #!/bin/sh +nonconf_files_of_pkg() { + local pkgname="$1" + if [ -s /overlay/upper/usr/lib/opkg/info/${pkgname}.conffiles ]; then + grep -hvxFf /overlay/upper/usr/lib/opkg/info/${pkgname}.conffiles \ + /overlay/upper/usr/lib/opkg/info/${pkgname}.list + else + cat /overlay/upper/usr/lib/opkg/info/${pkgname}.list + fi +} + +reset_pkg() { + local pkgname="$1" + local line + local dep + local deps + if [ -e /overlay/upper/usr/lib/opkg/info/${pkgname}.control ]; then + if [ -f /overlay/upper/usr/lib/opkg/info/${pkgname}.list ]; then + nonconf_files_of_pkg "${pkgname}" | while read; do + line="$REPLY" + rm -f "/overlay/upper/${line}" + done + rm -f /overlay/upper/usr/lib/opkg/info/${pkgname}.list + fi + if [ -f /overlay/upper/usr/lib/opkg/info/${pkgname}.control ]; then + deps=`grep '^Depends: ' /overlay/upper/usr/lib/opkg/info/${pkgname}.control | dd bs=1 skip=8 2>/dev/null | sed 's/,/ /g'` + mv /overlay/upper/usr/lib/opkg/info/${pkgname}.control /overlay/upper/usr/lib/opkg/info/${pkgname}.delcontrol + for dep in $deps ; do + reset_pkg "$dep" + done + fi + rm -f /overlay/upper/usr/lib/opkg/info/${pkgname}.* + fi +} + +if [ -e /dev/console ]; then + exec >> /dev/console + exec 2>&1 +fi + if ! [ -f /etc/uci-defaults/09_realtek ]; then if [ -f /etc/config/dockerd -a -f /etc/config/dockerman ]; then local docker_root=`uci get dockerman.local.daemon_data_root` @@ -19,6 +58,17 @@ if ! [ -f /etc/uci-defaults/09_realtek ]; then commit ucitrack EOF rm -f /overlay/upper/usr/lib/lua/luci/view/cbi/dynlist.htm + + for pkg in luci-app-ttyd luci-i18n-ttyd-zh-cn luci-app-argon-config luci-i18n-argon-config-zh-cn \ + luci-theme-argon luci-theme-argon-18.06 luci-base uhttpd iptables firewall ip-full dnsmasq-full \ + netifd odhcp6c ppp wireguard-tools luci-proto-ppp luci-proto-ipv6 luci-proto-wireguard ; do + reset_pkg "$pkg" + done + uci -q batch <<-EOF >/dev/null + set luci.themes.Argon=/luci-static/argon + commit luci +EOF + fi rm -f /overlay/upper/usr/lib/lua/luci/dispatcher.lua @@ -41,3 +91,5 @@ uci -q batch <<-EOF >/dev/null set argon.@global[0].mode=light commit argon EOF + +exit 0