aboutsummaryrefslogtreecommitdiff
path: root/src/property/file.lisp
Commit message (Collapse)AuthorAge
* FILE:CONTAINS-INI-SETTINGS: fix inserting section's remaining keysSean Whitton2022-06-27
| | | | | | | | | | | When we insert the section's remaining keys they should appear before any blank lines, comments etc. that appear between sections. This undoes a change in generated output inadvertently introduced by 1a19be7ea65fbfa0b192b2bf18a735f230f16675, and also simplifies the code by eliminating redundant regexp matching: that's the job of CONFIG-FILE-MAP. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-INI-SETTINGS: fix extracting section namesSean Whitton2022-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* rename READFILE, WRITEFILE, corresponding generics and some wrappersSean Whitton2022-04-02
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* src/property/file.lisp: update copyright yearsSean Whitton2022-04-02
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HAS-CONTENT: accept NIL content & check type of list elementsSean Whitton2022-04-01
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace ESCAPE-SH-TOKEN and ESCAPE-SH-COMMAND with new SH-ESCAPESean Whitton2022-03-11
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add "local" and "remote" to the names of some exported symbolsSean Whitton2022-03-09
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* src/property/file.lisp: unless mode supplied, create missing dirsSean Whitton2021-12-27
| | | | | | | | | | | | | | | | | This means you can apply properties like FILE:HAS-CONTENT without also having to explicitly apply FILE:{CONTAINING-,}DIRECTORY-EXISTS or similar. If missing intermediate directories need to have particular modes or ownership, it is easy to apply properties to ensure those directories exist with those attributes before applying the property which will create the file. Then there are no missing directories for the latter property to create. In the case where a mode for the file is supplied, leave it to the caller to create the directories, as a safety measure (see 487a473390). In the future we might create missing intermediate directories based on a supplied mode, such as creating them 0750 when the supplied mode is 0640. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:{HOST-,}SECRET-UPLOADED: don't create missing intermediate dirsSean Whitton2021-12-27
| | | | | | | | As we are uploading secrets, perhaps some of those directories need to be created with permissions other than 0755, so as a safety measure, leave it to the caller to create them. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:{DATA,SECRET}-UPLOADED: add descriptionsSean Whitton2021-11-11
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* replace some functions with a new :CONSFIGURATOR-CACHE connattrSean Whitton2021-10-23
| | | | | | This simplifies the API. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:LACKS-LINES-MATCHINGSean Whitton2021-09-12
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HOST-DATA-UPLOADED: use DEFPROPLISTSean Whitton2021-07-15
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:UPDATE-UNIX-TABLE: replace sorting algorithm and refactorSean Whitton2021-07-12
| | | | | | | | | For /etc/fstab, new code should continue to handle ordinary block device mounts and swap files correctly, and also some cases the old code got wrong: when the SOURCEth and TARGETth fields are both paths, but the SOURCEth field is under a filesystem which is the TARGETth field of another line. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:UPDATE-UNIX-TABLE end sort: handle comments and blank linesSean Whitton2021-07-10
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:UPDATE-UNIX-TABLE: add sorting of lines at endSean Whitton2021-07-10
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:DATA-CACHE-PURGED: fix looking up the cache locationSean Whitton2021-07-10
| | | | | | Previously we were looking it up at :HOSTATTRS time, which failed. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:EXISTS-WITH-CONTENT: add :DESC subroutineSean Whitton2021-07-10
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* error if pass relative paths to FILE:HOST-{DATA,SECRET}-UPLOADEDSean Whitton2021-06-23
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-INI-SETTINGS: avoid blank line at start of fileSean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-CONF-{EQUALS,SHELL}: fix for values containing '='Sean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:EXISTS-WITH-CONTENT: add Emacs indentation hintSean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE::REMOTE-LINK-TARGET: expand commentSean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE::REMOTE-LINK-TARGET: skip over repeated spaces in separatorsSean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-CONF-EQUALS: improve :PARSE-KV regexpSean Whitton2021-06-18
| | | | | | | Make whitespace either side of equals sign optional, and accept empty values. This is needed to use this property to manage Postfix's main.cf file. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HOST-SECRET-UPLOADED: use DEFPROPLISTSean Whitton2021-06-18
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:EXISTS-WITH-CONTENTSean Whitton2021-06-17
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-LINES: add an INDENT declarationSean Whitton2021-06-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:DIRECTORY-DOES-NOT-EXIST: simplify not deleting non-dirsSean Whitton2021-06-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:HAS-OWNERSHIPSean Whitton2021-06-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:DIRECTORY-DOES-NOT-EXIST, FILE:DATA-CACHE-PURGEDSean Whitton2021-06-07
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* ls(1) parse: set LC_ALL not just LOCALE, and split fields properlySean Whitton2021-06-07
| | | | | | | Previously our code assumed fields were separated with exactly one space, but sometimes there is padding. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add & use WORDS, UNWORDSSean Whitton2021-05-31
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HOST-SECRET-UPLOADED: avoid using a pathname as IDEN2Sean Whitton2021-05-31
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:UPDATE-UNIX-TABLE: update lines whenever there's a matchSean Whitton2021-05-31
| | | | | | | | Bug fix. Previously, we were updating only in the special case of taking the source from the existing line, and otherwise just appending another copy of the entry. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:CONTAINS-CONF-TABSean Whitton2021-05-25
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-CONF-SPACE: add some quotation marksSean Whitton2021-05-25
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-CONF-SPACE: accept any whitespace after the keySean Whitton2021-05-24
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:{DATA,SECRET}-UPLOADED: use CONTAINING-DIRECTORY-EXISTSSean Whitton2021-05-20
| | | | | | This handles the case of a relative path to a file right inside HOME. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:DATA-UPLOADED, FILE:SECRET-UPLOADED: use MAYBE-WRITEFILE-DATASean Whitton2021-05-20
| | | | | | This avoids writing the file every deploy, even when unchanged. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:CONTAINING-DIRECTORY-EXISTSSean Whitton2021-05-20
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* factor out MAYBE-WRITEFILE-STRINGSean Whitton2021-05-20
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:CONTAINS-LINES: avoid writing file if lines already presentSean Whitton2021-05-19
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:DATA-UPLOADED, FILE:SECRET-UPLOADED: ensure directory existsSean Whitton2021-05-14
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HAS-CONTENT: avoid writing the file if content unchangedSean Whitton2021-05-06
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* factor out FILE:UPDATE-UNIX-TABLESean Whitton2021-05-06
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:IS-COPY-OFSean Whitton2021-04-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:HAS-CONTENT: don't return :NO-CHANGE if file mode was changedSean Whitton2021-04-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* FILE:DIRECTORY-EXISTS: ensure can accept pathnamesSean Whitton2021-04-08
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* add FILE:SYMLINKEDSean Whitton2021-04-07
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>