Skip to content

Instantly share code, notes, and snippets.

@joustonhuang
Forked from david082321/tw.sh
Last active June 9, 2023 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joustonhuang/261801e0c3e96cbfd382468c165aae2b to your computer and use it in GitHub Desktop.
Save joustonhuang/261801e0c3e96cbfd382468c165aae2b to your computer and use it in GitHub Desktop.
Steam Deck 中文化
#!/bin/bash
# Disable readonly mode
sudo steamos-readonly disable
# Initiate Pacman Keys
sudo pacman-key --init
sudo pacman-key --populate archlinux
Localization (){
# reinstall glibc
echo "Localization..."
sudo pacman -S glibc --noconfirm
# edit locale.gen
sudo sed -i "s%#zh_TW.UTF-8 UTF-8%zh_TW.UTF-8 UTF-8%" /etc/locale.gen
# regenerate languages
sudo locale-gen zh_TW zh_TW.UTF-8 zh_CN.UTF-8 ja_JP.UTF-8 en_US.UTF-8
# install: kde zh-TW, plasma
sudo pacman -S ki18n --noconfirm
sudo pacman -S plasma --noconfirm
# reinstall all programs for Chinese localization
sudo pacman -Qq > packages.txt
for pkgName in $(cat ./packages.txt)
do
sudo pacman -S $pkgName --noconfirm
done
}
AddPrinters(){
echo "Adding Printers... "
# Add CUPS printers source: LittleJawa https://steamcommunity.com/app/1675200/discussions/2/3273562123582957766/?ctp=2
sudo pacman -Sy cups print-manager system-config-printer nss-mdns foomatic-db-engine foomatic-db-ppds foomatic-db-nonfree-ppds hplip ghostscript cups-filters --noconfirm
sudo systemctl enable --now avahi-daemon
sudo systemctl enable --now cups
# Now, to add a printer: use the GUI from settings, or from your internet browser with http://localhost:631/admin
}
# confirm which task to proceed
echo -n "Localization(c), Setup Printers(p), Quit or Both(Y) [Y]: "
DEFAULT="y"
read -e -p "Proceed [Y/c/p/q]:" PROCEED
# adopt the default, if 'enter' given
PROCEED="${PROCEED:-${DEFAULT}}"
# change to lower case to simplify following if
PROCEED="${PROCEED,,}"
# condition for specific letter
if [ "${PROCEED}" == "q" ] ; then
echo "Quitting"
exit
# condition for non specific letter (ie anything other than q/y)
# if you want to have the active 'y' code in the last section
elif [ "${PROCEED}" == "c" ] ; then
echo "Localization... "
Localization
elif [ "${PROCEED}" == "p" ] ; then
echo "Add Printers... "
AddPrinters
else
echo "Proceeding"
# do proceeding code in here
AddPrinters
Localization
fi
# Recover from readonly mode
sudo steamos-readonly enable
# Finishing
echo ""
echo "Done! Please reboot"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment