Home

Awesome

fatten

fatten takes shellfire applications and turns them into standalone programs by a process we call fattening. It does this by running the shellfire application in a special mode. It's written using shellfire and fattened by itself: it eats its own dog food.

What's included?

Explicility, the following are included:-

How to use it

For example, image you have the shellfire application 'overdrive'. You have a git repository 'overdrive' (perhaps at GitHub), containing the following structure:-

overdrive\
	.git\
	overdrive           # your shellfire application script
	etc\
		shellfire\
			paths.d\    # git submodule add https://github.com/shellfire-dev/paths.d
				…
		overdrive\
			paths.d\    # your application specifc .paths (if any)
				…
	lib\
		shellfire\
			core\       # git submodule add https://github.com/shellfire-dev/core
			…\          # other submodules, may be https://github.com/shellfire-dev/jsonreader
			overdrive\  # any code for your application broken out into namespaces
output\

You might run the following command from outside of this structure:-

fatten --repository-path ./overdrive --output-path ./output -- overdrive

This will then put a fattened file overdrive in ./output/overdrive.

Command Line

Options

Short OptionLong OptionHas ArgumentDefaultDescription
-v--verboseOptionally0Specify more than once for more verbosity. Use a number between 0 and 3 inclusive to set a specific level. Higher numbers are more verbose.
-q--quiet0Specify (optionally more than once) to reduce verbosity by a step of 1
-r--repository-pathPATHCurrent pathPath to a git repository root PATH containing a PROGRAM
-e--etc-pathPATH/etcPath PATH to embed in PROGRAM for etc
-l--lib-pathPATH/libPath PATH to embed in PROGRAM for lib
-p--var-pathPATH/varPath PATH to embed in PROGRAM for var
-f--forcenoForce fattening even if there are uncommited changes
-o--output-pathPATHCurrent pathPath PATH to folder (created if necessary) for fattened PROGRAM
-i`--ignore-dependenciesnoForce _program_ignoreDependencies to yes if specified

Non-Options

Everything after options (--) is a PROGRAM to fatten in --repository-path and output to --output-path.

" _program_commandLine_helpMessage_examples=" ${_program_name} -r git-repo/bin -- minor-test " }

Configuration

Anything you can do with a command line switch, you can do as configuration. But configuration can also be used with scripts. Indeed, the configuration syntax is simply shell script. Configuration files should not be executable. This means that if you really want to, you can override just about any feature or behaviour of fatten - although that's not explicitly supported. Configuration can be in any number of locations. Configuration may be a single file, or a folder of files; in the latter case, every file in the folder is parsed in 'shell glob-expansion order' (typically ASCII sort order of file names).

To set a key, use normal shell script syntax in a file, eg:-

# $HOME/.fatten/rc

# This sets the value for --etc-path
fatten_etcPath="/usr/local/etc"

Configuration Keys

KeyEquivalent Command Line Long Option
fatten_verbose*--verbose
fatten_languageN/A
fatten_etcPath--etc-path
fatten_libPath--lib-path
fatten_varPath--var-path
fatten_repositoryPath--repository-path
fatten_force--force
fatten_outputPath--output-path

* Set this to an integer number between 0 to 3, eg fatten_verbose=1. 0 is off (the default). † This is used for LC_* variables so things like sort work reliably. Don't change it unless you have to. It defaults to en_US.UTF-8. _‡ This is modelled as boolean. Set fatten_force='yes' to be equivalent to --force. You can still override this on the command line with --force no. _

Configuration Locations

Locations are searched in order as follows:-

  1. Global (Per-machine)
  2. The file INSTALL_PREFIX/etc/fatten/rc where INSTALL_PREFIX is where fatten has been installed.
  3. Any files in the folder INSTALL_PREFIX/etc/fatten/rc.d
  4. Per User, where HOME is your home folder path*
  5. The file HOME/.fatten/rc
  6. Any files in the folder HOME/.fatten/rc.d
  7. Per Environment
  8. The file in the environment variable fatten_RC (if the environment variable is set and the path is readable)
  9. Any files in the folder in the environment variable fatten_RC_D (if the environment variable is set and the path is searchable)

Nothing stops any of these paths, or files in them, being symlinks.

* An installation as a daemon using a service account would normally set HOME to something like /var/lib/fatten.

Blacklisting Configuration Locations

You can also blacklist the loading of configuration from paths defined by environment variables. In a machine-wide configuration file, put the directive core_configuration_blacklist VAR, where VAR is one or more of:-

Exit Codes

fatten tries to follow the BSD exit code conventions. A non-zero exit code is indicative of failure. Typical codes are:-

CodeMeaningCommon Causes
78Configuration issueConfiguration omitted, contradictory or incorrectly specified.
77Permission DeniedRun with setuid / setgid bits set.
76ProtocolNot used
75Temporary FailureNot used
74I/O ErrorNot used
73Can't createWe couldn't create a temporary file or folder
72Missing FileWe tried very hard, but even a fallback dependency was missing
71Not used
70Internal ErrorSomething went wrong with fatten; an assumption was violated
69UnavailableNot used
68Unknown HostNot used
67Unknown UserNot used
66Not used
65Data ErrorNot used
64Incorrect command lineCommand line switches omitted, contradictory or incorrectly specified
2A shell builtin misbehaved
1Something went wrong we didn't expect or couldn't intercept
0Successful operation