Files
CosmicScale 13813c3c62 Multilingual Support
PSBBN Installer:
- Add an option to select a language when installing PSBBN
- Install Japanese online game channels when Japanese is selected

PSBBN Updater:
- Install updates for the PSBBN System Software and language pack
- Install updates for online channels when the language is set to Japanese

Optional Extras:
- Add an option to change the PSBBN language in the Optional Extras menu

Game Installer:
- Display Japanese-region game titles in Japanese and sort them in gojūon (五十音) order when Japanese is selected
- Install the POPS IGR message for the selected language
- Install PS1 game manuals for the selected language

TitlesDB_PS1.csv and TitlesDB_PS2.csv:
- Add Japanese titles for all Japanese-region games

list-builder.py:
- Update to handle Japanese game titles

General:
- Add libicu-dev and pkg-config to the dependencies
2026-01-08 17:20:53 +00:00

106 lines
4.2 KiB
Bash
Executable File

#!/usr/bin/env bash
if [[ "$LAUNCHED_BY_MAIN" != "1" ]]; then
echo "This script should not be run directly. Please run: PSBBN-Definitive-Patch.sh"
exit 1
fi
trap 'echo; exit 130' INT
TOOLKIT_PATH="$(pwd)"
SOURCES_LIST="/etc/apt/sources.list"
LOG_FILE="${TOOLKIT_PATH}/logs/setup.log"
error_msg() {
echo
echo
echo "[X] Error: $1" | tee -a "${LOG_FILE}"
echo
read -n 1 -s -r -p "Press any key to exit..."
echo
exit 1
}
spinner() {
local pid=$1
local message=$2
local delay=0.1
local spinstr='|/-\'
# Print initial spinner + message
printf "\r[%c] %s" "${spinstr:0:1}" "$message"
while kill -0 "$pid" 2>/dev/null; do
for i in $(seq 0 3); do
printf "\r[%c] %s" "${spinstr:i:1}" "$message"
sleep $delay
done
done
# Replace spinner with check mark when done
printf "\r[✓] %s\n" "$message"
}
clear
mkdir -p "${TOOLKIT_PATH}/logs" >/dev/null 2>&1
# Clean sources.list if needed
if [[ -f "$SOURCES_LIST" ]]; then
if grep -q 'deb cdrom' "$SOURCES_LIST"; then
echo "Removing 'deb cdrom' line from $SOURCES_LIST..." >>"${LOG_FILE}"
sudo sed -i '/deb cdrom/d' "$SOURCES_LIST" >> "${LOG_FILE}" 2>&1 || error_msg "Failed to clean $SOURCES_LIST"
echo "'deb cdrom' line removed." >> "${LOG_FILE}"
fi
fi
cat << "EOF"
_____ _
/ ___| | |
\ `--. ___| |_ _ _ _ __
`--. \/ _ \ __| | | | '_ \
/\__/ / __/ |_| |_| | |_) |
\____/ \___|\__|\__,_| .__/
| |
|_|
Installing Dependences:
EOF
# Detect package manager and install packages
if [ -x "$(command -v apt-get)" ]; then
sudo apt-get -q update && sudo apt-get install -y axel imagemagick xxd python3 python3-venv python3-pip bc rsync curl zip unzip wget ffmpeg lvm2 libfuse2 dosfstools e2fsprogs libc-bin exfatprogs exfat-fuse util-linux parted bchunk libicu-dev pkg-config 2>&1 | tee -a "${LOG_FILE}"
# Or if user is on Fedora-based system, do this instead
elif [ -x "$(command -v dnf)" ]; then
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm 2>&1 | tee -a "${LOG_FILE}"
sudo dnf install -y gcc axel ImageMagick xxd python3 python3-devel python3-pip bc rsync curl zip unzip wget ffmpeg lvm2 fuse-libs dosfstools e2fsprogs glibc-common exfatprogs fuse-exfat util-linux parted bchunk libicu-devel pkgconf 2>&1 | tee -a "${LOG_FILE}"
# Or if user is on Arch-based system, do this instead
elif [ -x "$(command -v pacman)" ]; then
sudo pacman -S --needed --noconfirm axel imagemagick xxd python pyenv python-pip bc rsync curl zip unzip wget ffmpeg lvm2 fuse2 dosfstools e2fsprogs glibc exfatprogs util-linux parted bchunk icu pkgconf 2>&1 | tee -a "${LOG_FILE}"
elif [ -n "$IN_NIX_SHELL" ]; then
error_msg "Running in Nix environment - packages should be provided by flake and setup should not be run."
else
error_msg "No supported package manager found (apt-get, dnf, pacman)."
fi
if [ $? -ne 0 ]; then
error_msg "Package installation failed. Please update your OS and try again." "See $LOG_FILE for details."
else
echo "[✓] Packages checked/installed." | tee -a "${LOG_FILE}"
fi
# Python virtual environment setup
(
python3 -m venv scripts/venv >> "${LOG_FILE}" 2>&1 || error_msg "Failed to create Python virtual environment."
source scripts/venv/bin/activate || error_msg "Failed to activate the Python virtual environment."
pip install lz4 natsort mutagen tqdm PyICU pykakasi >> "${LOG_FILE}" || error_msg "Failed to install Python dependencies."
deactivate
) &
PID=$!
spinner $PID "Setting up Python virtual environment and installing dependencies..."
echo
echo -n "[✓] Setup completed successfully!" | tee -a "${LOG_FILE}"
sleep 3
echo| tee -a "${LOG_FILE}"