From 80657e2a90293fbfda76ee49574e4fc945424b97 Mon Sep 17 00:00:00 2001 From: Yury <994443+EcksDy@users.noreply.github.com> Date: Sun, 26 Oct 2025 03:39:12 +0400 Subject: [PATCH] Add metadata.db generation for calibre-web (#444) * Add metadata.db generation for calibre-web * Attempt to fix template --- blueprints/calibre-web/docker-compose.yml | 3 ++- blueprints/calibre-web/template.toml | 25 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/blueprints/calibre-web/docker-compose.yml b/blueprints/calibre-web/docker-compose.yml index d328d516..a8062c03 100644 --- a/blueprints/calibre-web/docker-compose.yml +++ b/blueprints/calibre-web/docker-compose.yml @@ -6,11 +6,12 @@ services: - PUID=1000 - PGID=1000 - TZ=Etc/UTC -# - DOCKER_MODS=linuxserver/mods:universal-calibre # optional + # - DOCKER_MODS=linuxserver/mods:universal-calibre # optional - OAUTHLIB_RELAX_TOKEN_SCOPE=1 # optional volumes: - calibre-config:/config - calibre-books:/books + - ../files/startup-scripts:/custom-cont-init.d:ro # optional, comment out if you have your own metadata.db file, otherwise it will be created volumes: calibre-config: {} diff --git a/blueprints/calibre-web/template.toml b/blueprints/calibre-web/template.toml index 29e51dc1..63e7de8a 100644 --- a/blueprints/calibre-web/template.toml +++ b/blueprints/calibre-web/template.toml @@ -16,9 +16,24 @@ DOCKER_MODS = "linuxserver/mods:universal-calibre" OAUTHLIB_RELAX_TOKEN_SCOPE = "1" [[config.mounts]] -name = "calibre-config" -mountPath = "/config" +filePath = "startup-scripts/metadata-db-generator.sh" +content = """ +#!/bin/bash -[[config.mounts]] -name = "calibre-books" -mountPath = "/books" +FILE=/books/metadata.db +PUID=1000 +PGID=1000 + +if test -f "$FILE"; then + echo "$FILE already exists, skipping generation." +else + echo "$FILE does not exists, downloading..." + # download empty database from the calibre-web repo + curl -L -O --output-dir /books https://github.com/janeczku/calibre-web/raw/refs/heads/master/library/metadata.db + echo "$FILE downloaded, setting permissions..." + chmod a+w $FILE + # this is needed for uploads, you can remove it if you don't want to allow uploads + chown $PUID:$PGID /books + echo "Permissions fixed, use /books as library path" +fi +"""