diff --git a/k8s/jellyfin/deployment.yaml b/k8s/jellyfin/deployment.yaml
index f1f2132..6dee683 100644
--- a/k8s/jellyfin/deployment.yaml
+++ b/k8s/jellyfin/deployment.yaml
@@ -36,14 +36,45 @@ spec:
sed -i 's|/var/lib/jellyfin/metadata|/config/metadata|g' /config/system.xml || true
sed -i 's|/var/cache/jellyfin|/config/cache|g' /config/system.xml || true
fi
- if [ ! -f /config/data/jellyfin.db ] && [ -d /host-data/data ]; then
- echo "Syncing Jellyfin data, metadata, plugins and root from /var/lib/jellyfin..."
- mkdir -p /config/data /config/metadata /config/plugins /config/root
- [ -d /host-data/data ] && cp -a /host-data/data/* /config/data/ || true
- [ -d /host-data/metadata ] && cp -a /host-data/metadata/* /config/metadata/ || true
- [ -d /host-data/plugins ] && cp -a /host-data/plugins/* /config/plugins/ || true
- [ -d /host-data/root ] && cp -a /host-data/root/* /config/root/ || true
+
+ mkdir -p /config/data/data /config/data/root /config/data/plugins /config/metadata /config/cache /config/log
+
+ # Move misplaced database files into /config/data/data if needed
+ if [ -f /config/data/jellyfin.db ]; then
+ echo "Relocating database files from /config/data to /config/data/data..."
+ mv -n /config/data/*.db* /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/playlists /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/subtitles /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/ScheduledTasks /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/SQLiteBackups /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/attachments /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/device.txt /config/data/data/ 2>/dev/null || true
+ mv -n /config/data/splashscreen.png /config/data/data/ 2>/dev/null || true
fi
+
+ if [ ! -f /config/data/data/jellyfin.db ] && [ -d /host-data/data ]; then
+ echo "Syncing data from /var/lib/jellyfin/data..."
+ cp -a /host-data/data/* /config/data/data/ || true
+ fi
+
+ if [ ! -d /config/metadata/library ] && [ -d /host-data/metadata ]; then
+ echo "Syncing metadata from /var/lib/jellyfin/metadata..."
+ cp -a /host-data/metadata/* /config/metadata/ || true
+ fi
+
+ if [ ! -d /config/data/plugins/configurations ] && [ -d /host-data/plugins ]; then
+ echo "Syncing plugins from /var/lib/jellyfin/plugins..."
+ cp -a /host-data/plugins/* /config/data/plugins/ || true
+ fi
+
+ if [ ! -d /config/data/root/default ] && [ -d /host-data/root ]; then
+ echo "Syncing root library structure from /var/lib/jellyfin/root..."
+ cp -a /host-data/root/* /config/data/root/ || true
+ fi
+
+ [ ! -e /config/root ] && ln -sf /config/data/root /config/root || true
+ [ ! -e /config/plugins ] && ln -sf /config/data/plugins /config/plugins || true
+
chown -R 33:33 /config
volumeMounts:
- name: config
@@ -93,6 +124,12 @@ spec:
mountPath: /mnt/mp3
- name: dri
mountPath: /dev/dri
+ - name: config
+ mountPath: /var/lib/jellyfin/root
+ subPath: data/root
+ - name: config
+ mountPath: /var/lib/jellyfin/metadata
+ subPath: metadata
livenessProbe:
httpGet:
path: /jellyfin/health