starch(1)

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

🌸 starch(1) β€” the standalone application archiver that's literally carrying your whole app on its back πŸ’…

okay bestie, welcome to starch(1) from the Cooperative Computing Tools. pull up a chair, grab a boba, and let's get into it ✨


✨ NAME ✨

starch β€” STandalone application ARCHiver 🫢 (yes the caps are load-bearing, it's giving acronym main character energy)


✨ SYNOPSIS ✨

starch [options] <sfx_path>

✨ DESCRIPTION ✨

So. starch is a script that builds standalone application archives, and it does it in the cutest way possible: it makes self-extracting executables β€” aka SFX β€” like a little gift box that unwraps itself and then just runs 🎁✨

You get to tell it exactly what your app needs: the command, the executables, the libraries, the data, and the environment scripts. You can pass all of that with command line options, or you can be a tidy little icon and put it in a configuration file. Either way, slay.

Why is this lowkey iconic? Because starch is especially useful for distributed computing β€” it makes an executable portable across different operating system variants. So your program can just show up somewhere new and thrive. no cap, that's the whole vibe. πŸ¦‹


✨ OPTIONS ✨

To create an SFX, literally just specify the name of the SFX you want to create, plus the <command> to execute, plus any other dependencies β€” like <executables>, <libraries>, <data>, or <environment> scripts. That's it bestie, you got this πŸ’–

If a <command> is specified but no <executable> is passed, then the first token in the <command> gets used as the executable. Convenient! πŸ’…

By default, starch will use ldd to sniff out any necessary libraries from the set of <executables> you specified, and it'll bundle those into the SFX too. auto-detect era ✨

  • -A β€” Do not automatically detect library dependencies. you're on your own for libs, bestie, but respectfully 🫑
  • -C <cfg> β€” Use a configuration file. (yes, cfg = config, we're all friends here)
  • -c <cmd> β€” Specify the command to execute.
  • -d <npath:opath> β€” Add data, formatted as new path:old path. note the colon, it's the whole personality of this flag πŸŽ€
  • -e <env> β€” Add an environment script.
  • -l <lib> β€” Add a library.
  • -x <exe> β€” Add an executable.
  • -h β€” Show the help message and exit. (the classic "help meee" flag 😭)
  • -v β€” Display verbose messages (default: False). turn it on if you want the tea β˜•
Once a SFX is generated, you can use it as a normal executable. like, fr fr, it's just a program now 🫢

✨ CONFIGURATION FILE ✨

You can store all those command line options in a configuration file and hand it to starch with the starch -C option. The format goes a little something like this:

[starch]
executables = echo date hostname
libraries   = libz.so
data        = hosts.txt:/etc/hosts localtime:/etc/localtime images:/usr/share/pixmaps
command     = echo $(hostname) $(date $@)

look at that alignment. the libraries line even lined up its =. obsessed. ✨


✨ ENVIRONMENT VARIABLES ✨

These environment variables change how the SFX that starch generated actually behaves when you run it. keep them in your back pocket πŸ’œ

🌸 SFX_DIR

Determines the target directory where the SFX will be extracted. By default this is:

/tmp/$hostname.$user.$basename.dir

🌸 SFX_EXTRACT_ONLY

Only extract the SFX. By default it is extracted and executed. so this flag says "just open the box, don't play with the toy" πŸ™ˆ

🌸 SFX_EXTRACT_FORCE

Extract the SFX even if the SFX_DIR exists. This is disabled by default β€” it's an optimization, so we don't waste time extracting stuff that's already there. efficiency queen πŸ‘‘

🌸 SFX_KEEP

Keep extracted files. By default the files will be removed after execution. so without this, everything gets cleaned up like a responsible roommate 🧹

🌸 SFX_UNIQUE

Use mktempd to generate a unique SFX_DIR target directory.

⚠️ Careful bestie β€” this will prevent SFX_KEEP from working properly, since the names will change in between invocations. they simply cannot coexist, it's giving star-crossed πŸ’€

✨ EXIT STATUS ✨

  • On success, returns zero. πŸŽ‰
  • On failure, returns non-zero. 😭

✨ EXAMPLES ✨

Package the date program:

$ starch -c date -x date date.sfx

Package the date program using a configuration file:

$ cat data.cfg
[starch]
executables = date
command = date
$ starch -C date.cfg date.sfx

Run standalone date program with parameters:

$ ./date.sfx +%s

Only extract the archive:

$ env SFX_EXTRACT_ONLY=1 ./date.sfx

Run and keep extracted directory:

$ env SFX_KEEP=1 ./date.sfx

Run with unique directory:

$ env SFX_UNIQUE=1 ./date.sfx

Advanced example involving a complex shell command:

$ starch -v -x tar -x rm  -c 'tar_test() { for f in $@; do if ! tar xvf $f; then exit 1; fi; done; rm $@'; }; tar_test' extract_and_remove.sfx
$ ./extract_and_remove.sfx *.tar.gz

okay that last one is iconic. it builds an SFX that untars a bunch of .tar.gz files and then removes them. ate and left no crumbs πŸ”₯


The Cooperative Computing Tools are Copyright (C) 2005-2019 The University of Notre Dame. This software is distributed under the GNU General Public License. See the file COPYING for details.


✨ SEE ALSO ✨


and that's the whole page, bestie 🫢 this was CCTools 8.0.0 DEVELOPMENT, dated with the starch(1) manual. go forth and archive something standalone. you're gonna do amazing. mwah πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from