#!/sbin/sh ######## # Product: AbiWord # Fileset: AbiWord # configure # @(#) $Revision: 0.1 $ ######## # # HP-UX abiword configure script, written by Kevin Vajk # # This script adds /usr/local/AbiSuite/fonts to /etc/X11/fs/config # and edits /usr/lib/nls/iconv/config.iconv to add an alias for # ISO-8859-1 (iso81) and UCS-2 (ucs2) # (I don't like editing config.iconv, but abiword doesn't seem to work # without this, and thus far I don't have a better solution.) # ######## ############################################################################### fontdir=/usr/local/AbiSuite/fonts FILE=/etc/X11/fs/config if [ ! -f "$FILE" ] ; then echo "WARNING: $FILE not found" else [ -f "${FILE}.abisave" ] || cp -p $FILE ${FILE}.abisave grep '^[[:space:]]*catalogue[[:space:]]*=' $FILE | grep -q "$fontdir" if [ $? -ne 0 ] ; then rm -rf /tmp/config.$$ ; mkdir /tmp/config.$$ sed 's@\(^[[:space:]]*catalogue[[:space:]]*=.*\)$@\1,'${fontdir}'@' < $FILE > /tmp/config.$$/config cat < /tmp/config.$$/config > $FILE rm -rf /tmp/config.$$ echo "NOTE: Added entry for $fontdir to ${FILE}." echo " You may need to run \"/sbin/init.d/xfs restart\"." echo " You may also need to re-start the X Window System." fi fi ############################################################################### FILE=/usr/lib/nls/iconv/config.iconv add_iconv_alias() { key="$1" value="$2" if [ ! -f "$FILE" ] ; then echo "WARNING: $FILE not found" return fi [ -f "${FILE}.abisave" ] || cp -p $FILE ${FILE}.abisave if ! grep -q '^[[:space:]]*alias[[:space:]][[:space:]]*'${key}'[[:space:]]' $FILE then # The key doesn't exist, so add it to the alias section of the file: ( echo '1' ; echo '/^alias' ; echo 'i' echo "alias ${key} ${value}" echo '.' ; echo 'wq!' ) | ex "$FILE" >/dev/null 2>&1 echo "NOTE: Aliased $value to $key in $FILE" else grep '^[[:space:]]*alias[[:space:]][[:space:]]*'${key}'[[:space:]]' $FILE | grep -q -- ${value} if [ $? -ne 0 ] ; then # The key exists; add this value to the list: rm -rf /tmp/config.$$ ; mkdir /tmp/config.$$ sed 's/^[[:space:]]*alias[[:space:]][[:space:]]*'${key}'[[:space:]]/alias '${key}' '${value}' /' < $FILE > /tmp/config.$$/tmp cat < /tmp/config.$$/tmp > $FILE rm -rf /tmp/config.$$ echo "NOTE: Aliased $value to $key in $FILE" fi fi } add_iconv_alias iso81 ISO-8859-1 add_iconv_alias ucs2 UCS-2 ############################################################################### exit 0