xref: /OK3568_Linux_fs/device/rockchip/common/scripts/post-locale.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#!/bin/bash -e
2*4882a593Smuzhiyun
3*4882a593Smuzhiyunsource "${POST_HELPER:-$(dirname "$(realpath "$0")")/../post-hooks/post-helper}"
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunLOCALE="$TARGET_DIR/etc/default/locale"
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun[ -z "$RK_ROOTFS_LOCALE_ORIGINAL" ] || exit 0
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunif [ "$RK_ROOTFS_LOCALE_DEFAULT" -a "$POST_OS" = debian ]; then
10*4882a593Smuzhiyun	echo -e "\e[33mKeep original locale for debian by default\e[0m"
11*4882a593Smuzhiyun	exit 0
12*4882a593Smuzhiyunfi
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunCUSTOM_LANG="${RK_ROOTFS_LOCALE:-en_US.UTF-8}"
15*4882a593Smuzhiyun
16*4882a593Smuzhiyunecho "Setting LANG environment to $CUSTOM_LANG..."
17*4882a593Smuzhiyun
18*4882a593Smuzhiyunif [ -e "$LOCALE" ]; then
19*4882a593Smuzhiyun	sed -i "/\<LANG\>/d" "$LOCALE"
20*4882a593Smuzhiyun	echo "LANG=$CUSTOM_LANG" >> "$LOCALE"
21*4882a593Smuzhiyunelse
22*4882a593Smuzhiyun	mkdir -p "$TARGET_DIR/etc/profile.d"
23*4882a593Smuzhiyun	echo "export LANG=$CUSTOM_LANG" > "$TARGET_DIR/etc/profile.d/lang.sh"
24*4882a593Smuzhiyunfi
25