feat: try rework

This commit is contained in:
Katharina Heidenreich 2026-04-04 11:42:19 +02:00
parent 1ddbd3b8b6
commit ecf10628c3
51 changed files with 1941 additions and 445 deletions

View file

@ -1,9 +1,14 @@
{ config, pkgs, lib, ... }:
let
service_data = import ../data/services.nix;
kiwix = service_data.kiwix;
serviceValidation = import ../validation/service/kiwix.nix;
service_data = import ../config/services.nix;
kiwix = serviceValidation.getKiwix service_data;
rootDir = kiwix.root_dir;
zimUrls = kiwix.urls;
updater = pkgs.writeShellScriptBin "kiwix-updater" ''
set -e
@ -14,13 +19,13 @@ let
download() {
local url=''$1
local filename=''$(basename "''$url")
local filepath="${kiwix.root_dir}"/''$filename
local filepath="${rootDir}"/''$filename
if [ -f "''$filepath" ]; then
echo "''$filepath exists!"
return 0
fi
cd ${kiwix.root_dir}
cd ${rootDir}
${pkgs.wget}/bin/wget --continue --quiet "''$url" -O "''$filename.tmp"
mv ''$filename.tmp ''$filename
}
@ -29,7 +34,7 @@ let
{
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<library>'
for zim in "${kiwix.root_dir}"/*.zim; do
for zim in "${rootDir}"/*.zim; do
if [ -f "''$zim" ]; then
filename=''$(basename "''$zim")
size=''$(stat -c%s "''$zim")
@ -58,8 +63,8 @@ EOF
fi
done
echo '</library>'
} > "${kiwix.root_dir}/library.xml.tmp"
mv "${kiwix.root_dir}/library.xml.tmp" "${kiwix.root_dir}/library.xml"
} > "${rootDir}/library.xml.tmp"
mv "${rootDir}/library.xml.tmp" "${rootDir}/library.xml"
}
for url in "''${URLS[@]}"; do