On Sat, Feb 16, 2008 at 02:13:51PM +0100, Michael Biebl wrote: > 2008/2/16, Michael Biebl <[EMAIL PROTECTED]>: > > 2008/2/16, Victor Lowther <[EMAIL PROTECTED]>: > > > On Fri, Feb 15, 2008 at 09:07:19AM +0100, Michael Biebl wrote: > > > > 2008/2/15, Victor Lowther <[EMAIL PROTECTED]>: > > > > > > > > > > > > > > -[ -f /proc/acpi/ibm/led ] || exit 1 > > > > > > > > I like explicitly returning 1, because you immediately see, that we > > > > return 1 in case we don't find the required resource. (This comment is > > > > true for #13, #11, #9, #7, #6) > > > > > > > > > +[ -f /proc/acpi/ibm/led ] || exit > > > > > > > > This is imho harder to read and understand. So I vote against removing > > > > the explicit "exit 1". > > > > > > If we are checking for the exit status codes in the script, then this > > > should actually be an explicit exit 0. > > > > > > The reason for that is that these scripts run on all systems, > > > but if a system does not need the script's functionality, then it is not > > > a failure, it is just the script recognizing that fact and exiting. > > > > What about a different return code then. So you have: > > succeeded (0), failed (1), skipped (2). > > The hooks could then look like this: > > check_prerequisites || exit 2 > > case "$1" in > hibernate|suspend) > do_stuff || exit 1 > ;; > thaw|resume) > do_stuff || exit 1 > ;; > *) > exit 2 > ;; > esac > > exit 0
Reserving an exit code for "not applicable" or "skipped" woud be fine, but all those "|| exit 1" and the final "exit 0" are redundant. > What do you think? > > Michael > > -- > Why is it that all of the instruments seeking intelligent life in the > universe are pointed away from Earth? -- Victor Lowther Ubuntu Certified Professional _______________________________________________ Pm-utils mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pm-utils
