SHTOOL-INSTALL.TMP(1)

πŸ“¦
version 2.0.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– SHTOOL-INSTALL.TMP β€” the manual, but make it cute πŸ’–

okay bestie, gather round, because this is the shtool-install page from the GNU Portable Shell Tool and honestly? it ate. it's the install(1) command, but portable, and we're gonna go through it together, no skips, no skimming. 🫢


✨ NAME ✨

shtool-install β€” the GNU shtool install(1) command, but make it portable πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

shtool install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]
[-C|--compare-copy] [-s|--strip] [-m|--mode mode] [-o|--owner owner]
[-g|--group group] [-e|--exec sed-cmd] file [file ...]  path

like yes, that's a lot of flags. you'll be fine. breathe. 🌸


πŸ‘‘ DESCRIPTION πŸ‘‘

so the whole gig: this command installs one or more files to a given target path, and it gives you all the important options of the BSD install(1) command. the trick β€” the actual main character move β€” is that all this functionality is provided in a portable way. no cap. ✨


πŸŽ€ OPTIONS πŸŽ€

these are the command line options you get, and yes we're doing all of them:

  • -v, --verbose β€” shows you some processing information. like it's narrating its own little journey. πŸ—£οΈ
  • -t, --trace β€” turns on output of the essential shell commands that get executed. basically it tells you what it's doing under the hood, which is lowkey iconic.
  • -d, --mkdir β€” for maximum BSD compatibility, the BSD shtool install -d usage is internally mapped to the shtool mkdir -f -p -m 755 command. yes bestie, it's a secret identity situation. πŸ•΅οΈ
  • -c, --copy β€” copies the file to the target path. the default is to move, so this is you choosing copy instead. πŸ’«
  • -C, --compare-copy β€” same as -c, except if the destination file already exists and is identical to the source file, no installation happens at all and the target stays untouched. it's giving "not me doing work for no reason." πŸ™ˆ
  • -s, --strip β€” this one strips program executables during the installation, see strip(1). default is to install verbatim, so no stripping unless you ask.
  • -m, --mode mode β€” the file mode applied to the target, see chmod(1). setting mode to - skips this step and leaves the operating system default, which is usually based on umask(1). heads up: some file modes require superuser privileges to be set. default is 0755. πŸ”
  • -o, --owner owner β€” the file owner name or id applied to the target, see chown(1). ⚠️ this option requires superuser privileges to execute. default is to skip this step and leave the operating system default, which is usually based on the executing uid or the parent setuid directory.
  • -g, --group group β€” the file group name or id applied to the target, see chgrp(1). this option requires superuser privileges to execute to the fullest extend β€” otherwise, on most operating systems, your choice of group is limited. default is to skip this step and leave the operating system default, which is usually based on the executing gid or the parent setgid directory. πŸ«‚
  • -e, --exec sed-cmd β€” you can use this one once or multiple times to apply one or more sed(1) commands to the file contents during installation. obsessed. πŸ’–

🌈 EXAMPLE 🌈

here's the vibe in a real Makefile, bestie:

 #   Makefile
 install:
      :
     shtool install -c -s -m 4755 foo $(bindir)/
     shtool install -c -m 644 foo.man $(mandir)/man1/foo.1
     shtool install -c -m 644 -e "s/@p@/$prefix/g" foo.conf $(etcdir)/

see how the -e one is swapping @p@ for $prefix? slay. ✨


🧚 HISTORY 🧚

the GNU shtool install command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1997 for GNU shtool. it was prompted by portability issues in the installation procedures of OSSP libraries. a true origin story. πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ

shtool(1), umask(1), chmod(1), chown(1), chgrp(1), strip(1), sed(1).

go read them, iykyk. πŸ¦‹


and that's the whole page, bestie! this one's from shtool 2.0.8, dated 18-Jul-2008 β€” an absolute vintage icon, still serving GNU Portable Shell Tool realness. πŸ’…βœ¨πŸŽ€
πŸ“¦ where this page comes from