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