File: //opt/resolve/scripts/script.update
#!/bin/bash
if [ -d "/home/resolve/Cyclone" ]
then
IS_DVD_INSTALLATION=true
else
IS_DVD_INSTALLATION=false
fi
USER=`whoami`
if ${IS_DVD_INSTALLATION}
then
if [ "${USER}" != "resolve" ]
then
echo "Only user resolve can do this"
exit 1
fi
else
if [ "${USER}" != "root" ]
then
echo "Only root can do this"
exit 1
fi
fi
if ${IS_DVD_INSTALLATION}
then
RESOLVE_BASE="/home/resolve"
else
RESOLVE_BASE="/opt/resolve"
fi
killall -9 resolve
killall -9 ${RESOLVE_BASE}/bin/resolve
# Wait for file descriptors to be closed
sleep 1
echo "Copying Resolve files..."
cp ${RESOLVE_BASE}/Cyclone/resolve ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/run_bmdpaneld ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/bmdpaneld ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/BMDPanelFirmware ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/qt.conf ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/ShowDpxHeader ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/TestIO ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/deviceQuery ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/bandwidthTest ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/oclDeviceQuery ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/oclBandwidthTest ${RESOLVE_BASE}/bin/ >& /dev/null
cp ${RESOLVE_BASE}/Cyclone/VstScanner ${RESOLVE_BASE}/bin/ >& /dev/null
if ${IS_DVD_INSTALLATION}
then
# Update the BMD panel daemon
sudo sh ${RESOLVE_BASE}/Cyclone/BMDPanelDaemon.sh
# Move config files to configs directory and set up a symlink for backwards compatibility
PATHS_TO_MOVE=(
"Fairlight"
"OFXPluginCache.xml"
"UI.preset"
"config-fairlight.dat"
"log-conf.xml"
".dblist"
".fsbookmarklist"
".afxcache"
".ofxinit"
)
pushd ${RESOLVE_BASE} >& /dev/null
for PATHTOMOVE in "${PATHS_TO_MOVE[@]}"
do
ORGPATH="${PATHTOMOVE}"
NEWPATH="configs/${PATHTOMOVE}"
if [ ! -L "${ORGPATH}" ] && [ -e "${ORGPATH}" ]
then
rm -rf "${NEWPATH}" 2> /dev/null
mv "${ORGPATH}" "${NEWPATH}"
ln -s "${NEWPATH}" "${ORGPATH}"
fi
done
popd >& /dev/null
pushd ${RESOLVE_BASE}/Cyclone >& /dev/null
ORGPATH=".config.data"
NEWPATH="../configs/.config.data"
if [ ! -L "${ORGPATH}" ] && [ -e "${ORGPATH}" ]
then
rm -rf "${NEWPATH}" 2> /dev/null
mv "${ORGPATH}" "${NEWPATH}"
ln -s "${NEWPATH}" "${ORGPATH}"
fi
popd >& /dev/null
pushd ${RESOLVE_BASE}/configs >& /dev/null
ORGPATH="config-full.dat"
NEWPATH="config.dat"
if [ ! -L "${ORGPATH}" ] && [ -e "${ORGPATH}" ]
then
# Check and migrate Decklink selection to the Preferences UI
SDI=`\grep "^Local.Gui.ENABLESDI = " ${ORGPATH} | awk '{print $NF}'`
if [ "${SDI}" == "3" ]
then
echo "SDI = DeckLink" >> ${RESOLVE_BASE}/configs/.config.data
fi
# Check and migrate path mapping to the Preferences UI
NUM_MAPPING_LINES=`\grep ^Site.1.FS.[0-9]*.MappedRoot ${ORGPATH} | wc -l`
CUR_MAPPING_LINE=1
while [ ${CUR_MAPPING_LINE} -le ${NUM_MAPPING_LINES} ]
do
MAPPING_LINE=`\grep ^Site.1.FS.[0-9]*.MappedRoot ${ORGPATH} | head -n ${CUR_MAPPING_LINE} | tail -n 1`
MAPPING_INDEX=`echo ${MAPPING_LINE} | sed -e 's/\./ /g' | awk '{print $4}'`
MAPPED_PATH=`echo ${MAPPING_LINE} | awk '{print $NF}'`
if [ "${MAPPED_PATH}" != "=" ]
then
echo "IoFsMappedMount_${MAPPING_INDEX} = ${MAPPED_PATH}" >> ${RESOLVE_BASE}/configs/.config.data
fi
CUR_MAPPING_LINE=$((${CUR_MAPPING_LINE}+1))
done
rm -rf "${NEWPATH}" 2> /dev/null
mv "${ORGPATH}" "${NEWPATH}"
ln -s "${NEWPATH}" "${ORGPATH}"
fi
popd >& /dev/null
fi
if ! ${IS_DVD_INSTALLATION}
then
echo "Copying scripts..."
cp ${RESOLVE_BASE}/Cyclone/script.getlogs.v4 ${RESOLVE_BASE}/scripts/ >& /dev/null
echo "Copying docs..."
cp ${RESOLVE_BASE}/Cyclone/DaVinci_Resolve_Manual.pdf ${RESOLVE_BASE}/docs/ >& /dev/null
echo "Copying Onboarding package..."
rsync -avz --delete ${RESOLVE_BASE}/Cyclone/Onboarding ${RESOLVE_BASE}/ >& /dev/null
fi
# Update the Developer files, PowerGrades and LUTs - Do not clear the folders as user might have added their own files there
rsync -avz ${RESOLVE_BASE}/Cyclone/Developer ${RESOLVE_BASE}/ >& /dev/null
rsync -avz ${RESOLVE_BASE}/Cyclone/PowerGrades ${RESOLVE_BASE}/ >& /dev/null
rsync -avz ${RESOLVE_BASE}/Cyclone/LUT/* ${RESOLVE_BASE}/LUT/ >& /dev/null
gunzip -f ${RESOLVE_BASE}/LUT/trim_lut0.dpx.gz >& /dev/null
echo "Copying Onboarding package..."
rsync -avz --delete ${RESOLVE_BASE}/Cyclone/Onboarding ${RESOLVE_BASE}/ >& /dev/null
echo "Copying UI resources..."
rsync -avz --delete ${RESOLVE_BASE}/Cyclone/UI_Resource ${RESOLVE_BASE}/ >& /dev/null
echo "Copying libraries..."
rsync -avz --delete ${RESOLVE_BASE}/Cyclone/libs ${RESOLVE_BASE}/ >& /dev/null
rsync -avz --delete ${RESOLVE_BASE}/Cyclone/plugins ${RESOLVE_BASE}/ >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/aaf_runtime_libs_x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/easydcp-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/fairlight-lib-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/fusion-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/ffmpeg-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/graphviz-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/log4cxx-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/sonyrawdev-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/smdk-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
tar zxf ${RESOLVE_BASE}/libs/sxavc-rt-linux-x86_64.tgz -C ${RESOLVE_BASE}/libs >& /dev/null
rm -rf ${RESOLVE_BASE}/libs/libcuda.so* >& /dev/null
if ${IS_DVD_INSTALLATION}
then
echo "Copying utilities..."
pushd ${RESOLVE_BASE}/Cyclone >& /dev/null
cp ShowDpxHeader TestIO IBClient IBServer deviceQuery bandwidthTest oclDeviceQuery oclBandwidthTest ${RESOLVE_BASE}/bin/ >& /dev/null
popd >& /dev/null
# If the BMD panel daemon is running, restart it. The new Resolve binary might have updated graphics.
# NOTE: This must be the LAST step as this may need to reboot the system in case a firmware update is needed.
sudo service bmdpaneld status | grep "bmdpaneld is running..." >& /dev/null
if [ $? -eq 0 ]
then
${RESOLVE_BASE}/.kde/Autostart/StartBMDPanelDaemon
fi
else
echo "Creating shortcuts..."
cat > /usr/share/applications/DaVinci\ Resolve.desktop << EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Comment[en_US]=
Encoding=UTF-8
Exec='${RESOLVE_BASE}/bin/resolve'
Icon=${RESOLVE_BASE}/graphics/DV_Resolve.png
MimeType=
Name=DaVinci Resolve
Path=
ServiceTypes=
SwallowExec=
SwallowTitle=
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
EOF
INSTALL_USER=`who -m | awk '{print $1}'`
INSTALL_GROUP=`groups ${INSTALL_USER} | awk '{print $3}'`
USER_HOME=`eval echo ~${INSTALL_USER}`
cp -f /usr/share/applications/DaVinci\ Resolve.desktop ${USER_HOME}/Desktop/
/bin/chown ${INSTALL_USER}.${INSTALL_GROUP} ${USER_HOME}/Desktop/DaVinci\ Resolve.desktop
/bin/chmod +x ${USER_HOME}/Desktop/DaVinci\ Resolve.desktop
fi