* switch from phase functions to variables containing list of actions
* init actions prefixed with 'init__'
* refine output during init
* add syslog entries
* add --setup for putting init scripts in the right runlevel
yash[1] and zsh does not handle 8-bit bytes in strings good. Work around it
by using printf ... | cmp ... to compare the header. This should be 100%
posix compatible.
Also fix some of the compression header magic bytes:
- unxz: Use octal aas the string '\3757zXZ\000' was misinterpreted by some
shells.
- lzma: the third byte represents compression mode[2], and we want
support all compression modes not only '8', so we only check the first
three bytes instead of 4.
[1]: Upstream report: https://osdn.net/projects/yash/ticket/47772
[2]: https://github.com/frizb/FirmwareReverseEngineering/blob/master/IdentifyingCompressionAlgorithms.md#lzma
* all IPv4s of non-eth0 interfaces should be associated with route table
* also add "to" rules for non-eth0 interfaces (symmetry with the "from" rules)
Different shells has slightly different output of `type`:
$ yash -c "f(){ :; }; type f"
f: a function
$ dash -c "f(){ :; }; type f"
f is a shell function
$ zsh -c "f(){ :; }; type f"
f is a shell function from zsh
Lets only look for the word "function" which seems to be the only common
thing.
Simplify it a bit.
- use awk /proc/mounts instead of busybox mountpoint
- use sysfs to find partition and volume. This is more robust
- add tests for it
* save `user-data` during main `tiny-cloud` init script instead of `tiny-cloud-final`
* allow manual setting of bootstrap state with...
* `service tiny-cloud complete`
* `service tiny-cloud incomplete`
* use `${VAR:=default}` idiom instead of `VAR=${VAR:-default}`
* fix inconsequential typo in `imds-net-sync`
The Amazon marketplace image verifier expects the root account to be
locked, not just cleared. Otherwise images that use the bootstrap can't
be pushed to the AWS marketplace.