#!/bin/sh # Wrapper for rasmol to select binary by depth of current X display # # Michael Sternberg - sternberg at anl gov #--------------------------------------------------------------------- # Adjust the following to your installation: #--------------------------------------------------------------------- LIBEXEC_DIR=/usr/local/lib/rasmol/bin #--------------------------------------------------------------------- # work starts #--------------------------------------------------------------------- case "$*" in "*-nodisplay*") unset DISPLAY ;; esac if [ "${DISPLAY}unset" = "unset" ]; then DISPLAY_BITS=8 else DISPLAY_BITS=`xdpyinfo | awk '/depth of root window:/ {print $5}'` fi # Hack: Suppress using X11-Shared-memory when connected over ssh-forwarding. case -$DISPLAY-$SSH_CLIENT- in -localhost:*-???*-) DISPLAY=`echo $DISPLAY | sed s/localhost/127.0.0.1/` export DISPLAY ;; esac # some depths are handled by other binaries case "$DISPLAY_BITS" in 1) DISPLAY_BITS=8 ;; 24) DISPLAY_BITS=32 ;; esac # guess names of binaries (2.6 vs. 2.7) A=$LIBEXEC_DIR/rasmol_${DISPLAY_BITS}bit B=$LIBEXEC_DIR/rasmol_${DISPLAY_BITS}BIT if [ -f $A ]; then BINARY=$A elif [ -f $B ]; then BINARY=$B else echo "${LIBEXEC_DIR}: No rasmol binaries found." 1>&2 exit fi exec $BINARY ${1+"$@"} # EOF