Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ujust): Add ujust install-resolve #321

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading