Skip to content

Commit

Permalink
feat(ujust): Add ujust install-resolve (#321)
Browse files Browse the repository at this point in the history
* feat(ujust): Add ujust install-resolve

* chore(ujust): Minor install-resolve comment tweak

* chore: Add required new line

---------

Co-authored-by: Kyle Gospodnetich <[email protected]>
  • Loading branch information
Zeglius and KyleGospo authored Sep 20, 2024
1 parent 5574d2c commit 588beb0
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions build/ublue-os-just/30-distrobox.just
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,84 @@ install-obs-studio-portable:
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
AssembleList "/etc/distrobox/apps.ini" create "obs-studio-portable"

# Install/update DaVinci Resolve, a closed-source video editing utility
install-resolve ACTION="":
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
set -eo pipefail
SCRIPT_URL="https://raw.githubusercontent.com/zelikos/davincibox/3e51fa38ac7512a26d644d0f48d8cf99921d80de/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
echo "Usage: ujust install-resolve <option>"
echo " <option>: Specify the quick option to skip the prompt"
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}"
else
echo "${red}Installer not found${n}";
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"
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
else
echo "davincibox is not installed, skip..."
exit 0
fi
fi
else
echo "Incorrect option"
exit 1
fi

alias install-resolve-studio := install-resolve

0 comments on commit 588beb0

Please sign in to comment.