move calibre perms out of activations

This commit is contained in:
Noah Masur 2022-10-08 15:57:52 +00:00
parent bfa9e8fc4e
commit 5872abcc33

View File

@ -48,18 +48,20 @@ in {
}];
# Create directory and set permissions
system.activationScripts.calibreLibrary.text = ''
if [ ! -d "${libraryPath}" ]; then
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG ${libraryPath}
fi
if [ ! "$(stat -c "%G" ${libraryPath})" = "calibre-web" ]; then
$DRY_RUN_CMD chown $VERBOSE_ARG -R calibre-web:calibre-web ${libraryPath}
fi
if [ ! "$(stat -c "%a" ${libraryPath})" = "775" ]; then
$DRY_RUN_CMD chmod $VERBOSE_ARG 0775 ${libraryPath}
$DRY_RUN_CMD chmod $VERBOSE_ARG -R 0640 ${libraryPath}/*
fi
systemd.services.calibre-library = {
requiredBy = [ "calibre-web.service" ];
before = [ "calibre-web.service" ];
serviceConfig = {
Type = "oneshot";
User = "root";
};
script = ''
mkdir --parents ${libraryPath}
chown -R calibre-web:calibre-web ${libraryPath}
chmod 0775 ${libraryPath}
chmod -R 0640 ${libraryPath}/*
'';
};
};