default-settings: make chinese optimization parts optional

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2021-05-23 22:34:32 +08:00
parent c221fa3cea
commit 9e5ea394a7
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 26 additions and 10 deletions

View File

@ -12,9 +12,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=default-settings
PKG_VERSION:=1.1
PKG_RELEASE:=61
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
PKG_RELEASE:=$(COMMITCOUNT)
PKG_LICENSE:=GPL-3.0
PKG_CONFIG_DEPENDS:=CONFIG_DEFAULT_SETTINGS_OPTIMIZE_FOR_CHINESE
include $(INCLUDE_DIR)/package.mk
@ -23,7 +25,14 @@ define Package/default-settings
CATEGORY:=LuCI
TITLE:=LuCI support for Default Settings
PKGARCH:=all
DEPENDS:=+luci-base +@LUCI_LANG_en +@LUCI_LANG_zh-cn
DEPENDS:=+luci-base +@LUCI_LANG_en
endef
define Package/default-settings/config
config DEFAULT_SETTINGS_OPTIMIZE_FOR_CHINESE
bool "Optimize for mainland China users"
select LUCI_LANG_zh-cn
default y
endef
define Package/default-settings/description
@ -31,7 +40,6 @@ define Package/default-settings/description
endef
define Build/Compile
true
endef
define Package/default-settings/install
@ -41,9 +49,13 @@ define Package/default-settings/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/zzz-default-settings $(1)/etc/uci-defaults/99-default-settings
ifeq ($(CONFIG_DEFAULT_SETTINGS_OPTIMIZE_FOR_CHINESE),y)
$(INSTALL_BIN) ./files/zzz-default-settings-chinese $(1)/etc/uci-defaults/99-default-settings-chinese
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
po2lmo ./i18n/default.zh-cn.po $(1)/usr/lib/lua/luci/i18n/default.zh-cn.lmo
po2lmo ./i18n/more.zh-cn.po $(1)/usr/lib/lua/luci/i18n/more.zh-cn.lmo
endif
endef
$(eval $(call BuildPackage,default-settings))

View File

@ -3,10 +3,6 @@
uci set luci.main.lang=auto
uci commit luci
uci set system.@system[0].timezone=CST-8
uci set system.@system[0].zonename=Asia/Shanghai
uci commit system
uci set fstab.@global[0].anon_mount=1
uci commit fstab
@ -29,7 +25,6 @@ sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
ln -sf /sbin/ip /usr/bin/ip
sed -i 's#https://downloads.openwrt.org#https://mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
sed -i '/openwrt_luci/ { s/snapshots/releases\/18.06.9/g; }' /etc/opkg/distfeeds.conf
sed -i "s/# //g" /etc/opkg/distfeeds.conf

View File

@ -0,0 +1,9 @@
#!/bin/sh
uci set system.@system[0].timezone=CST-8
uci set system.@system[0].zonename=Asia/Shanghai
uci commit system
sed -i 's#https://downloads.openwrt.org#https://mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
exit 0