HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/resolve/scripts/pre_install.sh
#!/bin/bash

# Installer will replace PRODUCT_INSTALL_LOCATION with actual install path

INSTALL_DIR="PRODUCT_INSTALL_LOCATION"


USER_UID=$SUDO_UID
if [ -z "$USER_UID" ]; then
    USER_UID=$PKEXEC_UID
fi
if [ -z "$USER_UID" ]; then
    USER_UID=0
fi
USER_HOME=`awk -v val=$USER_UID -F ":" '\$3==val{print \$6;exit}' /etc/passwd`

uninstall_legacy_bmdPanelDaemon()
{
    # Uninstall BMD panel daemon
    SVC_NAME=bmdpaneld

    # Kill the daemon in case it is running
    killall -9 ${SVC_NAME}

    if [ -f /etc/init.d/${SVC_NAME} ]; then
        echo "#Uninstalling BMD panel service..."
        service ${SVC_NAME} stop
        /sbin/chkconfig --del ${SVC_NAME}
        rm -f /etc/init.d/${SVC_NAME}
    fi
}

remove_old_dirs()
{
    DIRS_TO_REMOVE=(
        "Onboarding"
        "bin"
        "libs"
        "plugins"
        "UI_Resource"
        "DaVinci Control Panels Setup"
        "DaVinci Resolve Panels Setup")

    if [[ -d ${INSTALL_DIR} ]]; then
        echo "Removing old files"
        for dir in "${DIRS_TO_REMOVE[@]}"; do
            rm -rf "$INSTALL_DIR/$dir"
        done
    fi
}

# Entry for pre_install script
#Note: The installer copies the files as normal user,
#make sure the set the permission while making the target dir

# Add system info to log
echo -e "#Starting DaVinci Resolve install"
uname -a
echo "Install Location : $INSTALL_DIR "
echo "User ID: $USER_UID "
echo "User Home: $USER_HOME"

if [[ $EUID -ne 0 ]]; then
    # Starting install as non-root user
    mkdir -p "$INSTALL_DIR"
    exit 0
fi

remove_old_dirs

if [[ -d ${INSTALL_DIR} && ${INSTALL_DIR} == /home/resolve* ]]; then
    chown $USER_UID "$INSTALL_DIR"
else
    # Uninstall the panel daemon only on Standalone install
    uninstall_legacy_bmdPanelDaemon
    mkdir -m 0775 -p "$INSTALL_DIR"
    chown $USER_UID "$INSTALL_DIR" -R
fi

exit 0