Break out Resolve & Resolve Studio into separate yaml

This change breaks out Resolve & Resolve Studio into separate
yamls, and moves a lot of core functionality into scripts.

It also fixes numerous bugs and is a bit more tested than before.
This commit is contained in:
pobthebuilder committed 2023-04-16 13:39:29 -07:00
1 parent b9de52229d
commit 70d6875366
11 files changed
+395 -280

No files matched your search

+12 -27
View File
@@ -12,40 +12,25 @@ It's still a work-in-progress; but "works-for-me[tm]" right now.
Usage Usage
----- -----
1. `git clone` this repo 1. `git clone` this repo
2. Edit the Flatpak manifest, `com.blackmagic.Resolve.yaml` to select the version:
By default, com.blackmagic.Resolve.yaml is configured to package the latest version of Resolve Studio (18.1.4 at the time of writing). By default, com.blackmagic.Resolve.yaml is configured to package the latest version of Resolve Studio (18.1.4 at the time of writing).
To change from Studio to Free: 3. Build your package, and export to a distributable single file installer:
#### Studio:
#### Free
``` ```
_product="davinci-resolve-studio" flatpak-builder --force-clean --repo=repo build-dir com.blackmagic.Resolve.yaml
flatpak build-bundle repo resolve.flatpak com.blackmagic.Resolve
```
#### Studio
```
flatpak-builder --force-clean --repo=repo build-dir com.blackmagic.ResolveStudio.yaml
flatpak build-bundle repo resolve.flatpak com.blackmagic.ResolveStudio
``` ```
#### Free: 3. Enjoy.
``` ## Finding explicit Download IDs (for download_resolve.sh)
_product="davinci-resolve"
```
#### Explicit Release:
Alternatively, you can specify an explicit downloadId:
Do this by overriding the _downloadid:
```
# Uncomment this to hard code the download if you want a specific version
# _downloadid='44be7e694b4e440db5d2f70ad732d3b2'
```
See below for code to find explicit Download IDs.
3. Build (& install) your package:
```
flatpak-builder --user --install --force-clean build-dir com.blackmagic.Resolve.yaml
```
4. Enjoy.
## Finding explicit Download IDs
#### Studio: #### Studio:
``` ```
-11
View File
@@ -1,11 +0,0 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=DaVinci Resolve Panels Setup
Exec="/app/DaVinci Resolve Panels Setup/DaVinci Resolve Panels Setup"
Icon=com.blackmagic.Resolve.PanelSetup.png
Terminal=false
StartupNotify=true
Categories=AudioVideo
-12
View File
@@ -1,12 +0,0 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Blackmagic RAW Player
Exec=/app/BlackmagicRAWPlayer/BlackmagicRAWPlayer
Icon=com.blackmagic.Resolve.RAWPlayer
Terminal=false
MimeType=application/x-braw-clip;application/x-braw-sidecar
StartupNotify=true
Categories=AudioVideo
@@ -1,11 +0,0 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Blackmagic RAW Speed Test
Exec=/app/BlackmagicRAWSpeedTest/BlackmagicRAWSpeedTest
Icon=/app/graphics/blackmagicraw-speedtest_256x256_apps.png
Terminal=false
StartupNotify=true
Categories=AudioVideo
@@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=DaVinci Remote Monitoring
Exec="/app/bin/DaVinci Remote Monitoring"
Icon=com.blackmagic.Resolve.RemoteMonitoring
Terminal=false
StartupNotify=true
Categories=AudioVideo
-13
View File
@@ -1,13 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=DaVinci Resolve
Name[en_US]=DaVinci Resolve
GenericName=DaVinci Resolve
Comment=Revolutionary new tools for editing, visual effects, color correction and professional audio post production, all in a single application!
Exec=/app/bin/resolve %U
Icon=com.blackmagic.Resolve
Terminal=false
MimeType=application/x-resolveproj;
StartupNotify=true
Categories=AudioVideo
+7 -196
View File
@@ -1,22 +1,6 @@
#### ####
# Flatpak Configuration for building DaVinci Resolve # Flatpak Configuration for building DaVinci Resolve
# #
# By default, the script in here will download the latest version of DaVinci Resolve Studio.
# You can download/install DaVinci Resolve, or DaVinci Resolve Studio.
#
# To change it, change the _product tag in the shell script below.
#
# You can also install a specific DaVinci type and version from a specific downloadId.
# To do so, set the _downloadId variable in the shell script below.
#
# Use the following to get a full list of download IDs from Blackmagic:
#curl -o- https://www.blackmagicdesign.com/api/support/nz/downloads.json | jq -r '.downloads[] | select(.urls["Linux"] != null) | select(.urls["Linux"][0]["product"] == "davinci-resolve-studio") | [.urls["Linux"][0].downloadTitle, .urls["Linux"][0].downloadId] | @tsv'
# or:
#curl -o- https://www.blackmagicdesign.com/api/support/nz/downloads.json | jq -r '.downloads[] | select(.urls["Linux"] != null) | select(.urls["Linux"][0]["product"] == "davinci-resolve") | [.urls["Linux"][0].downloadTitle, .urls["Linux"][0].downloadId] | @tsv'
#DaVinci Resolve 18.1.4 6449dc76e0b845bcb7399964b00a3ec4
#DaVinci Resolve 18.1.3 44be7e694b4e440db5d2f70ad732d3b2
#DaVinci Resolve 18.1.2 4755b7bd2d924c0db1980824edb84a20
#DaVinci Resolve 18.1.1 e09749f2de1d4c20a2b707c405d243fd
#### ####
app-id: com.blackmagic.Resolve app-id: com.blackmagic.Resolve
runtime: org.freedesktop.Platform runtime: org.freedesktop.Platform
@@ -34,10 +18,8 @@ finish-args:
- --filesystem=xdg-data - --filesystem=xdg-data
- --filesystem=xdg-videos - --filesystem=xdg-videos
- --filesystem=~/.local/share/DaVinciResolve - --filesystem=~/.local/share/DaVinciResolve
# - --env=BMD_RESOLVE_CONFIG_DIR=$XDG_CONFIG_HOME
# - --env=BMD_RESOLVE_LOGS_DIR=$XDG_DATA_HOME/logs
command: /app/bin/resolve command: /app/bin/resolve.sh
modules: modules:
- shared-modules/glu/glu-9.json - shared-modules/glu/glu-9.json
- name: resolve - name: resolve
@@ -47,184 +29,13 @@ modules:
- --share=network - --share=network
build-commands: build-commands:
- | - |
./DaVinci_Resolve_*_Linux.run --appimage-extract 2>&1 ./download_resolve.sh -p davinci-resolve
find squashfs-root -exec chmod a+r {} \; ./setup_resolve.sh
find squashfs-root -type d -exec chmod a+x {} \; install -Dm755 resolve.sh /app/bin/resolve.sh
# Create directories
mkdir -p /app/easyDCP /app/scripts /app/.license /app/share /app/Fairlight /app/share/applications /app/share/icons/hicolor/128x128/apps /app/share/icons/hicolor/256x256/apps
chmod 755 /app/easyDCP /app/scripts /app/.license /app/share /app/Fairlight /app/share/applications /app/share/icons/hicolor/128x128/apps /app/share/icons/hicolor/256x256/apps
# Copy objects
cp -rp squashfs-root/bin /app/
cp -rp squashfs-root/Control /app/
cp -rp squashfs-root/Certificates /app/
cp -rp squashfs-root/DaVinci\ Control\ Panels\ Setup /app/
cp -rp squashfs-root/Developer /app/
cp -rp squashfs-root/docs /app/
cp -rp squashfs-root/Fairlight\ Studio\ Utility /app/
cp -rp squashfs-root/Fusion /app/
cp -rp squashfs-root/graphics /app/
cp -rp squashfs-root/libs /app/
# Can we use system Qt5? Not yet.
# rsync -avpr --exclude 'libQt5*' squashfs-root/libs /app/
cp -rp squashfs-root/LUT /app/
cp -rp squashfs-root/Onboarding /app/
cp -rp squashfs-root/plugins /app/
cp -rp squashfs-root/Technical\ Documentation /app/
cp -rp squashfs-root/UI_Resource /app/
cp -rp squashfs-root/scripts/script.checkfirmware /app/scripts/
cp -rp squashfs-root/scripts/script.getlogs.v4 /app/scripts/
cp -rp squashfs-root/scripts/script.start /app/scripts/
cp -rp squashfs-root/share/default-config.dat /app/share/
cp -rp squashfs-root/share/default_cm_config.bin /app/share/
cp -rp squashfs-root/share/log-conf.xml /app/share/
if [[ -e squashfs-root/share/remote-monitoring-log-conf.xml ]]; then
cp -rp squashfs-root/share/remote-monitoring-log-conf.xml /app/share/
fi
mkdir -p /app/var/BlackmagicDesign/DaVinci\ Resolve
chmod 755 /app/var/BlackmagicDesign/DaVinci\ Resolve
if [[ -e squashfs-root/BlackmagicRAWPlayer ]]; then
echo "Adding BlackmagicRAWPlayer"
cp -rp squashfs-root/BlackmagicRAWPlayer /app
cp com.blackmagic.Resolve.RAWPlayer.desktop /app/share/applications/com.blackmagic.Resolve.RAWPlayer.desktop
cp squashfs-root/graphics/blackmagicraw-player_256x256_apps.png /app/share/icons/hicolor/256x256/apps/com.blackmagic.Resolve.RAWPlayer.png
fi
if [[ -e squashfs-root/BlackmagicRAWSpeedTest ]]; then
echo "Adding BlackmagicRAWSpeedTest"
cp -rp squashfs-root/BlackmagicRAWSpeedTest /app
cp com.blackmagic.Resolve.RAWSpeedTest.desktop /app/share/applications/com.blackmagic.Resolve.RAWSpeedTest.desktop
cp squashfs-root/graphics/blackmagicraw-speedtest_256x256_apps.png /app/share/icons/hicolor/256x256/apps/com.blackmagic.Resolve.RAWSpeedTest.png
fi
# Create udev rules
#mkdir -p /app/lib/udev/rules.d
#chmod 755 /app/lib/udev/rules.d
#cat > /app/lib/udev/rules.d/75-davincipanel.rules <<EOF
#SUBSYSTEM=="usb", ATTRS{idVendor}=="1edb", MODE="0666"
#EOF
#cat > /app/lib/udev/rules.d/75-davincikb.rules <<EOF
#SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="\$attr{bInterfaceNumber}"
# Editor Keyboard
#SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1edb", ATTRS{idProduct}=="da0b", ENV{.LOCAL_ifNum}=="04", MODE="0666"
# Speed Editor Keyboard
#SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1edb", ATTRS{idProduct}=="da0e", ENV{.LOCAL_ifNum}=="02", MODE="0666"
#EOF
#cat > /app/lib/udev/rules.d/75-sdx.rules <<EOF
#SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="096e", MODE="0666"
#EOF
cp -rp com.blackmagic.Resolve.desktop /app/share/applications/com.blackmagic.Resolve.desktop
cp -rp squashfs-root/graphics/DV_Resolve.png /app/share/icons/hicolor/128x128/apps/com.blackmagic.Resolve.png
# if [[ -e "/app/DaVinci Resolve Panels Setup/DaVinci Resolve Panels Setup" ]]; then
# cp com.blackmagic.Resolve.PanelSetup.desktop /app/share/applications/com.blackmagic.Resolve.PanelSetup.desktop
# cp -rp squashfs-root/graphics/DV_Panels.png /app/share/icons/hicolor/128x128/apps/com.blackmagic.Resolve.PanelSetup.png
# fi
if [[ -e "/app/DaVinci Control Panels Setup/DaVinci Control Panels Setup" ]]; then
cp com.blackmagic.Resolve.PanelSetup.desktop /app/share/applications/com.blackmagic.Resolve.PanelSetup.desktop
cp -rp squashfs-root/graphics/DV_Panels.png /app/share/icons/hicolor/128x128/apps/com.blackmagic.Resolve.PanelSetup.png
fi
if [[ -e "/app/bin/DaVinci Remote Monitoring" ]]; then
cp com.blackmagic.Resolve.RemoteMonitoring.desktop /app/share/applications/com.blackmagic.Resolve.RemoteMonitoring.desktop
cp -rp squashfs-root/graphics/Remote_Monitoring.png /app/share/icons/hicolor/128x128/apps/com.blackmagic.Resolve.RemoteMonitoring.png
fi
sources: sources:
- type: file - type: file
path: com.blackmagic.Resolve.desktop path: download_resolve.sh
- type: file - type: file
path: com.blackmagic.Resolve.PanelSetup.desktop path: setup_resolve.sh
- type: file - type: file
path: com.blackmagic.Resolve.RAWPlayer.desktop path: resolve.sh
- type: file
path: com.blackmagic.Resolve.RAWSpeedTest.desktop
- type: file
path: com.blackmagic.Resolve.RemoteMonitoring.desktop
- type: shell
commands:
- |
_product="davinci-resolve-studio"
# _product="davinci-resolve"
_useragent="User-Agent: Mozilla/5.0 (X11; Linux ${CARCH}) \
AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/77.0.3865.75 \
Safari/537.36"
_useragent="$(printf '%s' "$_useragent" | sed 's/[[:space:]]\+/ /g')"
_referid='77ef91f67a9e411bbbe299e595b4cfcc'
# The following will find the latest version of Resolve/Resolve Studio.
_siteurl="https://www.blackmagicdesign.com/api/support/latest-version"
_reqjson="{ \
\"product\": \"${_product}\", \
\"platform\": \"linux\" \
}"
_reqjson="$( printf '%s' "$_reqjson" | sed 's/[[:space:]]\+/ /g')"
_downloadid="$(curl \
-s \
-H 'Host: www.blackmagicdesign.com' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Origin: https://www.blackmagicdesign.com' \
-H "$_useragent" \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Referer: https://www.blackmagicdesign.com/support/download/${_referid}/Linux" \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Authority: www.blackmagicdesign.com' \
-H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
--data-ascii "$_reqjson" \
--compressed \
"$_siteurl" | jq -r '.["linux"]["downloadId"]')"
# Uncomment this to hard code the download if you want a specific version
# _downloadid='44be7e694b4e440db5d2f70ad732d3b2'
_reqjson="{ \
\"firstname\": \"Flatpak\", \
\"lastname\": \"Builder\", \
\"email\": \"someone@flathub.org\", \
\"phone\": \"202-555-0194\", \
\"country\": \"us\", \
\"state\": \"New York\", \
\"city\": \"FPK\", \
\"product\": \"DaVinci Resolve\" \
}"
_reqjson="$( printf '%s' "$_reqjson" | sed 's/[[:space:]]\+/ /g')"
_siteurl="https://www.blackmagicdesign.com/api/register/us/download/${_downloadid}"
_srcurl="$(curl \
-s \
-H 'Host: www.blackmagicdesign.com' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Origin: https://www.blackmagicdesign.com' \
-H "$_useragent" \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Referer: https://www.blackmagicdesign.com/support/download/${_referid}/Linux" \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Authority: www.blackmagicdesign.com' \
-H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
--data-ascii "$_reqjson" \
--compressed \
"${_siteurl}")"
_fname="$(curl \
--no-clobber \
-gqb '' -C - --retry 3 --retry-delay 3 \
-H 'Host: sw.blackmagicdesign.com' \
-H 'Upgrade-Insecure-Requests: 1' \
-H "${_useragent}" \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.9' \
-w '%{filename_effective}' \
--compressed \
-O \
${_srcurl})"
unzip -x "${_fname}"
+41
View File
@@ -0,0 +1,41 @@
####
# Flatpak Configuration for building DaVinci Resolve
#
####
app-id: com.blackmagic.ResolveStudio
runtime: org.freedesktop.Platform
runtime-version: &runtime-version '22.08'
sdk: org.freedesktop.Sdk
finish-args:
- --share=ipc
- --share=network
- --socket=pulseaudio
- --socket=x11
- --socket=wayland
- --device=dri
- --filesystem=xdg-documents
- --filesystem=xdg-cache
- --filesystem=xdg-data
- --filesystem=xdg-videos
- --filesystem=~/.local/share/DaVinciResolve
command: /app/bin/resolve.sh
modules:
- shared-modules/glu/glu-9.json
- name: resolve
buildsystem: simple
build-options:
build-args:
- --share=network
build-commands:
- |
./download_resolve.sh -p davinci-resolve-studio
./setup_resolve.sh -s
install -Dm755 resolve.sh /app/bin/resolve.sh
sources:
- type: file
path: download_resolve.sh
- type: file
path: setup_resolve.sh
- type: file
path: resolve.sh
+126
View File
@@ -0,0 +1,126 @@
#!/bin/sh
#
# By default, the script in here will download the latest version of DaVinci Resolve.
#
# Use the following to get a full list of download IDs from Blackmagic:
#curl -o- https://www.blackmagicdesign.com/api/support/nz/downloads.json | jq -r '.downloads[] | select(.urls["Linux"] != null) | select(.urls["Linux"][0]["product"] == "davinci-resolve-studio") | [.urls["Linux"][0].downloadTitle, .urls["Linux"][0].downloadId] | @tsv'
# or:
#curl -o- https://www.blackmagicdesign.com/api/support/nz/downloads.json | jq -r '.downloads[] | select(.urls["Linux"] != null) | select(.urls["Linux"][0]["product"] == "davinci-resolve") | [.urls["Linux"][0].downloadTitle, .urls["Linux"][0].downloadId] | @tsv'
#DaVinci Resolve 18.1.4 6449dc76e0b845bcb7399964b00a3ec4
#DaVinci Resolve 18.1.3 44be7e694b4e440db5d2f70ad732d3b2
#DaVinci Resolve 18.1.2 4755b7bd2d924c0db1980824edb84a20
#DaVinci Resolve 18.1.1 e09749f2de1d4c20a2b707c405d243fd
####
PRODUCT='davinci-resolve'
SITEURL='https://www.blackmagicdesign.com/api/support/latest-version'
REFERID='77ef91f67a9e411bbbe299e595b4cfcc'
USERAGENT="User-Agent: Mozilla/5.0 (X11; Linux ${CARCH}) \
AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/77.0.3865.75 \
Safari/537.36"
# e.g. DOWNLOADID='44be7e694b4e440db5d2f70ad732d3b2'
DOWNLOADID=''
####
#
# Process arguments
#
####
usage()
{
echo "Usage: $0 [ -p | --product PRODUCT ] [ -d | --downloadid DOWNLOADID ]"
echo ""
echo "PRODUCT is davinci-resolve or davinci-resolve-studio"
exit 2
}
PARSED_ARGUMENTS=$(getopt -a -n download_resolve.sh -o d:p: --long download:,product: -- "$@")
VALID_ARGUMENTS=$?
if [ "$VALID_ARGUMENTS" != "0" ]; then
usage
fi
eval set -- "$PARSED_ARGUMENTS"
while :
do
case "$1" in
-p | --prefix) PRODUCT="$2" ; shift 2 ;;
-d | --downloadid) DOWNLOADID="$2" ; shift 2 ;;
--) shift; break ;;
*) echo "Unexpected option: $1 - this should not happen."
usage ;;
esac
done
####
#
# Find a download link
#
####
USERAGENT="$(printf '%s' "$USERAGENT" | sed 's/[[:space:]]\+/ /g')"
# The following will find the latest version of Resolve/Resolve Studio.
REQJSON="{ \
\"product\": \"${PRODUCT}\", \
\"platform\": \"linux\" \
}"
REQJSON="$( printf '%s' "$REQJSON" | sed 's/[[:space:]]\+/ /g')"
if [ -z "${DOWNLOADID}" ]; then
DOWNLOADID="$(curl \
-s \
-H 'Host: www.blackmagicdesign.com' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Origin: https://www.blackmagicdesign.com' \
-H "$USERAGENT" \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Referer: https://www.blackmagicdesign.com/support/download/${REFERID}/Linux" \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Authority: www.blackmagicdesign.com' \
-H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
--data-ascii "$REQJSON" \
--compressed \
"$SITEURL" | jq -r '.["linux"]["downloadId"]')"
fi
REQJSON="{ \
\"firstname\": \"Flatpak\", \
\"lastname\": \"Builder\", \
\"email\": \"someone@flathub.org\", \
\"phone\": \"202-555-0194\", \
\"country\": \"us\", \
\"state\": \"New York\", \
\"city\": \"FPK\", \
\"product\": \"DaVinci Resolve\" \
}"
REQJSON="$( printf '%s' "$REQJSON" | sed 's/[[:space:]]\+/ /g')"
SITEURL="https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}"
SRCURL="$(curl \
-s \
-H 'Host: www.blackmagicdesign.com' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Origin: https://www.blackmagicdesign.com' \
-H "$USERAGENT" \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Referer: https://www.blackmagicdesign.com/support/download/${REFERID}/Linux" \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Authority: www.blackmagicdesign.com' \
-H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
--data-ascii "$REQJSON" \
--compressed \
"${SITEURL}")"
FNAME="$(curl \
--no-clobber \
-gqb '' -C - --retry 3 --retry-delay 3 \
-H 'Host: sw.blackmagicdesign.com' \
-H 'Upgrade-Insecure-Requests: 1' \
-H "${USERAGENT}" \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.9' \
-w '%{filename_effective}' \
--compressed \
-O \
${SRCURL})"
unzip -x "${FNAME}"
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
#export BMD_RESOLVE_LUT_DIR=
#export BMD_RESOLVE_SUPPORT_DIR
export BMD_RESOLVE_CONFIG_DIR="${XDG_CONFIG_HOME}"
export BMD_RESOLVE_LICENSE_DIR="${XDG_DATA_HOME}/license"
export BMD_RESOLVE_LOGS_DIR="${XDG_DATA_HOME}/logs"
exec /app/bin/resolve $@
+202
View File
@@ -0,0 +1,202 @@
#!/bin/bash
####
# Build DaVinci Resolve in a Flatpak
#
# This script leverages heavily on work from makeresolvedeb, with great thanks:
# https://www.danieltufvesson.com/makeresolvedeb
####
PREFIX='/app'
STUDIO='false'
usage()
{
echo "Usage: $0 [ -s | --studio ] [ -p | --prefix PREFIX ]"
exit 2
}
PARSED_ARGUMENTS=$(getopt -a -n setup_resolve.sh -o sp: --long studio,prefix: -- "$@")
VALID_ARGUMENTS=$?
if [ "$VALID_ARGUMENTS" != "0" ]; then
usage
fi
eval set -- "$PARSED_ARGUMENTS"
while :
do
case "$1" in
-s | --studio) STUDIO='true' ; shift ;;
-p | --prefix) PREFIX="$2" ; shift 2 ;;
--) shift; break ;;
*) echo "Unexpected option: $1 - this should not happen."
usage ;;
esac
done
APP_ID="com.blackmagic.Resolve"
APP_DESCRIPTION="DaVinci Resolve"
if ${STUDIO}; then
APP_ID="com.blackmagic.ResolveStudio"
APP_DESCRIPTION="DaVinci Resolve Studio"
fi
./DaVinci_Resolve_*_Linux.run --appimage-extract 2>&1
find squashfs-root -type f -exec chmod a+r,u+w {} \;
find squashfs-root -type d -exec chmod a+rx,u+w {} \;
# Create directories
mkdir -p ${PREFIX}/easyDCP ${PREFIX}/scripts ${PREFIX}/share ${PREFIX}/Fairlight ${PREFIX}/share/applications ${PREFIX}/share/icons/hicolor/128x128/apps ${PREFIX}/share/icons/hicolor/256x256/apps
chmod 755 ${PREFIX}/easyDCP ${PREFIX}/scripts ${PREFIX}/share ${PREFIX}/Fairlight ${PREFIX}/share/applications ${PREFIX}/share/icons/hicolor/128x128/apps ${PREFIX}/share/icons/hicolor/256x256/apps
# Copy objects
cp -rp squashfs-root/bin ${PREFIX}/
cp -rp squashfs-root/Control ${PREFIX}/
cp -rp squashfs-root/Certificates ${PREFIX}/
cp -rp squashfs-root/DaVinci\ Control\ Panels\ Setup ${PREFIX}/
cp -rp squashfs-root/Developer ${PREFIX}/
cp -rp squashfs-root/docs ${PREFIX}/
cp -rp squashfs-root/Fairlight\ Studio\ Utility ${PREFIX}/
cp -rp squashfs-root/Fusion ${PREFIX}/
cp -rp squashfs-root/graphics ${PREFIX}/
cp -rp squashfs-root/libs ${PREFIX}/
# Can we use system Qt5? Not yet.
# rsync -avpr --exclude 'libQt5*' squashfs-root/libs ${PREFIX}/
cp -rp squashfs-root/LUT ${PREFIX}/
cp -rp squashfs-root/Onboarding ${PREFIX}/
cp -rp squashfs-root/plugins ${PREFIX}/
cp -rp squashfs-root/Technical\ Documentation ${PREFIX}/
cp -rp squashfs-root/UI_Resource ${PREFIX}/
cp -rp squashfs-root/scripts/script.checkfirmware ${PREFIX}/scripts/
cp -rp squashfs-root/scripts/script.getlogs.v4 ${PREFIX}/scripts/
cp -rp squashfs-root/scripts/script.start ${PREFIX}/scripts/
cp -rp squashfs-root/share/default-config.dat ${PREFIX}/share/
cp -rp squashfs-root/share/default_cm_config.bin ${PREFIX}/share/
cp -rp squashfs-root/share/log-conf.xml ${PREFIX}/share/
if [[ -e squashfs-root/share/remote-monitoring-log-conf.xml ]]; then
cp -rp squashfs-root/share/remote-monitoring-log-conf.xml ${PREFIX}/share/
fi
if [[ -e squashfs-root/BlackmagicRAWPlayer ]]; then
echo "Adding BlackmagicRAWPlayer"
cp -rp squashfs-root/BlackmagicRAWPlayer ${PREFIX}
cat | sed -r 's/^\s+//' > ${PREFIX}/share/applications/${APP_ID}.RAWPlayer.desktop <<' EOF'
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Blackmagic RAW Player
Exec=/app/BlackmagicRAWPlayer/BlackmagicRAWPlayer
Icon=${APP_ID}.RAWPlayer
Terminal=false
MimeType=application/x-braw-clip;application/x-braw-sidecar
StartupNotify=true
Categories=AudioVideo
EOF
cp -p squashfs-root/graphics/blackmagicraw-player_256x256_apps.png ${PREFIX}/share/icons/hicolor/256x256/apps/${APP_ID}.RAWPlayer.png
fi
if [[ -e squashfs-root/BlackmagicRAWSpeedTest ]]; then
echo "Adding BlackmagicRAWSpeedTest"
cp -rp squashfs-root/BlackmagicRAWSpeedTest ${PREFIX}
cat | sed -r 's/^\s+//' > ${PREFIX}/share/applications/${APP_ID}.RAWSpeedTest.desktop <<' EOF'
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Blackmagic RAW Speed Test
Exec=/app/BlackmagicRAWSpeedTest/BlackmagicRAWSpeedTest
Icon=${APP_ID}.RAWSpeedTest
Terminal=false
StartupNotify=true
Categories=AudioVideo
EOF
cp -p squashfs-root/graphics/blackmagicraw-speedtest_256x256_apps.png ${PREFIX}/share/icons/hicolor/256x256/apps/${APP_ID}.RAWSpeedTest.png
fi
####
# Create udev rules
#
# Figure out how to do this under Flatpak
#
####
#mkdir -p ${PREFIX}/lib/udev/rules.d
#chmod 755 ${PREFIX}/lib/udev/rules.d
#cat > ${PREFIX}/lib/udev/rules.d/75-davincipanel.rules <<EOF
#SUBSYSTEM=="usb", ATTRS{idVendor}=="1edb", MODE="0666"
#EOF
#cat > ${PREFIX}/lib/udev/rules.d/75-davincikb.rules <<EOF
#SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="\$attr{bInterfaceNumber}"
# Editor Keyboard
#SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1edb", ATTRS{idProduct}=="da0b", ENV{.LOCAL_ifNum}=="04", MODE="0666"
# Speed Editor Keyboard
#SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1edb", ATTRS{idProduct}=="da0e", ENV{.LOCAL_ifNum}=="02", MODE="0666"
#EOF
#cat > ${PREFIX}/lib/udev/rules.d/75-sdx.rules <<EOF
#SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="096e", MODE="0666"
#EOF
cat > ${PREFIX}/share/applications/${APP_ID}.desktop <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=${APP_DESCRIPTION}
Name[en_US]=${APP_DESCRIPTION}
GenericName=${APP_DESCRIPTION}
Comment=Revolutionary new tools for editing, visual effects, color correction and professional audio post production, all in a single application!
Exec=/app/bin/resolve.sh %U
Icon=${APP_ID}
Terminal=false
MimeType=application/x-resolveproj;
StartupNotify=true
Categories=AudioVideo
EOF
cp -rp squashfs-root/graphics/DV_Resolve.png ${PREFIX}/share/icons/hicolor/128x128/apps/${APP_ID}.png
# if [[ -e "${PREFIX}/DaVinci Resolve Panels Setup/DaVinci Resolve Panels Setup" ]]; then
# cat | sed -r 's/^\s+//' > ${PREFIX}/share/applications/${APP_ID}.PanelSetup.desktop <<' EOF'
# [Desktop Entry]
# Version=1.0
# Encoding=UTF-8
# Type=Application
# Name=DaVinci Resolve Panels Setup
# Exec="/app/DaVinci Resolve Panels Setup/DaVinci Resolve Panels Setup"
# Icon=${APP_ID}.PanelSetup.png
# Terminal=false
# StartupNotify=true
# Categories=AudioVideo
# EOF
# cp -rp squashfs-root/graphics/DV_Panels.png ${PREFIX}/share/icons/hicolor/128x128/apps/${APP_ID}.PanelSetup.png
# fi
if [[ -e "${PREFIX}/DaVinci Control Panels Setup/DaVinci Control Panels Setup" ]]; then
cat | sed -r 's/^\s+//' > ${PREFIX}/share/applications/${APP_ID}.PanelSetup.desktop <<' EOF'
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=DaVinci Resolve Panels Setup
Exec="/app/DaVinci Resolve Panels Setup/DaVinci Resolve Panels Setup"
Icon=${APP_ID}.PanelSetup.png
Terminal=false
StartupNotify=true
Categories=AudioVideo
EOF
cp -rp squashfs-root/graphics/DV_Panels.png ${PREFIX}/share/icons/hicolor/128x128/apps/${APP_ID}.PanelSetup.png
fi
if [[ -e "${PREFIX}/bin/DaVinci Remote Monitoring" ]]; then
cat | sed -r 's/^\s+//' > ${PREFIX}/share/applications/${APP_ID}.RemoteMonitoring.desktop <<' EOF'
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=DaVinci Remote Monitoring
Exec="/app/bin/DaVinci Remote Monitoring"
Icon=${APP_ID}.RemoteMonitoring
Terminal=false
StartupNotify=true
Categories=AudioVideo
EOF
cp -rp squashfs-root/graphics/Remote_Monitoring.png ${PREFIX}/share/icons/hicolor/128x128/apps/${APP_ID}.RemoteMonitoring.png
fi