Files
dotfiles/config/home-manager/packages/workstation/fix-electron-apps.sh
Menno van Leeuwen 8dc9f9f474
Some checks failed
Ansible Lint Check / check-ansible (push) Failing after 14s
Nix Format Check / check-format (push) Successful in 45s
Python Lint Check / check-python (push) Failing after 9s
feat: improve electron sandbox path search by using name instead of path
2025-04-01 20:10:40 +02:00

30 lines
1.0 KiB
Bash

#!/usr/bin/env bash
echo "=============================================="
echo "Electron chrome-sandbox permission fixer"
echo "=============================================="
echo "This script requires sudo permissions to fix"
echo "Electron app permissions."
echo ""
# Find all electron sandbox paths
echo "Finding Electron chrome-sandbox instances..."
SANDBOX_PATHS=$(find /nix/store -name chrome-sandbox -type f -executable 2>/dev/null)
if [ -n "$SANDBOX_PATHS" ]; then
count=$(echo "$SANDBOX_PATHS" | wc -l)
echo "Found $count chrome-sandbox instances"
# If we get here, we're running with sudo
echo "$SANDBOX_PATHS" | while read -r SANDBOX_PATH; do
if [ -e "$SANDBOX_PATH" ]; then
echo "Setting permissions for $SANDBOX_PATH"
sudo chown root:root "$SANDBOX_PATH" || echo "Failed to set owner for $SANDBOX_PATH"
sudo chmod 4755 "$SANDBOX_PATH" || echo "Failed to set permissions for $SANDBOX_PATH"
fi
done
echo "All permissions set successfully"
else
echo "Could not find any Electron chrome-sandbox paths"
fi