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:
2026-07-14 10:32:56 -04:00
parent e51d3577ce
commit 8914f4dce9
29 changed files with 4123 additions and 31 deletions
+156
View File
@@ -0,0 +1,156 @@
#!/bin/bash
# Jellyfin Debian Package Builder
# This script builds a .deb package from the current publishing configuration
# Usage: ./scripts/linux/build-deb-package.sh [--no-clean] [--output-dir PATH]
set -e
# Configuration
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
BUILD_TEMP_DIR=""
OUTPUT_DIR="${OUTPUT_DIR:-$PROJECT_ROOT/dist}"
CLEAN_AFTER=true
VERBOSE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--no-clean)
CLEAN_AFTER=false
shift
;;
--output-dir)
OUTPUT_DIR="$2"
shift 2
;;
--verbose)
VERBOSE=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--no-clean] [--output-dir PATH] [--verbose]"
exit 1
;;
esac
done
# Functions
log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*"
}
error() {
echo "[ERROR] $*" >&2
exit 1
}
cleanup() {
if [[ "$CLEAN_AFTER" == true ]] && [[ -n "$BUILD_TEMP_DIR" ]] && [[ -d "$BUILD_TEMP_DIR" ]]; then
log "Cleaning up temporary directory: $BUILD_TEMP_DIR"
rm -rf "$BUILD_TEMP_DIR"
fi
}
trap cleanup EXIT
# Extract version
log "Reading version from SharedVersion.cs..."
if [[ ! -f "$PROJECT_ROOT/SharedVersion.cs" ]]; then
error "SharedVersion.cs not found in $PROJECT_ROOT"
fi
VERSION=$(grep -oP 'Version\s*=\s*"\K[^"]+' "$PROJECT_ROOT/SharedVersion.cs")
if [[ -z "$VERSION" ]]; then
error "Could not extract version from SharedVersion.cs"
fi
log "Version: $VERSION"
# Create output directory
mkdir -p "$OUTPUT_DIR"
log "Output directory: $OUTPUT_DIR"
# Create temporary build directory
BUILD_TEMP_DIR=$(mktemp -d)
log "Temporary build directory: $BUILD_TEMP_DIR"
# Build and publish
cd "$PROJECT_ROOT"
log "Restoring dependencies..."
dotnet restore Jellyfin.sln -r linux-x64 > /dev/null 2>&1 || \
error "Failed to restore dependencies"
log "Building solution..."
dotnet build Jellyfin.sln --configuration Release > /dev/null 2>&1 || \
error "Failed to build solution"
log "Publishing Jellyfin.Server..."
if ! dotnet publish "Jellyfin.Server/Jellyfin.Server.csproj" \
--configuration Release \
--self-contained true \
--runtime linux-x64 \
--output "$BUILD_TEMP_DIR" > /dev/null 2>&1; then
error "Failed to publish Jellyfin.Server"
fi
# Verify published output
if [[ ! -f "$BUILD_TEMP_DIR/jellyfin" ]]; then
error "Published files not found in $BUILD_TEMP_DIR"
fi
log "Published files size: $(du -sh "$BUILD_TEMP_DIR" | cut -f1)"
# Create Debian package
PACKAGE_NAME="jellyfin-${VERSION}_amd64.deb"
PACKAGE_PATH="$OUTPUT_DIR/$PACKAGE_NAME"
log "Creating Debian package: $PACKAGE_NAME"
# Check if fpm is installed
if ! command -v fpm &> /dev/null; then
error "fpm is not installed. Install it with: sudo gem install fpm"
fi
# Build the package
if fpm \
-s dir \
-t deb \
-n jellyfin \
-v "$VERSION" \
-C "$BUILD_TEMP_DIR" \
-p "$PACKAGE_PATH" \
--license "LICENSE" \
--vendor "Jellyfin Contributors" \
--maintainer "Jellyfin Team <team@jellyfin.org>" \
--description "Jellyfin Media Server - a free software media server" \
--url "https://jellyfin.org" \
--architecture x86_64 \
--depends "libssl3" \
--depends "libicu72" \
--depends "libfontconfig1" \
--depends "libc6 (>= 2.31)" \
--before-remove "$PROJECT_ROOT/scripts/debian/prerm" \
--after-install "$PROJECT_ROOT/scripts/debian/postinst" \
--after-remove "$PROJECT_ROOT/scripts/debian/postrm" \
opt/=opt/jellyfin; then
log "Package created successfully!"
log "Package path: $PACKAGE_PATH"
log "Package size: $(du -sh "$PACKAGE_PATH" | cut -f1)"
# Display package information
log ""
log "Package Information:"
dpkg-deb -I "$PACKAGE_PATH" | sed 's/^/ /'
log ""
log "Installation command:"
log " sudo dpkg -i \"$PACKAGE_PATH\""
log ""
log "If dependencies are missing, run:"
log " sudo apt-get install -f"
else
error "Failed to create Debian package"
fi