Author: branden Date: 2003-06-05 08:06:37 -0500 (Thu, 05 Jun 2003) New Revision: 142
Modified: trunk/debian/local/Xsession trunk/debian/local/Xsession.d/20xfree86-common_process-args trunk/debian/local/Xsession.d/50xfree86-common_determine-startup Log: Stylistic updates to user interaction. * Xsession: - always report the name of the script in messages to the user - remove trailing semicolons from shell functions - lay some foundation for the xmessage enhancement by having internal_errormsg() call message() only once * Xsession,Xsession.d/{20xfree86-common_process-args, 50xfree86-common_determine-startup}: cosmetic tweaks to error messages Modified: trunk/debian/local/Xsession.d/20xfree86-common_process-args ============================================================================== --- trunk/debian/local/Xsession.d/20xfree86-common_process-args 2003-06-05 11:29:51 UTC (rev 141) +++ trunk/debian/local/Xsession.d/20xfree86-common_process-args 2003-06-05 13:06:37 UTC (rev 142) @@ -10,13 +10,13 @@ exec x-terminal-emulator -geometry +1+1 else # fatal error - errormsg "Xsession: unable to launch failsafe X session;" \ - "x-terminal-emulator not executable. Aborting." + errormsg "unable to launch failsafe X session ---" \ + "x-terminal-emulator not executable; aborting." fi else # fatal error - errormsg "Xsession: unable to launch failsafe X session;" \ - "x-terminal-emulator not found. Aborting." + errormsg "unable to launch failsafe X session ---" \ + "x-terminal-emulator not found; aborting." fi fi ;; @@ -28,18 +28,18 @@ if [ -x "$PROGRAM" ]; then STARTUP=$PROGRAM else - message "Xsession: unable to launch $1 X session; $1 not" \ - "executable. Falling back to default session." + message "unable to launch \"$1\" X session ---" \ + "\"$1\" not executable; falling back to default session." fi else - message "Xsession: unable to launch $1 X session; $1 not found." \ - "Falling back to default session." + message "unable to launch \"$1\" X session ---" \ + "\"$1\" not found; falling back to default session." fi ;; esac ;; *) - message "Xsession: unsupported number of arguments ($#). Falling back" \ - "to default session." + message "unsupported number of arguments ($#); falling back to default" \ + "session." ;; esac Modified: trunk/debian/local/Xsession.d/50xfree86-common_determine-startup ============================================================================== --- trunk/debian/local/Xsession.d/50xfree86-common_determine-startup 2003-06-05 11:29:51 UTC (rev 141) +++ trunk/debian/local/Xsession.d/50xfree86-common_determine-startup 2003-06-05 13:06:37 UTC (rev 142) @@ -25,10 +25,10 @@ if [ -z "$REALSTARTUP" ]; then # fatal error - ERRMSG="Xsession: unable to start X session; " + ERRMSG="unable to start X session ---" if grep -qs ^allow-user-xsession "$OPTIONFILE"; then - ERRMSG="$ERRMSG no $STARTUP file, no $ALTSTARTUP file," + ERRMSG="$ERRMSG no \"$STARTUP\" file, no \"$ALTSTARTUP\" file," fi errormsg "$ERRMSG no session managers, no window managers, and no terminal" \ - "emulators found. Aborting." + "emulators found; aborting." fi Modified: trunk/debian/local/Xsession ============================================================================== --- trunk/debian/local/Xsession 2003-06-05 11:29:51 UTC (rev 141) +++ trunk/debian/local/Xsession 2003-06-05 13:06:37 UTC (rev 142) @@ -6,37 +6,46 @@ set -e +PROGNAME=Xsession + message () { # pretty-print messages of arbitrary length - echo "$*" | fold -s -w ${COLUMNS:-80} >&2; + # is available and $DISPLAY is set + MESSAGE="$PROGNAME: $*" + echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 } message_nonl () { # pretty-print messages of arbitrary length (no trailing newline) - echo -n "$*" | fold -s -w ${COLUMNS:-80} >&2; + MESSAGE="$PROGNAME: $*" + echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 } errormsg () { # exit script with error message "$*" - exit 1; + exit 1 } internal_errormsg () { # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message - message "$*" - message "Please report the package name, version, and the text of the" \ - "above error message(s) to <debian-x@lists.debian.org>."; - exit 1; + # One big call to message() for the sake of xmessage; if we had two then + # the user would have dismissed the error we want reported before seeing the + # request to report it. + message "$*" \ + "Please report the package name, version, and the complete text of" \ + "this error message to <debian-x@lists.debian.org>." + exit 1 } run_parts () { # until run-parts --noexec is implemented if [ -z "$1" ]; then - internal_errormsg "internal run_parts called without an argument" + internal_errormsg "run_parts() called without an argument." fi if [ ! -d "$1" ]; then - internal_errormsg "internal run_parts called, but $1 does not exist or is not a directory." + internal_errormsg "run_parts() called, but \"$1\" does not exist or is " \ + "not a directory." fi for F in $(ls $1); do if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then @@ -44,7 +53,7 @@ echo "$1/$F" fi fi - done; + done } # initialize variables for use by all session scripts @@ -64,18 +73,19 @@ chmod 600 "$ERRFILE" elif ERRFILE=$(tempfile 2> /dev/null); then if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then - message "Xsession: unable to symlink \"$TMPDIR/xsession-$USER\" to" \ - "\"$ERRFILE\"." + message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \ + "\"$ERRFILE\"; look for session log/errors in" \ + "\"$TMPDIR/xsession-$USER\"." fi else - errormsg "Xsession: unable to create X session log/error file. Aborting." + errormsg "unable to create X session log/error file; aborting." fi exec > "$ERRFILE" 2>&1 # sanity check; is our session script directory present? if [ ! -d "$SYSSESSIONDIR" ]; then - errormsg "Xsession: no $SYSSESSIONDIR directory found. Aborting." >&2 + errormsg "no \"$SYSSESSIONDIR\" directory found; aborting." fi # use run-parts to source every file in the session directory; we source