#!/bin/sh _check_wine() { wine_exe="$1" ls "${wine_exe}" >/dev/null 2>/dev/null } _exec_wine() { wine_exe="$1" wine_exe2="${wine_exe%/*}" wine_exe2="${wine_exe2}/SOOPStreamer.exe" echo 'Executing Soop...' wine "${wine_exe}" # wine "${wine_exe2}" } _install_wine() { # Source URL for the SOOPStreamer installer src_url='https://creatorup.sooplive.co.kr/SOOPStreamer_installer.exe' # Create a temporary file for the installer dst_file="$(mktemp)" # Ensure the temporary file is removed after the script finishes trap 'rm -f "$dst_file"' EXIT # Set a temporary HOME for the Wine process to avoid conflicts home_origin="$HOME" home_patch="$WINEPREFIX/tmp" export HOME="$home_patch" # Download the installer echo 'Downloading SOOP Streamer installer...' curl -s "$src_url" -o "$dst_file" || { echo "Failed to download installer!" exit 1 } # Initialize Wine environment with win32 architecture echo 'Initializing Wine environment...' wineboot >/dev/null 2>&1 # Check if winetricks is installed, if not, install it if ! command -v winetricks >/dev/null; then sudo pacman --noconfirm --needed -S winetricks || { echo "Failed to install winetricks!" exit 1 } fi # Install necessary libraries via winetricks echo "Installing required libraries via winetricks..." if ! winetricks -q mfc42 vcrun2008; then echo "Failed to install required libraries!" exit 1 fi # Run the SOOP Streamer installer without sudo echo 'Running the SOOP Streamer installer...' wine "$dst_file" /S >/dev/null 2>&1 && success=true || success=false # Clean up temporary Wine HOME directory echo 'Cleaning up...' rm -rf "$home_patch" # Restore original HOME and WINEARCH variables export HOME="$home_origin" # Check success status and print the result if $success; then echo 'Installation completed successfully.' else echo 'Installation failed!' fi } # Define a main function main() { # Configure environment variables export LANG='en_US.UTF-8' export LC_ALL='en_US.UTF-8' export WINEARCH='win32' export WINEPREFIX="${WINEPREFIX:-${XDG_DATA_HOME:-${HOME}/.local/share}/wine}/soop" # Install wine_exe="${WINEPREFIX}/drive_c/users/$(whoami)/AppData/Local/SOOP/SOOPPackage.exe" if ! _check_wine "${wine_exe}"; then _install_wine "${wine_exe}" fi # Exec _exec_wine "${wine_exe}" } main