csp_helper(1)

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

πŸ’– NAME πŸ’–

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


✨ SYNOPSIS ✨

csp_install dir (directory) file (file)

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 🌸

okay so listen bestie: the scripts csp_install, csp_mkdircp, csp_scp_keep_mode and csp_sucp are helpers for caspar(7). that's the whole vibe. πŸ’…

and like, here's the tea β€” these scripts are typically not invoked directly. they get called via a Makefile that uses caspar. so if you're out here wondering how they even get wired up: see the notes on csp_PUSH in caspar(7) for info on how to link csp_install, csp_scp_keep_mode and csp_sucp to caspar. iykyk 🫢


🧚 install DESCRIPTION 🧚

csp_install creates the required directory (if needed) and installs the file, preserving timestamps. it does this by using install(1). slay, no notes. ✨

πŸ”₯ install EXAMPLES πŸ”₯

 csp_INSTALL_OPTIONS='--owner=www-data --group=www-data' \
  csp_INSTALL_MODE=ugo=r \
  csp_install /srv/www index.html

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

πŸ’œ install ENVIRONMENT πŸ’œ

csp_install honors csp_INSTALL_OPTIONS and csp_INSTALL_MODE (the default is u=rw,go=r). that default is giving sensible, fr fr. πŸŽ€


πŸ¦‹ mkdircp DESCRIPTION πŸ¦‹

csp_mkdircp calls mkdir(1) and cp(1). it's used like csp_CP.

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


🌈 scp_keep_mode DESCRIPTION 🌈

csp_scp_keep_mode uses ssh to copy a file to a remote host, keeping its file permission mode. the trick used is a combination of mktemp(1) and mv(1). lowkey genius.

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 cap, that's the whole point. πŸ’…

πŸ“ scp_keep_mode EXAMPLE πŸ“

  chmod g+w rc
  csp_scp_keep_mode root@gandalf /etc/uruk rc

🌟 scp_keep_mode ENVIRONMENT 🌟

csp_scp_keep_mode honors csp_SSH ("ssh" by default). obsessed with a good default tbh. ✨


πŸ’€ sucp DESCRIPTION πŸ’€

csp_sucp calls tar(1) from within sudo(1) from within ssh(1). yes, it's nesting. it's giving inception. 😭

this allows one to copy files to accounts on hosts one can only reach by calling sudo on the ssh-reachable remote host.

typically, one wants to install a root-owned file, but one does not want to allow access to the root-account directly from ssh. typically sudo is used as an extra line of defense. very demure, very mindful. 🫢

NB: if your sudo prompts for a password, be sure to have line
  Defaults !tty_tickets
in your sudoers file: we first call sudo -v, than 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, don't skip this one bestie, or it's not gonna go how you want. πŸ’€

🌈 sucp EXAMPLES 🌈

some examples:

  csp_sucp rms@bilbo /etc fstab

  csp_sucp monty-python commit/ trailer.txt

πŸ‘‘ AUTHOR πŸ‘‘

Joost van Baal-Ilić


πŸ’– SEE ALSO πŸ’–

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


and that's a wrap bestie!! πŸŽ€ this was csp_helper 20220907, dated 7 сСп 2022 β€” yes the date is literally in september-cyrillic and we love that for it. go forth and install things, you got this. πŸ¦‹βœ¨πŸ’œ

πŸ“¦ where this page comes from