soulsync/entrypoint.sh
Broque Thomas 2f8bad23a8 Add manual track matching and Docker permission docs
Implements manual track matching (discovery fix modal) for YouTube, Tidal, and Beatport platforms, allowing users to search and select Spotify tracks for unmatched results. Adds backend endpoints and frontend logic for updating matches, improves conversion of discovery results for sync/download, and updates Dockerfile/entrypoint for dynamic PUID/PGID/UMASK support. Includes a new DOCKER_PERMISSIONS.md guide.
2025-10-03 10:48:25 -07:00

57 lines
1.6 KiB
Bash

#!/bin/bash
# SoulSync Docker Entrypoint Script
# Handles PUID/PGID/UMASK configuration for proper file permissions
set -e
# Default values
PUID=${PUID:-1000}
PGID=${PGID:-1000}
UMASK=${UMASK:-022}
echo "🐳 SoulSync Container Starting..."
echo "📝 User Configuration:"
echo " PUID: $PUID"
echo " PGID: $PGID"
echo " UMASK: $UMASK"
# Get current soulsync user/group IDs
CURRENT_UID=$(id -u soulsync)
CURRENT_GID=$(id -g soulsync)
# Only modify user/group if they differ from requested values
if [ "$CURRENT_UID" != "$PUID" ] || [ "$CURRENT_GID" != "$PGID" ]; then
echo "🔧 Adjusting user permissions..."
# Modify group ID if needed
if [ "$CURRENT_GID" != "$PGID" ]; then
echo " Changing group ID from $CURRENT_GID to $PGID"
groupmod -o -g "$PGID" soulsync
fi
# Modify user ID if needed
if [ "$CURRENT_UID" != "$PUID" ]; then
echo " Changing user ID from $CURRENT_UID to $PUID"
usermod -o -u "$PUID" soulsync
fi
# Fix ownership of app directories
echo "🔒 Fixing permissions on app directories..."
chown -R soulsync:soulsync /app/config /app/database /app/logs /app/downloads /app/Transfer 2>/dev/null || true
else
echo "✅ User/Group IDs already correct"
fi
# Set umask for file creation permissions
echo "🎭 Setting UMASK to $UMASK"
umask "$UMASK"
# Display final user info
echo "👤 Running as:"
echo " User: $(id -u soulsync):$(id -g soulsync) ($(id -un soulsync):$(id -gn soulsync))"
echo " UMASK: $(umask)"
echo ""
echo "🚀 Starting SoulSync Web Server..."
# Execute the main command as the soulsync user
exec gosu soulsync "$@"