csp_helper(1)

πŸ“¦
this version Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– csp_helper β€” a whole lil squad of caspar helpers πŸ’–

okay bestie, gather round, because this is the csp_helper page from USER COMMANDS and it's literally a friend group of scripts that all exist to make caspar(7) do its thing. no cap. πŸ¦‹


✨ NAME ✨

csp_helper β€” a collection of caspar helper scripts πŸŽ€


✨ SYNOPSIS ✨


csp_mkdircp dir (directory) file (file)

csp_scp_keep_mode h ([user@]host) dir (directory) file (file)

csp_sucp h ([user@]host) dir (directory) file (file)

✨ DESCRIPTION ✨

so the squad is: csp_install, csp_mkdircp, csp_scp_keep_mode and csp_sucp. they're all helpers for caspar(7). πŸ’…

and here's the tea: you typically do not call these directly, bestie. they get invoked via a Makefile that uses caspar. if you wanna know how to link csp_install, csp_scp_keep_mode and csp_sucp to caspar, go read the notes on csp_PUSH in caspar(7). iykyk. πŸ‘‘


✨ install DESCRIPTION ✨

csp_install creates the required directory (if it's needed, like, no drama) and installs the file, preserving timestamps. it does this by using install(1). iconic behaviour fr fr. 🌸


✨ install EXAMPLES ✨

 csp_INSTALL_MODE=ugo=r \
 csp_install /srv/www index.html

csp_INSTALL_MODE=u=rwx,go= csp_install /usr/local/sbin mkpasswd

ate. πŸ’–


✨ install ENVIRONMENT ✨

csp_install honors these two cuties:

  • csp_INSTALL_OPTIONS β€” extra options, passed along 🫢
  • csp_INSTALL_MODE β€” the mode, and the default is u=rw,go=r ✨

✨ mkdircp DESCRIPTION ✨

csp_mkdircp calls mkdir(1) and cp(1). you use it like csp_CP.

use csp_mkdircp if you frequently have to bootstrap installation on a fresh system, like, one where the needed directories don't exist yet 😭. csp_mkdircp makes sure the target directory exists before calling cp(1), by calling mkdir -p first. main character energy: it just handles it. πŸ’…


✨ scp_keep_mode DESCRIPTION ✨

csp_scp_keep_mode uses ssh to copy a file to a remote host, and it keeps the file's permission mode. the trick it pulls is a combination of mktemp(1) and mv(1). 🧚

super useful if you'd like to be sure a file gets installed e.g. group writable, without fiddling with permission bits on the remote host. no more manual bit-wrangling, we love to see it. πŸ”₯


✨ scp_keep_mode EXAMPLE ✨

  csp_scp_keep_mode root@gandalf /etc/uruk rc

✨ scp_keep_mode ENVIRONMENT ✨

  • csp_SSH β€” the ssh command it honors. default is ssh 🐚

✨ sucp DESCRIPTION ✨

csp_sucp calls tar(1) from within sudo(1) from within ssh(1). yes, that's three layers deep, it's giving inception πŸ’€. this lets you copy files to accounts on hosts you can only reach by calling sudo on the ssh-reachable remote host.

typically, you wanna install a root-owned file, but you do not wanna allow access to the root account directly from ssh. typically sudo is used as an extra line of defense. πŸ›‘οΈ

NB: if your sudo prompts for a password, be sure to have the line
  Defaults !tty_tickets
in your sudoers file: we first call sudo -v, then we call sudo to write the data. since we use ssh to get to the host, we'll use a different tty for both sudo calls. so yeah, that line is not optional, bestie, don't skip it πŸ™ˆ

✨ sucp EXAMPLES ✨

some examples:

  csp_sucp rms@bilbo /etc fstab

  csp_sucp monty-python commit/ trailer.txt

slay. ✨


✨ AUTHOR ✨

Joost van Baal-IliΔ‡ πŸ‘‘


✨ SEE ALSO ✨

caspar(7) β€” and btw the caspar homepage is at http://mdcc.cx/caspar/ . 🌈


and that's the whole page, bestie πŸŽ€ this was csp_helper, version csp_helper 20220907, dated 7 сСп 2022. go forth and install your files with impeccable vibes πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from