Skip to content

Commit 714111a

Browse files
committed
feat: support for china mainland
1 parent 53e3826 commit 714111a

4 files changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export LANG=zh_CN.UTF-8
2+
export LANGUAGE=zh_CN:zh
3+
export LC_CTYPE=zh_CN.UTF-8
4+
export GTK_IM_MODULE=ibus
5+
export QT_IM_MODULE=ibus
6+
export XMODIFIERS=@im=ibus
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
MIRROR="${1:-https://mirrors.tuna.tsinghua.edu.cn/debian}"
5+
SECURITY_MIRROR="${2:-https://mirrors.tuna.tsinghua.edu.cn/debian-security}"
6+
7+
if [ "$(id -u)" -ne 0 ]; then
8+
echo "Please run as root: sudo vanilla-cn-use-mirrors" >&2
9+
exit 1
10+
fi
11+
12+
find /etc/apt -type f \( -name '*.list' -o -name '*.sources' \) -print | while IFS= read -r file; do
13+
sed -i \
14+
-e "s|http://deb.debian.org/debian|${MIRROR}|g" \
15+
-e "s|https://deb.debian.org/debian|${MIRROR}|g" \
16+
-e "s|http://security.debian.org/debian-security|${SECURITY_MIRROR}|g" \
17+
-e "s|https://security.debian.org/debian-security|${SECURITY_MIRROR}|g" \
18+
"${file}"
19+
done
20+
21+
apt update
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
IMAGE_DIR="/etc/waydroid-extra/images"
5+
SYSTEM_IMAGE="${IMAGE_DIR}/system.img"
6+
VENDOR_IMAGE="${IMAGE_DIR}/vendor.img"
7+
8+
if [ "$(id -u)" -ne 0 ]; then
9+
echo "Please run as root: sudo waydroid-cn-setup" >&2
10+
exit 1
11+
fi
12+
13+
mkdir -p "${IMAGE_DIR}"
14+
15+
if [ -f "${SYSTEM_IMAGE}" ] && [ -f "${VENDOR_IMAGE}" ]; then
16+
waydroid init -f
17+
else
18+
echo "Missing ${SYSTEM_IMAGE} or ${VENDOR_IMAGE}." >&2
19+
echo "Download a matching Waydroid system/vendor image pair and place them in ${IMAGE_DIR}, then run this command again." >&2
20+
exit 2
21+
fi
22+
23+
systemctl enable --now waydroid-container
24+
25+
if command -v runuser >/dev/null 2>&1 && [ -n "${SUDO_USER:-}" ]; then
26+
runuser -u "${SUDO_USER}" -- waydroid prop set persist.waydroid.multi_windows true || true
27+
runuser -u "${SUDO_USER}" -- waydroid prop set persist.waydroid.fake_wifi '*' || true
28+
else
29+
waydroid prop set persist.waydroid.multi_windows true || true
30+
waydroid prop set persist.waydroid.fake_wifi '*' || true
31+
fi
32+
33+
echo "Waydroid CN setup finished."

recipe.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ stages:
1818
- /var/cache/ldconfig
1919
- /var/cache/man
2020
- /var/log/*
21+
addincludes: true
2122

2223
modules:
2324
- name: init-setup
@@ -26,6 +27,29 @@ stages:
2627
- lpkg --unlock
2728
- apt update
2829

30+
- name: cn-desktop-packages
31+
type: apt
32+
sources:
33+
- packages:
34+
- locales
35+
- tzdata
36+
- ca-certificates
37+
- unzip
38+
- fonts-noto-cjk
39+
- fonts-noto-color-emoji
40+
- ibus-libpinyin
41+
- ibus-rime
42+
43+
- name: cn-defaults
44+
type: shell
45+
commands:
46+
- sed -i 's/^# *zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen
47+
- locale-gen
48+
- ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
49+
- update-ca-certificates
50+
- chmod +x /usr/local/bin/waydroid-cn-setup || true
51+
- chmod +x /usr/local/bin/vanilla-cn-use-mirrors || true
52+
2953
- name: waydroid-repo
3054
type: shell
3155
commands:

0 commit comments

Comments
 (0)