Add SQL query patterns documentation and Linux package build scripts
- Created `TV_SHOWS_SQL_QUERY_PATTERNS.md` to document SQL query patterns for TV shows, including performance issues and missing indexes. - Added `README.md` for Linux package building, detailing steps for creating Debian and Red Hat packages. - Implemented build scripts for Debian and Red Hat, including service files and post-installation hooks. - Added necessary scripts for managing Jellyfin service lifecycle on both Debian and Red Hat systems. - Included package specifications and installation instructions for both distributions.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
# Jellyfin postinst script - runs after package installation
|
||||
|
||||
set -e
|
||||
|
||||
# Create jellyfin user if it doesn't exist
|
||||
if ! getent passwd jellyfin > /dev/null; then
|
||||
useradd --system \
|
||||
--home /var/lib/jellyfin \
|
||||
--shell /bin/false \
|
||||
--comment "Jellyfin Media Server" \
|
||||
jellyfin
|
||||
fi
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p /var/lib/jellyfin
|
||||
mkdir -p /var/log/jellyfin
|
||||
mkdir -p /var/cache/jellyfin
|
||||
mkdir -p /etc/jellyfin
|
||||
|
||||
# Set proper ownership and permissions
|
||||
chown -R jellyfin:jellyfin /var/lib/jellyfin
|
||||
chown -R jellyfin:jellyfin /var/log/jellyfin
|
||||
chown -R jellyfin:jellyfin /var/cache/jellyfin
|
||||
chown -R jellyfin:jellyfin /etc/jellyfin
|
||||
chmod 755 /var/lib/jellyfin
|
||||
chmod 755 /var/log/jellyfin
|
||||
chmod 755 /var/cache/jellyfin
|
||||
chmod 755 /etc/jellyfin
|
||||
|
||||
# Set permissions on the application directory
|
||||
chown -R jellyfin:jellyfin /opt/jellyfin
|
||||
chmod -R 755 /opt/jellyfin
|
||||
|
||||
# Create systemd service file if it doesn't exist
|
||||
if [[ ! -f /etc/systemd/system/jellyfin.service ]]; then
|
||||
cat > /etc/systemd/system/jellyfin.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Jellyfin Media Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=jellyfin
|
||||
Group=jellyfin
|
||||
WorkingDirectory=/var/lib/jellyfin
|
||||
ExecStart=/opt/jellyfin/jellyfin --webdir=/opt/jellyfin/wwwroot --logdir=/var/log/jellyfin --datadir=/var/lib/jellyfin --cachedir=/var/cache/jellyfin
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Reload systemd daemon
|
||||
systemctl daemon-reload
|
||||
|
||||
# Enable and start the service
|
||||
if [[ -f /etc/systemd/system/jellyfin.service ]]; then
|
||||
systemctl enable jellyfin.service
|
||||
systemctl restart jellyfin.service || true
|
||||
fi
|
||||
|
||||
# Display post-installation message
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Jellyfin Media Server installed!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Service status: systemctl status jellyfin"
|
||||
echo "View logs: journalctl -u jellyfin -f"
|
||||
echo "Configuration: /etc/jellyfin/"
|
||||
echo "Data: /var/lib/jellyfin/"
|
||||
echo "Logs: /var/log/jellyfin/"
|
||||
echo ""
|
||||
echo "Access Jellyfin at: http://localhost:8096"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user