Clean up install script

This commit is contained in:
Niels Geens
2025-04-01 16:30:42 +02:00
parent 130afbdd92
commit c00256f723
3 changed files with 22 additions and 22 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/bash
add_to_environment() {
local path="$1"
# Check if the path is already in the environment file
if ! grep -q "$path" /etc/environment; then
# Get current PATH from environment file
current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2)
if [ -z "$current_path" ]; then
# If PATH doesn't exist in the file, create it
echo "PATH=\"\$PATH:$path\"" >> /etc/environment
else
# Replace existing PATH line with updated one
sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment
fi
fi
}

View File

@@ -61,6 +61,7 @@ ln -s "/root/sia/web/dist" "/root/static"
# Install SIA dependencies
source "/root/sia/scripts/install.sh"
source "/etc/environment"
## Finetune model
#echo "Finetuning model..."

View File

@@ -1,36 +1,17 @@
#!/bin/bash
add_to_environment() {
local path="$1"
# Check if the path is already in the environment file
if ! grep -q "$path" /etc/environment; then
# Get current PATH from environment file
current_path=$(grep "^PATH=" /etc/environment | cut -d'"' -f2)
if [ -z "$current_path" ]; then
# If PATH doesn't exist in the file, create it
echo "PATH=\"\$PATH:$path\"" >> /etc/environment
else
# Replace existing PATH line with updated one
sed -i "s|^PATH=.*|PATH=\"$path:$current_path\"|" /etc/environment
fi
fi
}
echo "Installing ITB tool..."
python3 -m venv "/root/venvs/itb"
/root/venvs/itb/bin/pip install -e /root/sia/tools/itb/
add_to_environment "/root/venvs/itb/bin"
/root/sia/scripts/add_to_environment "/root/venvs/itb/bin"
echo "Installing Train tool..."
python3 -m venv "/root/venvs/train"
/root/venvs/train/bin/pip install -e /root/sia/tools/train/
/root/venvs/train/bin/ipython kernel install --name=train
add_to_environment "/root/venvs/train/bin"
/root/sia/scripts/add_to_environment "/root/venvs/train/bin"
echo "Installing SIA core..."
python3 -m venv "/root/venvs/sia"
/root/venvs/sia/bin/pip install -e /root/sia/
add_to_environment "/root/venvs/sia/bin"
source "/etc/environment
/root/sia/scripts/add_to_environment "/root/venvs/sia/bin"