-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·210 lines (183 loc) · 7.37 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·210 lines (183 loc) · 7.37 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/usr/bin/env bash
# =============================================================================
# install.sh — Symlink resolve-kit scripts to ~/.local/bin
#
# Usage:
# ./install.sh # Install all scripts
# ./install.sh --remove # Remove all symlinks
# =============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_DIR="$HOME/.local/bin"
APP_DIR="$HOME/.local/share/applications"
DESKTOP_FILE="davinci-kit.desktop"
REMOVE=false
[[ "${1:-}" == "--remove" ]] && REMOVE=true
# ---- helpers ----------------------------------------------------------------
info() { echo -e "\033[1;34m[INFO]\033[0m $*"; }
warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; }
ok() { echo -e "\033[1;32m[OK]\033[0m $*"; }
check_cmd() {
if command -v "$1" &>/dev/null; then
ok "$1 found: $(command -v "$1")"
return 0
fi
warn "$1 not found — $2"
return 1
}
# ---- scripts list -----------------------------------------------------------
scripts=(
"davinci-kit"
"davinci-kit-transcode"
"davinci-kit-audio"
"davinci-kit-export"
"davinci-kit-fix"
"davinci-kit-backup"
"davinci-kit-fonts"
"davinci-kit-watch"
"davinci-kit-info"
"davinci-kit-update"
)
# =============================================================================
if $REMOVE; then
# =============================================================================
echo "Removing resolve-kit symlinks from $BIN_DIR..."
for script in "${scripts[@]}"; do
target="$BIN_DIR/$script"
if [[ -L "$target" ]]; then
# Safety: only remove symlinks that point into our bin/ directory
link_target="$(readlink "$target")"
if [[ "$link_target" == "$SCRIPT_DIR/bin/"* ]]; then
rm "$target"
echo " Removed: $script"
else
warn "Skipped: $script (symlink points to $link_target, not resolve-kit)"
fi
else
echo " Not found: $script (skipping)"
fi
done
# Desktop entry
if [[ -f "$APP_DIR/$DESKTOP_FILE" ]]; then
rm -f "$APP_DIR/$DESKTOP_FILE"
echo " Removed: $DESKTOP_FILE"
fi
# Refresh desktop database
if command -v update-desktop-database &>/dev/null; then
update-desktop-database "$APP_DIR" 2>/dev/null || true
echo " Desktop database updated."
fi
echo "Done."
# =============================================================================
else
# =============================================================================
# ---- dependency checks ----------------------------------------------------
echo "Checking dependencies..."
missing_required=0
check_cmd ffmpeg "required for transcode/export/audio/watch" || missing_required=1
check_cmd ffprobe "required for transcode/export/audio/watch" || missing_required=1
check_cmd python3 "required for davinci-kit (GUI)" || missing_required=1
# GUI requires PyQt6 or PySide6 — check if python3 can import either
if command -v python3 &>/dev/null; then
if python3 -c "import PyQt6" 2>/dev/null; then
ok "PyQt6 found (GUI backend)"
elif python3 -c "import PySide6" 2>/dev/null; then
ok "PySide6 found (GUI backend)"
else
warn "PyQt6/PySide6 not found — davinci-kit will not work"
warn " Install one of: python-pyqt6 or python-pyside6"
fi
fi
# Optional tools
check_cmd parallel "optional — enables -j parallel jobs in transcode/export/audio" || true
check_cmd inotifywait "optional — required only for davinci-kit-watch" || true
if [[ $missing_required -eq 1 ]]; then
echo
warn "Some required tools are missing. resolve-kit will install but certain"
warn "commands may not work until dependencies are satisfied."
echo
fi
# ---- ensure target directories exist --------------------------------------
mkdir -p "$BIN_DIR"
mkdir -p "$APP_DIR"
# ---- symlink scripts ------------------------------------------------------
echo
echo "Installing resolve-kit scripts to $BIN_DIR..."
for script in "${scripts[@]}"; do
source="$SCRIPT_DIR/bin/$script"
target="$BIN_DIR/$script"
if [[ ! -f "$source" ]]; then
warn "Missing: $script (not in $SCRIPT_DIR/bin/)"
continue
fi
# Safety: only replace symlinks that point into our bin/ directory or files
# we previously installed. Never remove an unrelated binary.
if [[ -L "$target" ]]; then
link_target="$(readlink "$target")"
if [[ "$link_target" == "$SCRIPT_DIR/bin/"* ]]; then
rm "$target"
else
warn "Skipped: $script (existing symlink points to $link_target)"
continue
fi
elif [[ -f "$target" ]]; then
warn "Skipped: $script (existing file at $target — not overwriting)"
continue
fi
ln -s "$source" "$target"
echo " Linked: $script → $source"
done
# ---- install icon --------------------------------------------------------
ICON_DIR="$HOME/.local/share/icons/hicolor/scalable/apps"
mkdir -p "$ICON_DIR"
if [[ -f "$SCRIPT_DIR/packaging/davinci-kit.svg" ]]; then
cp "$SCRIPT_DIR/packaging/davinci-kit.svg" "$ICON_DIR/davinci-kit.svg"
echo " Installed: $ICON_DIR/davinci-kit.svg"
if command -v gtk-update-icon-cache &>/dev/null; then
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
fi
else
warn "packaging/davinci-kit.svg not found — desktop entry will fall back to system icon"
fi
# ---- install desktop entry ------------------------------------------------
echo
echo "Installing desktop entry..."
cat > "$APP_DIR/$DESKTOP_FILE" <<DESKTOP
[Desktop Entry]
Type=Application
Name=DaVinci Resolve Kit
GenericName=DaVinci Resolve Linux Studio Toolkit
Comment=Transcode, export, diagnose, and optimize DaVinci Resolve on Linux
Exec=${BIN_DIR}/davinci-kit
Icon=davinci-kit
StartupWMClass=davinci-kit
Terminal=false
Categories=AudioVideo;Video;AudioVideoEditing;Qt;
Keywords=DaVinci;Resolve;Transcode;FFmpeg;DNxHR;Video;Linux;Export;
DESKTOP
echo " Installed: $APP_DIR/$DESKTOP_FILE"
# Refresh desktop database
if command -v update-desktop-database &>/dev/null; then
update-desktop-database "$APP_DIR" 2>/dev/null || true
echo " Desktop database updated."
fi
# ---- legacy check ---------------------------------------------------------
if [[ -f "$BIN_DIR/resolve-prime" ]] && [[ ! -L "$BIN_DIR/resolve-prime" ]]; then
echo
warn "resolve-prime found (legacy, replaced by davinci-kit-fix)"
warn " You can remove it with: rm ~/.local/bin/resolve-prime"
fi
# ---- summary --------------------------------------------------------------
echo
echo "Installed! Available commands:"
echo " davinci-kit — Graphical interface studio"
echo " davinci-kit-transcode — Batch transcode media for Resolve (DNxHR / AV1)"
echo " davinci-kit-audio — Batch convert audio files for Resolve (WAV/FLAC/ALAC/MP3)"
echo " davinci-kit-export — Convert Resolve exports for delivery (H.264/H.265/AV1/NVENC)"
echo " davinci-kit-fix — Launch Resolve with library fix + NVIDIA GPU offload"
echo " davinci-kit-backup — Backup/restore Resolve settings"
echo " davinci-kit-fonts — Fix font paths in Fusion"
echo " davinci-kit-watch — Auto-transcode watch folder (DNxHR / AV1)"
echo " davinci-kit-info — System diagnostics"
echo " davinci-kit-update — Update davinci-kit via git"
fi