The /run is usually a tmpfs which is automatically removed on reboot.
Use this for the temp mount dir so we don't leave any /mnt/cidata-* temp
leftovers.
Also explicitly create the parent directory of the temp dir, which may
no exist. This solved a weird case where running tests locally ended up
hanging in mount.
* 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
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`