Fixed. Ash/Dash don't support ERR traps, so I instead did this:
set +e
output=$(getopt -o '' -l $options -- "$@")
errout=$(getopt -o '' -l $options -- "$@" 2>&1 >/dev/null)
set -e
if [[ -n "$errout" ]]; then
warn_getopt $type
warn "$type Error: $errout"
fi
This results in much better logging during install, without stopping
output to console. For example:
$ cat /var/log/syslog | grep kickseed
> ... snip ... <
Jun 19 01:56:26 kickseed: Failed to parse %pre options
Jun 19 01:56:26 kickseed: %pre Error: getopt: unrecognized option
'--log=/test.log'
I've also integrated this with test-kickseed, which outputs this:
$ ./test-kickseed custom-test.ks
getopt: unrecognized option '--log=/test.log'
LOG: Failed to parse some %pre options
LOG: %pre Error: getopt: unrecognized option '--log=/test.log'
As you can see, getopt still prints to stderr, but now we have log
messages printed as well.
** Changed in: kickseed (Ubuntu)
Status: New => Fix Committed
** Changed in: kickseed (Ubuntu)
Assignee: (unassigned) => Hamilton Turner (hamiltont-x)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1331814
Title:
Warning messages for handlers are never called
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/kickseed/+bug/1331814/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs