mirror of
https://github.com/SillyTavern/SillyTavern-Launcher.git
synced 2026-05-01 03:31:31 +00:00
85
install.sh
85
install.sh
@@ -42,13 +42,11 @@ miniconda_path="$HOME/miniconda"
|
|||||||
miniconda_installer="Miniconda3-latest-Linux-x86_64.sh"
|
miniconda_installer="Miniconda3-latest-Linux-x86_64.sh"
|
||||||
|
|
||||||
# Define the paths and filenames for the shortcut creation
|
# Define the paths and filenames for the shortcut creation
|
||||||
shortcutTarget="SillyTavern/st-launcher.sh"
|
script_path="$(realpath "$(dirname "$0")")/launcher.sh"
|
||||||
iconFile="SillyTavern/public/st-launcher.ico"
|
icon_path="$(realpath "$(dirname "$0")")/st-launcher.ico"
|
||||||
desktopPath="$HOME/Desktop"
|
script_name=st-launcher
|
||||||
shortcutName="ST Launcher.desktop"
|
desktop_dir="$(eval echo ~$(logname))/Desktop"
|
||||||
startIn="SillyTavern"
|
desktop_file="$desktop_dir/st-launcher.desktop"
|
||||||
comment="SillyTavern Launcher"
|
|
||||||
|
|
||||||
|
|
||||||
# Function to log messages with timestamps and colors
|
# Function to log messages with timestamps and colors
|
||||||
log_message() {
|
log_message() {
|
||||||
@@ -109,6 +107,10 @@ install_git() {
|
|||||||
# macOS
|
# macOS
|
||||||
log_message "INFO" "Installing Git using Homebrew..."
|
log_message "INFO" "Installing Git using Homebrew..."
|
||||||
brew install git
|
brew install git
|
||||||
|
elif command -v pkg &>/dev/null; then
|
||||||
|
# Termux on Android
|
||||||
|
log_message "INFO" "Installing Git using pkg..."
|
||||||
|
pkg install git
|
||||||
else
|
else
|
||||||
log_message "ERROR" "${red_fg_strong}Unsupported Linux distribution.${reset}"
|
log_message "ERROR" "${red_fg_strong}Unsupported Linux distribution.${reset}"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -172,6 +174,10 @@ install_nodejs_npm() {
|
|||||||
read -p "Press Enter to continue..."
|
read -p "Press Enter to continue..."
|
||||||
nvm install --lts
|
nvm install --lts
|
||||||
nvm use --lts
|
nvm use --lts
|
||||||
|
elif command -v pkg &>/dev/null; then
|
||||||
|
# Termux on Android
|
||||||
|
log_message "INFO" "Installing Node.js and npm using pkg..."
|
||||||
|
pkg install nodejs npm
|
||||||
elif command -v brew &>/dev/null; then
|
elif command -v brew &>/dev/null; then
|
||||||
# macOS
|
# macOS
|
||||||
log_message "INFO" "Installing Node.js and npm using Homebrew..."
|
log_message "INFO" "Installing Node.js and npm using Homebrew..."
|
||||||
@@ -260,6 +266,35 @@ install_st_extras() {
|
|||||||
rm -rf /tmp/$miniconda_installer
|
rm -rf /tmp/$miniconda_installer
|
||||||
log_message "INFO" "${green_fg_strong}SillyTavern + Extras successfully installed.${reset}"
|
log_message "INFO" "${green_fg_strong}SillyTavern + Extras successfully installed.${reset}"
|
||||||
|
|
||||||
|
# Ask if the user wants to create a desktop shortcut
|
||||||
|
read -p "Do you want to create a shortcut on the desktop? [Y/n] " create_shortcut
|
||||||
|
if [[ "${create_shortcut}" == "Y" || "${create_shortcut}" == "y" ]]; then
|
||||||
|
|
||||||
|
# Create the desktop shortcut
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} Creating desktop shortcut..."
|
||||||
|
|
||||||
|
echo "[Desktop Entry]" > "$desktop_file"
|
||||||
|
echo "Version=1.0" >> "$desktop_file"
|
||||||
|
echo "Type=Application" >> "$desktop_file"
|
||||||
|
echo "Name=$script_name" >> "$desktop_file"
|
||||||
|
echo "Exec=$script_path" >> "$desktop_file"
|
||||||
|
echo "Icon=$icon_path" >> "$desktop_file"
|
||||||
|
echo "Terminal=true" >> "$desktop_file"
|
||||||
|
echo "Comment=SillyTavern Launcher" >> "$desktop_file"
|
||||||
|
chmod +x "$desktop_file"
|
||||||
|
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} ${green_fg_strong}Desktop shortcut created at: $desktop_file${reset}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ask if the user wants to start the launcher
|
||||||
|
read -p "Start the launcher now? [Y/n] " start_launcher
|
||||||
|
if [[ "${start_launcher}" == "Y" || "${start_launcher}" == "y" ]]; then
|
||||||
|
# Run the launcher
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} Running launcher in a new window..."
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
chmod +x launcher.sh && ./launcher.sh
|
||||||
|
fi
|
||||||
|
|
||||||
installer
|
installer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +311,35 @@ install_sillytavern() {
|
|||||||
log_message "INFO" "Cloning SillyTavern repository..."
|
log_message "INFO" "Cloning SillyTavern repository..."
|
||||||
git clone https://github.com/SillyTavern/SillyTavern.git
|
git clone https://github.com/SillyTavern/SillyTavern.git
|
||||||
log_message "INFO" "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
log_message "INFO" "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
||||||
read -p "Press Enter to continue..."
|
|
||||||
|
# Ask if the user wants to create a desktop shortcut
|
||||||
|
read -p "Do you want to create a shortcut on the desktop? [Y/n] " create_shortcut
|
||||||
|
if [[ "${create_shortcut}" == "Y" || "${create_shortcut}" == "y" ]]; then
|
||||||
|
|
||||||
|
# Create the desktop shortcut
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} Creating desktop shortcut..."
|
||||||
|
|
||||||
|
echo "[Desktop Entry]" > "$desktop_file"
|
||||||
|
echo "Version=1.0" >> "$desktop_file"
|
||||||
|
echo "Type=Application" >> "$desktop_file"
|
||||||
|
echo "Name=$script_name" >> "$desktop_file"
|
||||||
|
echo "Exec=$script_path" >> "$desktop_file"
|
||||||
|
echo "Icon=$icon_path" >> "$desktop_file"
|
||||||
|
echo "Terminal=true" >> "$desktop_file"
|
||||||
|
echo "Comment=SillyTavern Launcher" >> "$desktop_file"
|
||||||
|
chmod +x "$desktop_file"
|
||||||
|
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} ${green_fg_strong}Desktop shortcut created at: $desktop_file${reset}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ask if the user wants to start the launcher
|
||||||
|
read -p "Start the launcher now? [Y/n] " start_launcher
|
||||||
|
if [[ "${start_launcher}" == "Y" || "${start_launcher}" == "y" ]]; then
|
||||||
|
# Run the launcher
|
||||||
|
echo -e "${blue_bg}[$(date +%T)]${reset} ${blue_fg_strong}[INFO]${reset} Running launcher in a new window..."
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
chmod +x launcher.sh && ./launcher.sh
|
||||||
|
fi
|
||||||
|
|
||||||
installer
|
installer
|
||||||
}
|
}
|
||||||
@@ -414,6 +477,12 @@ elif command -v emerge &>/dev/null; then
|
|||||||
install_git
|
install_git
|
||||||
install_nodejs_npm
|
install_nodejs_npm
|
||||||
installer
|
installer
|
||||||
|
elif command -v pkg &>/dev/null; then
|
||||||
|
log_message "INFO" "${blue_fg_strong}Detected pkg System${reset}"
|
||||||
|
# pkg
|
||||||
|
install_git
|
||||||
|
install_nodejs_npm
|
||||||
|
installer
|
||||||
else
|
else
|
||||||
log_message "ERROR" "${red_fg_strong}Unsupported package manager. Cannot detect Linux distribution.${reset}"
|
log_message "ERROR" "${red_fg_strong}Unsupported package manager. Cannot detect Linux distribution.${reset}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
25
launcher.sh
25
launcher.sh
@@ -223,9 +223,15 @@ start_st() {
|
|||||||
detected_terminal=$(find_terminal)
|
detected_terminal=$(find_terminal)
|
||||||
log_message "INFO" "Found terminal: $detected_terminal"
|
log_message "INFO" "Found terminal: $detected_terminal"
|
||||||
# Enable read p command for troubleshooting
|
# Enable read p command for troubleshooting
|
||||||
# read -p "Press Enter to continue..."
|
# read -p "Press Enter to continue..."
|
||||||
|
|
||||||
# Start SillyTavern in the detected terminal
|
# Start SillyTavern in the detected terminal
|
||||||
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern && ./start.sh" &
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
log_message "INFO" "Detected macOS. Opening new Terminal window."
|
||||||
|
open -a Terminal "$(dirname "$0")/start.sh"
|
||||||
|
else
|
||||||
|
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern && ./start.sh" &
|
||||||
|
fi
|
||||||
|
|
||||||
home
|
home
|
||||||
}
|
}
|
||||||
@@ -240,10 +246,17 @@ start_st_extras() {
|
|||||||
detected_terminal=$(find_terminal)
|
detected_terminal=$(find_terminal)
|
||||||
log_message "INFO" "Found terminal: $detected_terminal"
|
log_message "INFO" "Found terminal: $detected_terminal"
|
||||||
# Enable read p command for troubleshooting
|
# Enable read p command for troubleshooting
|
||||||
# read -p "Press Enter to continue..."
|
# read -p "Press Enter to continue..."
|
||||||
# Start SillyTavern + extras in the detected terminal
|
|
||||||
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern && ./start.sh" &
|
# Start SillyTavern in the detected terminal
|
||||||
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern-extras && ./start.sh" &
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
log_message "INFO" "Detected macOS. Opening new Terminal window."
|
||||||
|
open -a Terminal "$(dirname "$0")/start.sh"
|
||||||
|
open -a Terminal "$(dirname "$0")/SillyTavern-extras/start.sh"
|
||||||
|
else
|
||||||
|
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern && ./start.sh" &
|
||||||
|
exec "$detected_terminal" -e "cd $(dirname "$0")./SillyTavern-extras && ./start.sh" &
|
||||||
|
fi
|
||||||
|
|
||||||
home
|
home
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user