install_wps.sh

#!/bin/bash # Function to display a message msg() { color=$1 message=$2 echo -e "${color}${message}\e[0m" } # Function to prompt the user to press enter enter() { read -p "Press [Enter] key to continue..." } # Define colors for messages red='\033[0;31m' green='\033[0;32m' white='\033[1;37m' # Check if the required font folder exists and create it if it doesn't ensure_font_directory() { if [ ! -d ~/.fonts ]; then mkdir ~/.fonts fi } # Function to install WPS Office _i() { # Check if WPS Office is already installed. if [ -d "/opt/kingsoft" ]; then clear msg $red "WPS Office is already installed on this system. Please uninstall it first if you wish to reinstall." enter return fi msg $red "Installing WPS Office (no activation required for this download!)" echo -e "\n$green Please ensure that you have a stable internet connection.$white" # Download the WPS Office package for ARM64 architecture wget -c https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/11711/wps-office_11.1.0.11711_arm64.deb -O /opt/wps-office.deb if [ "$?" -eq "0" ]; then sudo dpkg -i /opt/wps-office.deb msg $green "WPS Office has been installed successfully!" else msg $red "The download failed. Please check your internet connection or try a different link." enter return fi # Download and install the required WPS Office fonts ensure_font_directory wget -c https://github.com/wachin/wps-office-cn-fonts/releases/download/v11.1.0.11704/wps-office-cn-fonts.7z -O ~/.fonts/wps-office-cn-fonts.7z 7z x ~/.fonts/wps-office-cn-fonts.7z -o~/.fonts/ fc-cache -fv # Install ibus for special character input msg $green "Installing ibus for character input support." sudo apt install ibus ibus-gtk ibus-gtk3 || msg $red "Failed to install ibus." # Changing language settings to Brazilian Portuguese sed -i 's/export LANGUAGE="zh_CN:zh"/export LANGUAGE="pt_BR:pt"/' /usr/bin/wps sed -i 's/export LANGUAGE="zh_CN:zh"/export LANGUAGE="pt_BR:pt"/' /usr/bin/wpspdf sed -i 's/export LANGUAGE="zh_CN:zh"/export LANGUAGE="pt_BR:pt"/' /usr/bin/et sed -i 's/export LANGUAGE="zh_CN:zh"/export LANGUAGE="pt_BR:pt"/' /usr/bin/wpp # Installing MUI msg $green "Installing Multi-Language User Interface packs." wget -c https://github.com/wachin/wps-office-all-mui-win-language/releases/download/v11.1.0.11704/mui.7z -O ~/.local/share/Kingsoft/office6/mui.7z 7z x ~/.local/share/Kingsoft/office6/mui.7z -o~/.local/share/Kingsoft/office6/ msg $green "Installation has been completed! Please restart your computer." enter } # Function to uninstall WPS Office _d() { msg $red "Uninstalling WPS Office..." sudo dpkg -r wps-office msg $green "WPS Office has been uninstalled successfully!" enter } # Presenting the options to the user while : do clear echo "1. Install WPS Office" echo "2. Uninstall WPS Office" echo "3. Exit" read -p "Enter selection [1-3] > " if [[ $REPLY =~ ^[1-3]$ ]]; then case $REPLY in 1) _i ;; 2) _d ;; 3) exit ;; esac else msg $red "Invalid option. Try another one." fi done
https://linux.wps.cn/