mirror of
https://github.com/SillyTavern/SillyTavern-Launcher.git
synced 2026-04-30 19:21:22 +00:00
added new launcher + bin/bash fix
+ NEW LAUNCHER + better logging + fixed bin/bash bug + added homebrew command for macos
This commit is contained in:
174
install.sh
174
install.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# SillyTavern Installer Script v0.0.1
|
||||
# SillyTavern Installer Script
|
||||
# Created by: Deffcolony
|
||||
#
|
||||
# Description:
|
||||
@@ -21,7 +21,7 @@
|
||||
# Note: Modify the script as needed to fit your requirements.
|
||||
# ----------------------------------------------------------
|
||||
|
||||
title="SillyTavern Installer"
|
||||
echo -e "\033]0;SillyTavern Installer\007"
|
||||
|
||||
# ANSI Escape Code for Colors
|
||||
reset="\033[0m"
|
||||
@@ -50,38 +50,71 @@ startIn="SillyTavern"
|
||||
comment="SillyTavern Launcher"
|
||||
|
||||
|
||||
# Function to log messages with timestamps and colors
|
||||
log_message() {
|
||||
# This is only time
|
||||
current_time=$(date +'%H:%M:%S')
|
||||
# This is with date and time
|
||||
# current_time=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
case "$1" in
|
||||
"INFO")
|
||||
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[INFO]${reset} $2"
|
||||
;;
|
||||
"WARN")
|
||||
echo -e "${yellow_bg}[$current_time]${reset} ${yellow_fg_strong}[WARN]${reset} $2"
|
||||
;;
|
||||
"ERROR")
|
||||
echo -e "${red_bg}[$current_time]${reset} ${red_fg_strong}[ERROR]${reset} $2"
|
||||
;;
|
||||
*)
|
||||
echo -e "${blue_bg}[$current_time]${reset} ${blue_fg_strong}[DEBUG]${reset} $2"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Log your messages test window
|
||||
#log_message "INFO" "Something has been launched."
|
||||
#log_message "WARN" "${yellow_fg_strong}Something is not installed on this system.${reset}"
|
||||
#log_message "ERROR" "${red_fg_strong}An error occurred during the process.${reset}"
|
||||
#log_message "DEBUG" "This is a debug message."
|
||||
#read -p "Press Enter to continue..."
|
||||
|
||||
# Function to install Git
|
||||
install_git() {
|
||||
if ! command -v git &> /dev/null; then
|
||||
echo -e "${yellow_fg_strong}[WARN] Git is not installed on this system.${reset}"
|
||||
log_message "WARN" "${yellow_fg_strong}Git is not installed on this system${reset}"
|
||||
|
||||
if command -v apt-get &>/dev/null; then
|
||||
# Debian/Ubuntu-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Git using apt..."
|
||||
log_message "INFO" "Installing Git using apt..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git
|
||||
elif command -v yum &>/dev/null; then
|
||||
# Red Hat/Fedora-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Git using yum..."
|
||||
log_message "INFO" "Installing Git using yum..."
|
||||
sudo yum install -y git
|
||||
elif command -v apk &>/dev/null; then
|
||||
# Alpine Linux-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Git using apk..."
|
||||
log_message "INFO" "Installing Git using apk..."
|
||||
sudo apk add git
|
||||
elif command -v pacman &>/dev/null; then
|
||||
# Arch Linux-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Git using pacman..."
|
||||
log_message "INFO" "Installing Git using pacman..."
|
||||
sudo pacman -S --noconfirm git
|
||||
elif command -v emerge &>/dev/null; then
|
||||
# Gentoo Linux-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Git using emerge..."
|
||||
log_message "INFO" "Installing Git using emerge..."
|
||||
sudo emerge --ask dev-vcs/git
|
||||
elif command -v brew &>/dev/null; then
|
||||
# macOS
|
||||
log_message "INFO" "Installing Git using Homebrew..."
|
||||
brew install git
|
||||
else
|
||||
echo -e "${red_fg_strong}[ERROR] Unsupported Linux distribution.${reset}"
|
||||
log_message "ERROR" "${red_fg_strong}Unsupported Linux distribution.${reset}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${green_fg_strong}Git is installed.${reset}"
|
||||
log_message "INFO" "${green_fg_strong}Git is installed.${reset}"
|
||||
else
|
||||
echo -e "${blue_fg_strong}[INFO] Git is already installed.${reset}"
|
||||
fi
|
||||
@@ -95,7 +128,7 @@ install_nodejs_npm() {
|
||||
|
||||
if command -v apt-get &>/dev/null; then
|
||||
# Debian/Ubuntu-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Node.js and npm using apt..."
|
||||
log_message "INFO" "Installing Node.js and npm using apt..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y curl
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
@@ -105,7 +138,7 @@ install_nodejs_npm() {
|
||||
nvm use --lts
|
||||
elif command -v yum &>/dev/null; then
|
||||
# Red Hat/Fedora-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Node.js and npm using yum..."
|
||||
log_message "INFO" "Installing Node.js and npm using yum..."
|
||||
sudo yum install -y curl
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
@@ -114,7 +147,7 @@ install_nodejs_npm() {
|
||||
nvm use --lts
|
||||
elif command -v apk &>/dev/null; then
|
||||
# Alpine Linux-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Node.js and npm using apk..."
|
||||
log_message "INFO" "Installing Node.js and npm using apk..."
|
||||
sudo apk add curl
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
@@ -123,7 +156,7 @@ install_nodejs_npm() {
|
||||
nvm use --lts
|
||||
elif command -v pacman &>/dev/null; then
|
||||
# Arch Linux-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Node.js and npm using pacman..."
|
||||
log_message "INFO" "Installing Node.js and npm using pacman..."
|
||||
sudo pacman -S --noconfirm curl
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
@@ -132,15 +165,19 @@ install_nodejs_npm() {
|
||||
nvm use --lts
|
||||
elif command -v emerge &>/dev/null; then
|
||||
# Gentoo-based system
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Node.js and npm using emerge..."
|
||||
log_message "INFO" "Installing Node.js and npm using emerge..."
|
||||
sudo emerge -av net-misc/curl
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
read -p "Press Enter to continue..."
|
||||
nvm install --lts
|
||||
nvm use --lts
|
||||
elif command -v brew &>/dev/null; then
|
||||
# macOS
|
||||
log_message "INFO" "Installing Node.js and npm using Homebrew..."
|
||||
brew install node
|
||||
else
|
||||
echo -e "${red_fg_strong}[ERROR] Unsupported Linux distribution.${reset}"
|
||||
log_message "ERROR" "${red_fg_strong}Unsupported Linux distribution.${reset}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -153,18 +190,19 @@ install_nodejs_npm() {
|
||||
|
||||
|
||||
# Function to install SillyTavern + Extras
|
||||
installstextras() {
|
||||
install_st_extras() {
|
||||
echo -e "\033]0;SillyTavern [INSTALL-ST-EXTRAS]\007"
|
||||
clear
|
||||
echo -e "${blue_fg_strong}/ Installer / SillyTavern + Extras${reset}"
|
||||
echo "---------------------------------------------------------------"
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing SillyTavern + Extras..."
|
||||
log_message "INFO" "Installing SillyTavern + Extras..."
|
||||
echo -e "${cyan_fg_strong}This may take a while. Please be patient.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing SillyTavern..."
|
||||
log_message "INFO" "Installing SillyTavern..."
|
||||
git clone https://github.com/SillyTavern/SillyTavern.git
|
||||
echo -e "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
||||
log_message "INFO" "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Extras..."
|
||||
log_message "INFO" "Installing Extras..."
|
||||
|
||||
# Download the Miniconda installer script
|
||||
wget https://repo.anaconda.com/miniconda/$miniconda_installer -P /tmp
|
||||
@@ -177,49 +215,55 @@ installstextras() {
|
||||
export PATH="$miniconda_path/bin:$PATH"
|
||||
|
||||
# Activate Conda environment
|
||||
log_message "INFO" "Activating Miniconda environment..."
|
||||
source $miniconda_path/etc/profile.d/conda.sh
|
||||
|
||||
# Create and activate the Conda environment
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Creating a Conda environment..."
|
||||
log_message "INFO" "Disabling conda auto activate..."
|
||||
conda config --set auto_activate_base false
|
||||
conda init bash
|
||||
|
||||
log_message "INFO" "Creating Conda environment sillytavernextras..."
|
||||
conda create -n sillytavernextras -y
|
||||
|
||||
log_message "INFO" "Activating Conda environment sillytavernextras..."
|
||||
conda activate sillytavernextras
|
||||
echo -e "${green_fg_strong}Conda environment created.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Python 3.11 and Git in the Conda environment..."
|
||||
log_message "INFO" "Installing Python and Git in the Conda environment..."
|
||||
conda install python=3.11 git -y
|
||||
echo -e "${green_fg_strong}Python 3.11 and Git installed.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Cloning the SillyTavern Extras repository..."
|
||||
log_message "INFO" "Cloning SillyTavern-extras repository..."
|
||||
git clone https://github.com/SillyTavern/SillyTavern-extras.git
|
||||
echo -e "${green_fg_strong}SillyTavern Extras repository cloned.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Python dependencies..."
|
||||
cd SillyTavern-extras
|
||||
|
||||
log_message "INFO" "Installing pip requirements-complete..."
|
||||
pip install -r requirements-complete.txt
|
||||
|
||||
log_message "INFO" "Installing pip requirements-rvc..."
|
||||
pip install -r requirements-rvc.txt
|
||||
|
||||
echo -e "${cyan_fg_strong}Yes, If you are seeing errors about Numpy and Librosa then that is completely normal. If facebook updates their fairseq library to python 3.11 then this error will not appear anymore.${reset}"
|
||||
# Cleanup the Downloaded file
|
||||
rm -rf /tmp/$miniconda_installer
|
||||
echo -e "${green_fg_strong}SillyTavern + Extras has been successfully installed.${reset}"
|
||||
|
||||
log_message "INFO" "${green_fg_strong}SillyTavern + Extras successfully installed.${reset}"
|
||||
|
||||
installer
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Function to install SillyTavern
|
||||
installsillytavern() {
|
||||
install_sillytavern() {
|
||||
echo -e "\033]0;SillyTavern [INSTALL-ST]\007"
|
||||
clear
|
||||
echo -e "${blue_fg_strong}/ Installer / SillyTavern${reset}"
|
||||
echo "---------------------------------------------------------------"
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing SillyTavern..."
|
||||
echo "--------------------------------"
|
||||
echo -e "${cyan_fg_strong}This may take a while. Please be patient.${reset}"
|
||||
|
||||
log_message "INFO" "Installing SillyTavern..."
|
||||
log_message "INFO" "Cloning SillyTavern repository..."
|
||||
git clone https://github.com/SillyTavern/SillyTavern.git
|
||||
echo -e "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
||||
log_message "INFO" "${green_fg_strong}SillyTavern installed successfully.${reset}"
|
||||
read -p "Press Enter to continue..."
|
||||
|
||||
installer
|
||||
@@ -227,11 +271,12 @@ installsillytavern() {
|
||||
|
||||
|
||||
# Function to install Extras
|
||||
installextras() {
|
||||
install_extras() {
|
||||
echo -e "\033]0;SillyTavern [INSTALL-EXTRAS]\007"
|
||||
clear
|
||||
echo -e "${blue_fg_strong}/ Installer / Extras${reset}"
|
||||
echo "---------------------------------------------------------------"
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Extras..."
|
||||
log_message "INFO" "Installing Extras..."
|
||||
|
||||
# Download the Miniconda installer script
|
||||
wget https://repo.anaconda.com/miniconda/$miniconda_installer -P /tmp
|
||||
@@ -244,30 +289,35 @@ installextras() {
|
||||
export PATH="$miniconda_path/bin:$PATH"
|
||||
|
||||
# Activate Conda environment
|
||||
log_message "INFO" "Activating Miniconda environment..."
|
||||
source $miniconda_path/etc/profile.d/conda.sh
|
||||
|
||||
# Create and activate the Conda environment
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Creating a Conda environment..."
|
||||
log_message "INFO" "Disabling conda auto activate..."
|
||||
conda config --set auto_activate_base false
|
||||
conda init bash
|
||||
|
||||
log_message "INFO" "Creating Conda environment sillytavernextras..."
|
||||
conda create -n sillytavernextras -y
|
||||
|
||||
log_message "INFO" "Activating Conda environment sillytavernextras..."
|
||||
conda activate sillytavernextras
|
||||
echo -e "${green_fg_strong}Conda environment created.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Python 3.11 and Git in the Conda environment..."
|
||||
log_message "INFO" "Installing Python and Git in the Conda environment..."
|
||||
conda install python=3.11 git -y
|
||||
echo -e "${green_fg_strong}Python 3.11 and Git installed.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Cloning the SillyTavern Extras repository..."
|
||||
log_message "INFO" "Cloning SillyTavern-extras repository..."
|
||||
git clone https://github.com/SillyTavern/SillyTavern-extras.git
|
||||
echo -e "${green_fg_strong}SillyTavern Extras repository cloned.${reset}"
|
||||
|
||||
echo -e "${blue_fg_strong}[INFO]${reset} Installing Python dependencies..."
|
||||
cd SillyTavern-extras
|
||||
|
||||
log_message "INFO" "Installing pip requirements-complete..."
|
||||
pip install -r requirements-complete.txt
|
||||
|
||||
log_message "INFO" "Installing pip requirements-rvc..."
|
||||
pip install -r requirements-rvc.txt
|
||||
echo -e "${cyan_fg_strong}Yes, If you are seeing errors about Numpy and Librosa then that is completely normal. If facebook updates their fairseq library to python 3.11 then this error will not appear anymore.${reset}"
|
||||
echo -e "${green_fg_strong}SillyTavern + Extras has been successfully installed.${reset}"
|
||||
log_message "INFO" "${green_fg_strong}SillyTavern + Extras has been successfully installed.${reset}"
|
||||
|
||||
installer
|
||||
}
|
||||
@@ -277,6 +327,7 @@ installextras() {
|
||||
|
||||
# Function for the installer menu
|
||||
installer() {
|
||||
echo -e "\033]0;SillyTavern [INSTALLER]\007"
|
||||
clear
|
||||
echo -e "${blue_fg_strong}/ Installer${reset}"
|
||||
echo "-------------------------------------"
|
||||
@@ -295,11 +346,11 @@ installer() {
|
||||
|
||||
# Installer - Backend
|
||||
if [ "$choice" = "1" ]; then
|
||||
installstextras
|
||||
install_st_extras
|
||||
elif [ "$choice" = "2" ]; then
|
||||
installsillytavern
|
||||
install_sillytavern
|
||||
elif [ "$choice" = "3" ]; then
|
||||
installextras
|
||||
install_extras
|
||||
elif [ "$choice" = "4" ]; then
|
||||
exit
|
||||
else
|
||||
@@ -309,40 +360,51 @@ installer() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if the script is running on macOS
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
IS_MACOS="1"
|
||||
fi
|
||||
|
||||
# Detect the package manager and execute the appropriate installation
|
||||
if [ -n "$IS_MACOS" ]; then
|
||||
log_message "INFO" "${blue_fg_strong}Detected macOS system.${reset}"
|
||||
# macOS
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
# Detect the package manager and execute the appropriate installation
|
||||
if command -v apt-get &>/dev/null; then
|
||||
echo -e "${blue_fg_strong}[INFO] Detected Debian/Ubuntu-based system.${reset}"
|
||||
read -p "Press Enter to continue..."
|
||||
log_message "INFO" "${blue_fg_strong}Detected Debian/Ubuntu-based system.${reset}"
|
||||
# Debian/Ubuntu
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
elif command -v yum &>/dev/null; then
|
||||
echo -e "${blue_fg_strong}[INFO] Detected Red Hat/Fedora-based system.${reset}"
|
||||
log_message "INFO" "${blue_fg_strong}Detected Red Hat/Fedora-based system.${reset}"
|
||||
# Red Hat/Fedora
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
elif command -v apk &>/dev/null; then
|
||||
echo -e "${blue_fg_strong}[INFO] Detected Alpine Linux-based system.${reset}"
|
||||
log_message "INFO" "${blue_fg_strong}Detected Alpine Linux-based system.${reset}"
|
||||
# Alpine Linux
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
elif command -v pacman &>/dev/null; then
|
||||
echo -e "${blue_fg_strong}[INFO] Detected Arch Linux-based system.${reset}"
|
||||
log_message "INFO" "${blue_fg_strong}Detected Arch Linux-based system.${reset}"
|
||||
# Arch Linux
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
elif command -v emerge &>/dev/null; then
|
||||
echo -e "${blue_fg_strong}[INFO] Detected Gentoo Linux-based system. Now you are the real CHAD${reset}"
|
||||
log_message "INFO" "${blue_fg_strong}Detected Gentoo Linux-based system. Now you are the real CHAD${reset}"
|
||||
# Gentoo Linux
|
||||
install_git
|
||||
install_nodejs_npm
|
||||
installer
|
||||
else
|
||||
echo -e "${red_fg_strong}[ERROR] Unsupported package manager. Cannot detect Linux distribution.${reset}"
|
||||
log_message "ERROR" "${red_fg_strong}Unsupported package manager. Cannot detect Linux distribution.${reset}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user