summarylogtreecommitdiffstats
path: root/audacity-openvino
blob: e44fd8c5ffbce56a936a4218750e5017cf42b9d7 (plain)
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
#!/usr/bin/env bash
# Original code (C) Felipe Facundes — GPL-3.0-only
# Modifications (C) Selene Bray-Hernandez — MIT
# SPDX-License-Identifier: GPL-3.0-only AND MIT

libtorch_cuda="/opt/libtorch-cuda"
libtorch_rocm="/opt/libtorch-rocm"
libtorch_cpu="/opt/libtorch-cpu"

if [ -d "$libtorch_cuda" ]; then
	export LD_LIBRARY_PATH="/opt/libtorch-cuda/lib:/usr/lib"
elif [ -d "$libtorch_rocm" ]; then
	export LD_LIBRARY_PATH="/opt/libtorch-rocm/lib:/usr/lib"
elif [ -d "/opt/libtorch" ]; then
	export LD_LIBRARY_PATH="/opt/libtorch/lib:/usr/lib"
elif [ -d "$libtorch_cpu" ]; then
	export LD_LIBRARY_PATH="/opt/libtorch-cpu/lib:/usr/lib"
fi

# Automatically create user models symlink if it doesn't exist
default_user_dir="$HOME/.local/share/audacity-openvino/models"
if [ ! -L "/usr/share/audacity/openvino-models/user-models" ]; then
    echo "Setting up user models directory..."
    if [ ! -d "$default_user_dir" ]; then
        mkdir -p "$default_user_dir"
        echo "Created user models directory: $default_user_dir"
    fi
    
    if sudo ln -sfn "$default_user_dir" /usr/share/audacity/openvino-models/user-models 2>/dev/null; then
        echo "Created symlink: /usr/share/audacity/openvino-models/user-models -> $default_user_dir"
        if sudo chmod a+w /usr/share/audacity/openvino-models/user-models 2>/dev/null; then
            echo "Made symlink writable for Audacity cache files"
        fi
    else
        echo "Note: Could not create symlink automatically. You may need to run:"
        echo "  sudo ln -sfn $default_user_dir /usr/share/audacity/openvino-models/user-models"
        echo "  sudo chmod a+w /usr/share/audacity/openvino-models/user-models"
    fi
fi

audacity "$@"