fix(davinci): Fix davinci flow and added GUI interactions for a better UX (#1236)

This commit is contained in:
Zacharias Xenakis 2026-05-05 15:28:58 +03:00 committed by GitHub
parent 00f0e86232
commit 1467fea00c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,84 +70,186 @@ setup-distrobox-app CONTAINER="prompt":
source /usr/lib/ujust/ujust.sh
AssembleList "/etc/distrobox/apps.ini" create {{ CONTAINER }}
# Install/update DaVinci Resolve, a closed-source video editing utility
# Install/update DaVinci Resolve, a closed-source video editing utility. Options: status | install | uninstall
install-resolve ACTION="":
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
set -eo pipefail
SCRIPT_URL="https://raw.githubusercontent.com/zelikos/davincibox/10b4b82f0e7f121596b33595f584bc576c03bb3a/setup.sh"
DOWNLOADDIR=$(xdg-user-dir DOWNLOAD || echo ${HOME})
tmpdir=/var/tmp/bazzite_davincibox_setup.tmp
mkdir -p $tmpdir
trap "rm -rf ${tmpdir}" INT EXIT HUP
OPTION={{ ACTION }}
if [ "$OPTION" == "help" ]; then
get_status_token() {
if podman container exists davincibox >/dev/null 2>&1; then
echo "install"
else
echo "uninstall"
fi
}
show_help() {
echo "Usage: ujust install-resolve <option>"
echo " <option>: Specify the quick option to skip the prompt"
echo " Use 'status' to print the current portal token"
echo " Use 'install' to select Install/upgrade davincibox"
echo " Use 'uninstall' to select Uninstall davincibox"
exit 0
elif [ "$OPTION" == "" ]; then
# Display install state and show options
INSTALL_STATE=0
INSTALL_STATE=$(podman container exists davincibox; echo $?)
if (( $INSTALL_STATE == 0 )); then
echo "Installed?: ${green}yes${n}"
else
echo "Installed?: ${red}no${n}"
fi
OPTION=$(Choose \
"Install/upgrade davincibox" \
"Uninstall davincibox" \
)
if [[ "${OPTION,,}" =~ (^install/upgrade[[:space:]]davincibox) ]]; then
echo "This script requires you to download the DaVinci Resolve installer (should be a zip file) manually from their website and place it in ${HOME} or ${DOWNLOADDIR}"
echo "https://www.blackmagicdesign.com/event/davinciresolvedownload"
echo ""
echo -e "${b}\033[3mDo not\033[0m ${b}extract the .zip contents, the script will handle everything${n}"
echo "${lightgrey}TIP: For manual installation, see https://github.com/zelikos/davincibox${n}"
# Get sure user reads instructions
ugum confirm || exit 0
# Download davincibox setup script
SETUPSCRIPT=/tmp/davincibox_setup.sh
wget -O $SETUPSCRIPT ${SCRIPT_URL}
chmod +x $SETUPSCRIPT
# Check if the installer is in HOME or DOWNLOAD
shopt -s nullglob && possible_installers=({$HOME,$DOWNLOADDIR}/DaVinci_Resolve_{,Studio_}*_Linux.{zip,run}) \
&& shopt -u nullglob
runfile=$(Choose ${possible_installers[@]})
if [[ ! -z $runfile && -f $runfile ]]; then
if [[ $runfile =~ .zip$ ]]; then
unzip -o -d "$tmpdir" "$runfile"
RUNFILE=$(find $tmpdir -executable -name "DaVinci_Resolve_*.run")
else
RUNFILE="$runfile"
fi
echo "Installer found: ${RUNFILE}"
}
run_resolve_installer() {
local runfile="$1"
local RUNFILE
tmpdir=/var/tmp/bazzite_davincibox_setup.tmp
mkdir -p $tmpdir
trap "rm -rf ${tmpdir}" INT EXIT HUP
# Download davincibox setup script
SCRIPT_URL="https://raw.githubusercontent.com/zelikos/davincibox/10b4b82f0e7f121596b33595f584bc576c03bb3a/setup.sh"
SETUPSCRIPT=/tmp/davincibox_setup.sh
wget -O $SETUPSCRIPT ${SCRIPT_URL}
chmod +x $SETUPSCRIPT
if [[ ! -z $runfile && -f $runfile ]]; then
if [[ $runfile =~ .zip$ ]]; then
unzip -o -d "$tmpdir" "$runfile"
RUNFILE=$(find $tmpdir -executable -name "DaVinci_Resolve_*.run")
else
echo "${red}Installer not found${n}";
echo "${red}Please place the file DaVinci_Resolve_*_Linux.run in ${HOME} or ${DOWNLOADDIR}${n}";
exit 1
RUNFILE="$runfile"
fi
bash <<< "env -C ${tmpdir} $SETUPSCRIPT $RUNFILE"
echo "davincibox was successfully installed"
elif [[ "${OPTION,,}" =~ (^uninstall[[:space:]]davincibox) ]]; then
ugum confirm "Confirm davincibox uninstall?" || exit 0
# Remove the existing container
if podman container exists davincibox >/dev/null 2>&1; then
echo "Removing existing davincibox container"
distrobox enter davincibox -- add-davinci-launcher remove
podman stop davincibox
podman rm davincibox
echo "Installer found: ${RUNFILE}"
else
echo "${red}Installer not found${n}";
DOWNLOADDIR=$(xdg-user-dir DOWNLOAD || echo ${HOME})
echo "${red}Please place the file DaVinci_Resolve_*_Linux.run in ${HOME} or ${DOWNLOADDIR}${n}";
exit 1
fi
bash <<< "env -C ${tmpdir} $SETUPSCRIPT $RUNFILE"
echo "davincibox was successfully installed"
}
install_resolve() {
DOWNLOADDIR=$(xdg-user-dir DOWNLOAD || echo ${HOME})
echo "This script requires you to download the DaVinci Resolve installer (should be a zip file) manually from their website and place it in ${HOME} or ${DOWNLOADDIR}"
echo "https://www.blackmagicdesign.com/event/davinciresolvedownload"
echo ""
echo -e "${b}\033[3mDo not\033[0m ${b}extract the .zip contents, the script will handle everything${n}"
echo "${lightgrey}TIP: For manual installation, see https://github.com/zelikos/davincibox${n}"
# Get sure user reads instructions
ugum confirm || exit 0
# Check if the installer is in HOME or DOWNLOAD
shopt -s nullglob && possible_installers=({$HOME,$DOWNLOADDIR}/DaVinci_Resolve_{,Studio_}*_Linux.{zip,run}) \
&& shopt -u nullglob
runfile=$(Choose ${possible_installers[@]})
run_resolve_installer "$runfile"
}
install_resolve_gui() {
DOWNLOADDIR=$(xdg-user-dir DOWNLOAD || echo ${HOME})
message="Please select the downloaded ZIP file to be installed"
download_url="https://www.blackmagicdesign.com/event/davinciresolvedownload"
while true; do
set +e
choice=$(zenity --info \
--title="DaVinci Resolve Installer" \
--text="Download the DaVinci Resolve Linux ZIP installer from Blackmagic Design, then continue to select it." \
--ok-label="Next" \
--extra-button="Download Installer" 2>/dev/null)
zenity_status=$?
set -e
if [[ "$choice" == "Download Installer" ]]; then
xdg-open "$download_url" >/dev/null 2>&1 &
elif (( zenity_status == 0 )); then
break
else
echo "davincibox is not installed, skip..."
exit 0
fi
done
zenity --info --title="DaVinci Resolve Installer" --text="$message" --ok-label="Select" 2>/dev/null || exit 0
runfile=$(zenity --file-selection \
--title="Select DaVinci Resolve installer" \
--filename="${DOWNLOADDIR}/" \
--file-filter="DaVinci Resolve Linux installer | *.zip *.run" \
--file-filter="All files | *" 2>/dev/null) || exit 0
run_resolve_installer "$runfile"
}
cleanup_davincibox_desktop_files() {
local app_dir desktop_file
local removed=false
for app_dir in "$HOME/.local/share/applications" "$HOME/Desktop"; do
[[ -d "$app_dir" ]] || continue
while IFS= read -r -d '' desktop_file; do
if grep -qi "davincibox" "$desktop_file"; then
rm -f "$desktop_file"
removed=true
fi
done < <(find "$app_dir" -maxdepth 1 -type f -name "*.desktop" -print0 2>/dev/null)
done
if [[ "$removed" == "true" ]]; then
echo "Removed davincibox desktop launchers."
else
echo "No davincibox desktop launchers found."
fi
else
echo "Incorrect option"
exit 1
fi
}
uninstall_resolve() {
# Remove the existing container
if podman container exists davincibox >/dev/null 2>&1; then
echo "Removing existing davincibox container"
distrobox enter davincibox -- add-davinci-launcher remove || true
podman stop davincibox
podman rm davincibox
cleanup_davincibox_desktop_files
else
echo "davincibox is not installed, checking for stale desktop launchers..."
cleanup_davincibox_desktop_files
exit 0
fi
}
OPTION="{{ ACTION }}"
case "${OPTION,,}" in
help)
show_help
exit 0
;;
status)
get_status_token
exit 0
;;
install|install/upgrade*)
install_resolve_gui
exit 0
;;
uninstall*)
uninstall_resolve
exit 0
;;
"")
# Display install state and show options
INSTALL_STATE=0
INSTALL_STATE=$(podman container exists davincibox; echo $?)
if (( $INSTALL_STATE == 0 )); then
echo "Installed?: ${green}yes${n}"
else
echo "Installed?: ${red}no${n}"
fi
OPTION=$(Choose \
"Install/upgrade davincibox" \
"Uninstall davincibox" \
)
if [[ "${OPTION,,}" =~ (^install/upgrade[[:space:]]davincibox) ]]; then
install_resolve
elif [[ "${OPTION,,}" =~ (^uninstall[[:space:]]davincibox) ]]; then
ugum confirm "Confirm davincibox uninstall?" || exit 0
uninstall_resolve
fi
;;
*)
echo "Incorrect option"
exit 1
;;
esac
alias install-resolve-studio := install-resolve
alias install-davinci := install-resolve