Add comments, README, and fix security/robustness issues

- Replace eval with getent passwd to prevent command injection
- Use dpkg -s for precise FUSE package detection
- Add set -o pipefail
- Fix LD_LIBRARY_PATH trailing colon
- Use cp -a instead of mv glob for AppImage extraction
- Add error checks in fallback path
- Use chmod u+rwX,go+rX instead of 774

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
28allday 2026-03-28 12:40:06 +00:00
parent 3ed533f89c
commit 2e0d062f0e
2 changed files with 192 additions and 20 deletions

113
README.md Normal file
View file

@ -0,0 +1,113 @@
# DaVinci Resolve - Pop!_OS
Install [DaVinci Resolve](https://www.blackmagicdesign.com/products/davinciresolve) on Pop!_OS 24.04 with automatic dependency installation and library conflict resolution.
## Requirements
- **OS**: Pop!_OS 24.04
- **DaVinci Resolve ZIP**: Downloaded from [blackmagicdesign.com](https://www.blackmagicdesign.com/products/davinciresolve) to `~/Downloads/`
## Quick Start
1. **Download DaVinci Resolve** from [blackmagicdesign.com](https://www.blackmagicdesign.com/products/davinciresolve)
- Choose **Linux** and download the ZIP file
- Save to `~/Downloads/`
2. **Run the installer**:
```bash
git clone https://github.com/28allday/DaVinci-Resolve-PopOS.git
cd DaVinci-Resolve-PopOS
chmod +x popDR.sh
./popDR.sh
```
## What It Does
### 1. Installs FUSE Libraries
The Resolve installer needs FUSE to mount itself. If FUSE isn't available, the script falls back to manual extraction.
| Package | Purpose |
|---------|---------|
| `fuse` | FUSE kernel module and mount tools |
| `libfuse2` | Userspace library for AppImage support |
### 2. Installs Qt5 Libraries
Resolve's UI is built with Qt5. Pop!_OS uses GTK (COSMIC/GNOME) so Qt5 may not be present.
| Package | Purpose |
|---------|---------|
| `qtbase5-dev` + tools | Qt5 core framework |
| `libqt5core5a`, `libqt5gui5`, `libqt5widgets5` | Qt5 runtime |
| `libxrender1`, `libxrandr2`, `libxi6` | X11 extensions |
| `qtwayland5` | Wayland support |
### 3. Extracts and Installs Resolve
- Finds the ZIP in `~/Downloads/`
- Tries running the installer with FUSE
- Falls back to `--appimage-extract` if FUSE doesn't work
- Installs to `/opt/resolve`
### 4. Resolves Library Conflicts
| Library | Action | Why |
|---------|--------|-----|
| `libgio-2.0.so` | Moved to `not_used/` | Bundled version conflicts with system |
| `libgmodule-2.0.so` | Moved to `not_used/` | Bundled version conflicts with system |
| `libglib-2.0.so.0` | Replaced with system copy | Stable C ABI, safe to swap |
### 5. Cleans Up
Removes temporary extraction files. The application stays at `/opt/resolve`.
## Pop!_OS Advantages
Pop!_OS is one of the easier distros for Resolve because:
- The **NVIDIA ISO** comes with proprietary drivers pre-configured
- Ubuntu-based, so most Resolve dependencies are readily available
- System76's hardware support means GPU drivers are well-tested
## Troubleshooting
### Resolve won't start
- Launch from terminal: `/opt/resolve/bin/resolve`
- Check GPU drivers: `nvidia-smi` (NVIDIA) or `glxinfo | grep renderer` (AMD)
### Qt plugin errors
```bash
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms
/opt/resolve/bin/resolve
```
### FUSE errors during installation
The script handles this automatically with `--appimage-extract` fallback. No action needed.
## Updating Resolve
Download the new ZIP and run the script again:
```bash
./popDR.sh
```
## Uninstalling
```bash
sudo rm -rf /opt/resolve
sudo rm -f /usr/share/applications/DaVinciResolve.desktop
rm -f ~/.local/share/applications/DaVinciResolve.desktop
rm -rf ~/.local/share/DaVinciResolve
```
## Credits
- [System76](https://system76.com/) - Pop!_OS
- [Blackmagic Design](https://www.blackmagicdesign.com/) - DaVinci Resolve
## License
This project is provided as-is.

View file

@ -1,19 +1,51 @@
#!/bin/bash #!/bin/bash
# ==============================================================================
# DaVinci Resolve Installer for Pop!_OS 24.04
#
# DaVinci Resolve is a professional video editing suite by Blackmagic Design.
# This script automates the installation on Pop!_OS 24.04, handling:
# - FUSE library installation (needed for the AppImage-style installer)
# - Qt5 library installation (Resolve's UI depends on Qt5)
# - ZIP extraction and installer execution
# - Fallback AppImage extraction if FUSE isn't working
# - Library conflict resolution (bundled glib/gio vs system versions)
#
# Pop!_OS is Ubuntu-based, so this script uses apt for package management.
# Pop!_OS ships with NVIDIA drivers pre-configured on the NVIDIA ISO,
# making it one of the easier distros for Resolve.
#
# Prerequisites:
# - Pop!_OS 24.04
# - DaVinci Resolve Linux ZIP downloaded to ~/Downloads/
# (download from https://www.blackmagicdesign.com/products/davinciresolve)
# - Internet connection (for installing packages)
#
# Usage:
# chmod +x popDR.sh
# ./popDR.sh
# ==============================================================================
# Script to Install DaVinci Resolve on Pop!_OS 24.04 set -eo pipefail # Exit on error; catch pipe failures
set -e # Exit on any error # Resolve the real user even when running with sudo. logname returns the
# user who originally logged in, not "root". getent passwd safely looks up
# Variables # the home directory without eval (which has injection risks).
ACTIVE_USER=$(logname) ACTIVE_USER=$(logname)
HOME_DIR=$(eval echo "~$ACTIVE_USER") HOME_DIR=$(getent passwd "$ACTIVE_USER" | cut -d: -f6)
DOWNLOADS_DIR="$HOME_DIR/Downloads" DOWNLOADS_DIR="$HOME_DIR/Downloads"
EXTRACTION_DIR="/opt/resolve" EXTRACTION_DIR="/opt/resolve"
ZIP_FILE_PATTERN="DaVinci_Resolve_*.zip" ZIP_FILE_PATTERN="DaVinci_Resolve_*.zip"
# Step 1: Ensure FUSE and libfuse.so.2 are Installed # ==================== Step 1: FUSE Libraries ====================
#
# The Resolve .run installer is an AppImage-style archive that uses FUSE
# to mount itself. Pop!_OS doesn't always have FUSE installed by default.
# - fuse: FUSE kernel module and mount tools
# - libfuse2: Userspace library (libfuse.so.2) for AppImage support
#
# If FUSE doesn't work, the script falls back to --appimage-extract later.
echo "Checking for FUSE and libfuse.so.2..." echo "Checking for FUSE and libfuse.so.2..."
if ! dpkg -l | grep -q fuse; then if ! dpkg -s fuse libfuse2 >/dev/null 2>&1; then
echo "Installing FUSE..." echo "Installing FUSE..."
sudo apt update sudo apt update
sudo apt install -y fuse libfuse2 sudo apt install -y fuse libfuse2
@ -24,12 +56,19 @@ if [ ! -f /lib/x86_64-linux-gnu/libfuse.so.2 ]; then
sudo apt install -y libfuse2 sudo apt install -y libfuse2
fi fi
# Step 2: Install Required Qt Libraries # ==================== Step 2: Qt5 Libraries ====================
#
# DaVinci Resolve's UI is built with Qt5. Pop!_OS uses GTK (COSMIC/GNOME)
# so Qt5 libraries may not be present. These packages provide the core
# Qt5 framework, X11 rendering extensions, and Wayland support.
echo "Installing required Qt libraries..." echo "Installing required Qt libraries..."
sudo apt install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5dbus5 \ sudo apt install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5dbus5 \
libxrender1 libxrandr2 libxi6 libxkbcommon-x11-0 libxcb-xinerama0 libxcb-xfixes0 qtwayland5 libxcb-glx0 libxcb-util1 libxrender1 libxrandr2 libxi6 libxkbcommon-x11-0 libxcb-xinerama0 libxcb-xfixes0 qtwayland5 libxcb-glx0 libxcb-util1
# Step 3: Navigate to Downloads Directory # ==================== Step 3: Find the ZIP ====================
#
# The user must download the Resolve ZIP manually from Blackmagic's website
# (registration form required). We look for it in ~/Downloads/.
echo "Navigating to Downloads directory..." echo "Navigating to Downloads directory..."
if [ ! -d "$DOWNLOADS_DIR" ]; then if [ ! -d "$DOWNLOADS_DIR" ]; then
echo "Error: Downloads directory not found at $DOWNLOADS_DIR." echo "Error: Downloads directory not found at $DOWNLOADS_DIR."
@ -37,7 +76,10 @@ if [ ! -d "$DOWNLOADS_DIR" ]; then
fi fi
cd "$DOWNLOADS_DIR" cd "$DOWNLOADS_DIR"
# Step 4: Extract DaVinci Resolve ZIP File # ==================== Step 4: Extract ZIP ====================
#
# The download is a ZIP containing a .run file (self-extracting installer).
# We extract it to a temporary DaVinci_Resolve/ directory.
echo "Extracting DaVinci Resolve installer..." echo "Extracting DaVinci Resolve installer..."
ZIP_FILE=$(find . -maxdepth 1 -type f -name "$ZIP_FILE_PATTERN" | head -n 1) ZIP_FILE=$(find . -maxdepth 1 -type f -name "$ZIP_FILE_PATTERN" | head -n 1)
if [ -z "$ZIP_FILE" ]; then if [ -z "$ZIP_FILE" ]; then
@ -47,9 +89,15 @@ fi
unzip -o "$ZIP_FILE" -d DaVinci_Resolve/ unzip -o "$ZIP_FILE" -d DaVinci_Resolve/
chown -R "$ACTIVE_USER:$ACTIVE_USER" DaVinci_Resolve chown -R "$ACTIVE_USER:$ACTIVE_USER" DaVinci_Resolve
chmod -R 774 DaVinci_Resolve chmod -R u+rwX,go+rX DaVinci_Resolve
# Step 5: Run the Installer or Extract AppImage # ==================== Step 5: Run Installer ====================
#
# The .run file is an AppImage-style self-extracting archive. We try:
# 1. Run it with FUSE (SKIP_PACKAGE_CHECK=1 bypasses distro check)
# 2. Fall back to --appimage-extract if FUSE fails
#
# Qt environment variables tell the installer where to find platform plugins.
echo "Running the DaVinci Resolve installer..." echo "Running the DaVinci Resolve installer..."
cd DaVinci_Resolve cd DaVinci_Resolve
INSTALLER_FILE=$(find . -type f -name "DaVinci_Resolve_*.run" | head -n 1) INSTALLER_FILE=$(find . -type f -name "DaVinci_Resolve_*.run" | head -n 1)
@ -60,22 +108,31 @@ fi
chmod +x "$INSTALLER_FILE" chmod +x "$INSTALLER_FILE"
# Set Qt platform plugin path and debug settings # Tell Qt where to find platform plugins so the installer GUI can render.
export QT_DEBUG_PLUGINS=1 export QT_DEBUG_PLUGINS=1
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms
export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# Attempt to run the installer with FUSE; fallback to extraction # Try FUSE-based install first, fall back to manual extraction
if ! SKIP_PACKAGE_CHECK=1 ./"$INSTALLER_FILE" -a; then if ! SKIP_PACKAGE_CHECK=1 ./"$INSTALLER_FILE" -a; then
echo "FUSE is not functional. Extracting AppImage contents..." echo "FUSE is not functional. Extracting AppImage contents..."
./"$INSTALLER_FILE" --appimage-extract || { echo "Error: AppImage extraction failed"; exit 1; }
if [ ! -d "squashfs-root" ] || [ -z "$(ls -A squashfs-root)" ]; then
echo "Error: Extraction produced empty directory"; exit 1
fi
sudo mkdir -p "$EXTRACTION_DIR" sudo mkdir -p "$EXTRACTION_DIR"
./"$INSTALLER_FILE" --appimage-extract sudo cp -a squashfs-root/. "$EXTRACTION_DIR/"
sudo mv squashfs-root/* "$EXTRACTION_DIR/"
sudo chown -R root:root "$EXTRACTION_DIR" sudo chown -R root:root "$EXTRACTION_DIR"
rm -rf squashfs-root
fi fi
# Step 6: Resolve Library Conflicts # ==================== Step 6: Library Conflict Resolution ====================
#
# Resolve bundles old versions of glib/gio libraries that conflict with
# Pop!_OS's newer system versions. Moving them aside and using the system's
# glib fixes crashes and "symbol not found" errors. This is safe because
# glib has a very stable C ABI — newer versions are backwards-compatible.
echo "Resolving library conflicts..." echo "Resolving library conflicts..."
if [ -d "$EXTRACTION_DIR/libs" ]; then if [ -d "$EXTRACTION_DIR/libs" ]; then
cd "$EXTRACTION_DIR/libs" cd "$EXTRACTION_DIR/libs"
@ -83,7 +140,6 @@ if [ -d "$EXTRACTION_DIR/libs" ]; then
sudo mv libgio* not_used || true sudo mv libgio* not_used || true
sudo mv libgmodule* not_used || true sudo mv libgmodule* not_used || true
# Replace with system versions
if [ -f /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 ]; then if [ -f /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 ]; then
sudo cp /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 "$EXTRACTION_DIR/libs/" sudo cp /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 "$EXTRACTION_DIR/libs/"
else else
@ -93,7 +149,10 @@ else
echo "Error: Installation directory $EXTRACTION_DIR/libs not found. Skipping library conflict resolution." echo "Error: Installation directory $EXTRACTION_DIR/libs not found. Skipping library conflict resolution."
fi fi
# Step 7: Cleanup # ==================== Step 7: Cleanup ====================
#
# Remove the temporary extraction directory from ~/Downloads/.
# The installed application stays at /opt/resolve.
echo "Cleaning up installation files..." echo "Cleaning up installation files..."
cd "$DOWNLOADS_DIR" cd "$DOWNLOADS_DIR"
rm -rf DaVinci_Resolve rm -rf DaVinci_Resolve