-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·96 lines (85 loc) · 3.04 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·96 lines (85 loc) · 3.04 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
#!/bin/sh
# drwrap installer: gets pipx if needed, installs drwrap, sets up the desktop.
set -e
say() { printf '\033[1m%s\033[0m\n' "$*"; }
usage() {
cat <<'EOF'
usage: install.sh [--force] [--adopt|--no-adopt]
--force reinstall from scratch even if drwrap is already installed
--adopt route DaVinci Resolve's own menu entry through drwrap
--no-adopt leave it alone (the default when nobody can be asked)
EOF
}
FORCE=0
SETUP_ARGS=""
for arg in "$@"; do
case "$arg" in
--force) FORCE=1 ;;
--adopt|--no-adopt) SETUP_ARGS="$SETUP_ARGS $arg" ;;
-h|--help) usage; exit 0 ;;
*) echo "unknown option: $arg" >&2; usage >&2; exit 2 ;;
esac
done
if ! command -v python3 >/dev/null 2>&1; then
echo "python3 is required — install it with your package manager." >&2
exit 1
fi
if ! command -v ffmpeg >/dev/null 2>&1; then
say "FFmpeg is missing. Install it first, then re-run:"
echo " Ubuntu/Debian: sudo apt install ffmpeg"
echo " Fedora: sudo dnf install ffmpeg"
echo " Arch: sudo pacman -S ffmpeg"
exit 1
fi
PIPX="pipx"
if ! command -v pipx >/dev/null 2>&1; then
if python3 -m pipx --version >/dev/null 2>&1; then
PIPX="python3 -m pipx"
else
say "Installing pipx..."
if python3 -m pip install --user pipx >/dev/null 2>&1; then
PIPX="python3 -m pipx"
python3 -m pipx ensurepath >/dev/null 2>&1 || true
else
echo "Could not install pipx automatically. Install it and re-run:" >&2
echo " Ubuntu/Debian: sudo apt install pipx" >&2
echo " Fedora: sudo dnf install pipx" >&2
echo " Arch: sudo pacman -S python-pipx" >&2
exit 1
fi
fi
fi
# Reinstall over an existing copy. pipx 1.15 with the uv backend cannot reuse
# the old venv directory ("A virtual environment already exists at: ."), so
# fall back to removing it first.
reinstall() {
src="$1"
if [ "$FORCE" -eq 0 ] && $PIPX install --force "$src"; then
return 0
fi
$PIPX uninstall drwrap >/dev/null 2>&1 || true
$PIPX install "$src"
}
# From a checkout install this tree; otherwise PyPI, then git as fallback
# (covers `curl ... | sh` before/without a PyPI release).
here="$(cd "$(dirname "$0")" && pwd)"
if [ -f "$here/pyproject.toml" ] && grep -q '^name = "drwrap"' "$here/pyproject.toml"; then
src="$here"
say "Installing drwrap from this checkout..."
elif python3 -c 'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen(
"https://pypi.org/pypi/drwrap/json", timeout=10).status == 200 else 1)' \
2>/dev/null; then
src="drwrap"
say "Installing drwrap from PyPI..."
else
src="git+https://github.com/fedsfarm/drwrap"
say "Installing drwrap from git..."
fi
reinstall "$src"
say "Setting up launcher + background converter..."
if command -v drwrap >/dev/null 2>&1; then
drwrap setup $SETUP_ARGS
else
"$HOME/.local/bin/drwrap" setup $SETUP_ARGS
fi
say "Done. Open DaVinci Resolve — dropped clips just work."