forked from xNul/chat-llama-discord-bot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_linux.sh
64 lines (51 loc) · 1.51 KB
/
update_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Step 1: Perform git pull
git pull
if [ $? -ne 0 ]; then
echo "Failed to pull from the repository."
exit 1
fi
# Step 2: Go up one directory level
cd ..
if [ $? -ne 0 ]; then
echo "Failed to navigate to the parent directory."
exit 1
fi
# Set the working directory
WORKING_DIR=$(pwd)
# Step 3: Execute the existing Miniconda activation script
cd "$(dirname "${BASH_SOURCE[0]}")"
if [[ "$(pwd)" =~ " " ]]; then
echo "This script relies on Miniconda which can not be silently installed under a path with spaces."
exit 1
fi
# Deactivate existing conda envs as needed to avoid conflicts
{ conda deactivate && conda deactivate && conda deactivate; } 2> /dev/null
# Config
CONDA_ROOT_PREFIX="$WORKING_DIR/installer_files/conda"
INSTALL_ENV_DIR="$WORKING_DIR/installer_files/env"
# Environment isolation
export PYTHONNOUSERSITE=1
unset PYTHONPATH
unset PYTHONHOME
export CUDA_PATH="$INSTALL_ENV_DIR"
export CUDA_HOME="$CUDA_PATH"
# Check if conda.sh exists
if [ ! -f "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" ]; then
echo "Conda.sh not found at $CONDA_ROOT_PREFIX/etc/profile.d/conda.sh"
exit 1
fi
# Activate installer env
source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh"
conda activate "$INSTALL_ENV_DIR"
if [ $? -ne 0 ]; then
echo "Failed to activate the conda environment."
exit 1
fi
# Step 4: Install dependencies
pip install -r ad_discordbot/requirements.txt
if [ $? -ne 0 ]; then
echo "Failed to install dependencies."
exit 1
fi
echo "ad_discordbot has been updated."