Author: branden Date: 2003-09-10 16:56:11 -0500 (Wed, 10 Sep 2003) New Revision: 505
Modified: trunk/debian/changelog trunk/debian/shell-lib.sh Log: debian/shell-lib.sh: more enhancements - debugmsg(): new function to support debugging messages in the maintainer scripts - safe_debconf(): new function to run debconf confmodule commands defensively (but which we expect to succeed nevertheless) - internal_errormsg(), usage_errormsg(): fix syntax and cosmetic errors Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2003-09-10 20:48:13 UTC (rev 504) +++ trunk/debian/changelog 2003-09-10 21:56:11 UTC (rev 505) @@ -60,6 +60,10 @@ remove_conffile_rollback(): new functions to handle the obsoletion of conffiles across upgrades; remove_conffile_prepare() can handle both old dpkg (pre-1.10) and new md5sum command behavior (Closes: #152920) + - debugmsg(): new function to support debugging messages in the maintainer + scripts + - safe_debconf(): new function to run debconf confmodule commands + defensively (but which we expect to succeed nevertheless) * debian/local/Xstartup: a bit of cleanup; - quote all shell variables @@ -104,7 +108,7 @@ + patch #000_stolen_from_HEAD: in with the new + patch #095: out with the old (deleted) - -- Branden Robinson <[EMAIL PROTECTED]> Wed, 10 Sep 2003 15:45:09 -0500 + -- Branden Robinson <[EMAIL PROTECTED]> Wed, 10 Sep 2003 16:53:26 -0500 xfree86 (4.2.1-11) unstable; urgency=medium Modified: trunk/debian/shell-lib.sh =================================================================== --- trunk/debian/shell-lib.sh 2003-09-10 20:48:13 UTC (rev 504) +++ trunk/debian/shell-lib.sh 2003-09-10 21:56:11 UTC (rev 505) @@ -51,13 +51,22 @@ echo -n "$*" | fold -s -w ${COLUMNS:-80} >&2; } +debugmsg () { + # syntax: debug_echo message ... + # + # issue debugging message + if [ -n "$DEBUG_XFREE86_PACKAGE" ]; then + message "$THIS_PACKAGE $THIS_SCRIPT debug: $*" + fi +} + errormsg () { # exit script with error message "$THIS_PACKAGE $THIS_SCRIPT error: $*" exit $SHELL_LIB_THROWN_ERROR } -internal_errormsg() { +internal_errormsg () { # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message message "$*" if [ -n "$OFFICIAL_BUILD" ]; then @@ -67,14 +76,14 @@ "$THIS_PACKAGE package. Visit " \ "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \ "instructions, read the file" \ - "/usr/share/doc/debian/bug-reporting.txt (from the doc-debian" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ "package, or install the reportbug package and use the command of" \ - "the same name to file a report." \ + "the same name to file a report." fi exit $SHELL_LIB_INTERNAL_ERROR } -usage_errormsg() { +usage_errormsg () { message "$*" message "Please report a bug in the $THIS_SCRIPT script of the" \ "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ @@ -82,9 +91,9 @@ "$THIS_PACKAGE package. Visit " \ "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \ "instructions, read the file" \ - "/usr/share/doc/debian/bug-reporting.txt (from the doc-debian" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ "package, or install the reportbug package and use the command of" \ - "the same name to file a report." \ + "the same name to file a report." exit $SHELL_LIB_USAGE_ERROR } @@ -375,3 +384,25 @@ mv "$conffile.$THIS_PACKAGE-tmp" "$conffile" fi } + +safe_debconf () { + # syntax: safe_debconf debconf_command debconf_argument ... + # + # Run specified debconf command with specified arguments, guarding ourselves + # against abnormal exits. + + local retval + + # validate arguments + if [ $# -lt 2 ]; then + usage_errormsg "safe_debconf() called with wrong number of arguments;" \ + "expected at least 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + "$@" || retval=$? + + if [ ${retval:-0} -ne 0 ]; then + debugmsg "command \"$*\" exited with status $retval" + fi +} -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]