#!/sbin/sh ######## # Product: AbiWord # Fileset: AbiWord # configure # @(#) $Revision$ ######## # # HP-UX abiword SD configure script, written by Kevin Vajk # # This script adds ${TARGET}/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.) # ######## # This next line (defining $TARGET) is edited by hpux.abiword.mkdepot.sh # automatically, so please don't change its format. (I know this is # hackish, but it works well enough for now.) # Where abiword is installed: TARGET=/usr/local/share/AbiSuite-2.2 # Make sure we can find everything we'll need: PATH=/usr/sbin:/sbin:/usr/bin:${PATH} ; export PATH ############################################################################### FONTDIR=${TARGET}/fonts FILE=/etc/X11/fs/config if [ ! -f "$FILE" ] ; then echo "WARNING: $FILE not found" elif [ ! -d "$FONTDIR" ] ; then echo "WARNING: $FONTDIR 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 add_iconv_alias utf8 utf-8 add_iconv_alias utf8 UTF-8 add_iconv_alias cp1250 CP1250 add_iconv_alias cp1251 CP1251 add_iconv_alias cp1252 CP1252 add_iconv_alias cp1253 CP1253 add_iconv_alias cp1254 CP1254 add_iconv_alias cp1255 CP1255 add_iconv_alias cp1256 CP1256 add_iconv_alias cp1257 CP1257 add_iconv_alias cp1258 CP1258 ############################################################################### exit 0