Skip to content

Instantly share code, notes, and snippets.

@david082321
Forked from XargonWan/japanese_locale_enabler.sh
Last active May 11, 2024 04:19
Show Gist options
  • Save david082321/42c5007b21ef11e854a9bb8fc271bbc7 to your computer and use it in GitHub Desktop.
Save david082321/42c5007b21ef11e854a9bb8fc271bbc7 to your computer and use it in GitHub Desktop.
Steam Deck 中文化
#!/bin/bash
# 停用 唯讀模式
sudo steamos-readonly disable
# 初始化 Pacman Keys
sudo pacman-key --init
sudo pacman-key --populate archlinux
# 重新安裝 glibc
sudo pacman -S glibc --noconfirm
# 編輯 locale.gen
sudo sed -i "s%#zh_TW.UTF-8 UTF-8%zh_TW.UTF-8 UTF-8%" /etc/locale.gen
# 生成語言
sudo locale-gen zh_TW zh_TW.UTF-8 zh_CN.UTF-8 ja_JP.UTF-8 en_US.UTF-8
# 安裝程式: kde翻譯套件、plasma
sudo pacman -S ki18n --noconfirm
sudo pacman -S plasma --noconfirm
# 重新安裝所有程式
sudo pacman -Qq > packages.txt
blackPackages=("steam-im-modules steam-jupiter-stable steam_notif_daemon steamdeck-kde-presets steamos-atomupd-client-git steamos-customizations-jupiter steamos-devkit-service steamos-efi steamos-tweak-mtu-probing adobe-source-code-pro-fonts linux-firmware-neptune noto-fonts noto-fonts-cjk qt5-webengine gcc-libs lib32-gcc-libs linux-neptune-61 llvm-libs lib32-llvm-libs git ffmpeg ki18n plasma glibc python python-aiohttp python-aiosignal python-async-timeout python-attrs python-chardet python-charset-normalizer python-click python-crcmod python-evdev python-frozenlist python-gobject python-hid python-idna python-multidict python-progressbar python-psutil python-pyaml python-pyenchant python-pyinotify python-semantic-version python-systemd python-sysv_ipc python-typing_extensions python-utils python-yaml python-yarl")
for pkgName in $(cat ./packages.txt); do
if [[ $blackPackages =~ (^|[[:space:]])$pkgName($|[[:space:]]) ]]; then
echo "跳過 $pkgName"
else
sudo pacman -S $pkgName --noconfirm
fi
done
# 復原唯讀模式
sudo steamos-readonly enable
# 完成提示語
echo "完成!請重新開機套用修改!"
@huangsijun17
Copy link

建议改用rwfus,或可以在汉化后依然能升级系统。

@huangsijun17
Copy link

huangsijun17 commented Feb 1, 2023

@david082321
Copy link
Author

david082321 commented Feb 4, 2023

建议改用rwfus,或可以在汉化后依然能升级系统。

您可以升級系統,但是中文化會遺失。
另外看了一下,有人(在評論區的UP主)說用了rwfus,再去安裝一下系統級的依賴,「可能」會在系統升級後發生衝突導致開不了機。我擔心有人後來自己去安裝別的東西搞壞,所以就不改了。

https://gist.github.com/david082321/42c5007b21ef11e854a9bb8fc271bbc7#file-tw-sh-L18 建议改成for pkgName in $(cat ./packages.txt)

已修正,感謝您

@huangsijun17
Copy link

个人建议,重装时获取已安装的软件包版本,从而不对软件包进行升级。
参考代码如下:

#!/bin/bash

# 保存已安装软件包列表到 packages.txt 文件
pacman -Qq > packages.txt

# 读取 packages.txt 文件中的每个软件包
for pkgName in $(cat packages.txt)
do
  # 获取软件包的版本号
  version=$(pacman -Q "$pkgName" | awk '{print $2}')

  # 重新安装指定版本的软件包
  pacman -S "$pkgName=$version" --noconfirm
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment