run_parts.ts

The file-name rule of run-parts-style directories, for recipes that place a file in one: certbot's deploy-hook directory and BusyBox crond's daily-jobs directory.

A pure function, like the recipes that import it: it only checks a string.

view source

Declarations
#

2 declarations

RunPartsFile
#

run_parts.ts view source

RunPartsFile import type {RunPartsFile} from '@fuzdev/zap/run_parts.js';

The spreadable file fields of an executable placed in a run-parts-style directory — a certbot deploy hook, a BusyBox crond daily job — ready to spread into a zap.file({...}).

path

type string

mode

type string

content

type { type: "inline"; content: string; }

validate_run_parts_name
#

run_parts.ts view source

(name: string, recipe: string): void import {validate_run_parts_name} from '@fuzdev/zap/run_parts.js';

Throw unless name is a file name a run-parts-style runner runs: letters, digits, _ and - only. BusyBox run-parts (and Debian's, by default) skips any other name, so a .sh job would never run, and a / would leave the directory. The one check for the hook and job file names the recipes place in such a directory.

name

the file name

type string

recipe

the recipe asking, named in the error

type string

returns

void

throws

  • when - `name` holds any other character, or is empty

Imported by
#