HomeFreeBSD

Cleanup ZEDLETs

Description

Cleanup ZEDLETs

This commit factors out several common ZEDLET code blocks into
zed-functions.sh. This shortens the length of the scripts, thereby
(hopefully) making them easier to understand and maintain.

In addition, this commit revamps the coding style used by the
scripts to be more consistent and (again, hopefully) maintainable.
It now mostly follows the Google Shell Style Guide. I've tried to
assimilate the following resources:

Google Shell Style Guide
https://google-styleguide.googlecode.com/svn/trunk/shell.xml

Dash as /bin/sh
https://wiki.ubuntu.com/DashAsBinSh

Filenames and Pathnames in Shell: How to do it Correctly
http://www.dwheeler.com/essays/filenames-in-shell.html

Common shell script mistakes
http://www.pixelbeat.org/programming/shell_script_mistakes.html

Finally, this commit updates the exit codes used by the ZEDLETs to be
more consistent with one another.

All scripts run cleanly through ShellCheck http://www.shellcheck.net/.
All scripts have been tested on bash and dash.

Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>

Details

Provenance
Chris Dunlap <cdunlap@llnl.gov>Authored on Feb 18 2015, 1:23 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Apr 27 2015, 7:08 PM
Parents
rG0336f3d001c7: Remove useless variable spa_active_count
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGaded9a6814c9: Cleanup ZEDLETs (authored by Chris Dunlap <cdunlap@llnl.gov>).Apr 27 2015, 7:08 PM