source: trunk/dports/textproc/sgml-common/files/patch-bin-install-catalog.in.diff @ 97546

Last change on this file since 97546 was 97546, checked in by pixilla@…, 8 years ago

textproc/sgml-common:

  • New port sgml-common version 0.6.3.
File size: 3.5 KB
  • bin/install-catalog.in

    a b  
    1313\040 -h, --help: \t\t\t\t Print this help message and exit\n\
    1414\040 -v, --version: \t\t\t Print the version number and exit\n"
    1515
     16# We need the files we create to be world readable
     17umask 022
     18
    1619# Set version message
    1720SGML_VERSION_MESSAGE="sgml-common version @VERSION@ (install-catalog version 1.0)"
    1821
     
    3639# Process actions
    3740case $1 in
    3841   -a|--add)    SGML_ACTION="addition"
    39                 SGML_CENTRALIZED=$2
    40                 SGML_ORDINARY=$3
     42                SGML_CENTRALIZED="$2"
     43                SGML_ORDINARY="$3"
    4144                ;;
    4245   -r|--remove) if [ -z "$3" -o "$3" = "--version" ]
    4346                then
     
    4548                  exit 0
    4649                fi
    4750                SGML_ACTION="removal"
    48                 SGML_CENTRALIZED=$2
    49                 SGML_ORDINARY=$3
     51                SGML_CENTRALIZED="$2"
     52                SGML_ORDINARY="$3"
    5053                ;;
    5154   -h|--help)   echo -e $SGML_HELP_MESSAGE
    5255                exit 0
     
    9396fi
    9497case $SGML_ACTION in
    9598   addition)
    96         if [ -e $SGML_CENTRALIZED -a ! -w $SGML_CENTRALIZED ]
     99        if [ -e "$SGML_CENTRALIZED" -a ! -w "$SGML_CENTRALIZED" ]
    97100        then
    98101          echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2
    99102          exit 2
    100103        fi
    101104        ;;
    102105   removal)
    103         if [ ! -w $SGML_CENTRALIZED ]
     106        if [ ! -w "$SGML_CENTRALIZED" ]
    104107        then
    105108          echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2
    106109          exit 2
     
    116119fi
    117120case $SGML_ACTION in
    118121   addition)
    119         if [ ! -s $SGML_ORDINARY ]
     122        if [ ! -s "$SGML_ORDINARY" ]
    120123        then
    121124          echo "`basename $0`: \"$SGML_ORDINARY\" does not exist or is empty." >&2
    122125          exit 2
     
    128131case $SGML_ACTION in
    129132    addition)
    130133        echo "`basename $0`: addition of $SGML_ORDINARY in $SGML_CENTRALIZED"
    131         if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null
     134        if grep -q "$SGML_ORDINARY" "$SGML_CENTRALIZED" 2>/dev/null
    132135        then
    133136          echo "Warning: $SGML_ORDINARY is already installed in the centralized catalog $SGML_CENTRALIZED" >&2
    134137        else
    135           echo "$SGML_POINTER $SGML_ORDINARY" >> $SGML_CENTRALIZED
     138          echo "$SGML_POINTER \"$SGML_ORDINARY\"" >> "$SGML_CENTRALIZED"
    136139        fi
    137         grep -q $SGML_CENTRALIZED /etc/sgml/catalog 2>/dev/null
     140        grep -q "$SGML_CENTRALIZED" /etc/sgml/catalog 2>/dev/null
    138141        if [ $? -ne 0 ]
    139142        then
    140143          echo "`basename $0`: addition of $SGML_CENTRALIZED in /etc/sgml/catalog"
    141           echo "$SGML_POINTER $SGML_CENTRALIZED" >> /etc/sgml/catalog
     144          echo "$SGML_POINTER \"$SGML_CENTRALIZED\"" >> /etc/sgml/catalog
    142145        fi
    143146        ;;
    144147   removal)
    145148        echo "`basename $0`: removal of $SGML_ORDINARY from $SGML_CENTRALIZED"
    146         if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null
     149        if grep -q "$SGML_ORDINARY" "$SGML_CENTRALIZED" 2>/dev/null
    147150        then
    148           sed -e "\:$SGML_POINTER $SGML_ORDINARY:d" < $SGML_CENTRALIZED > ${SGML_CENTRALIZED}.new
    149           mv ${SGML_CENTRALIZED}.new $SGML_CENTRALIZED
     151          sed -e "\:$SGML_POINTER \"\\?$SGML_ORDINARY\"\\?:d" < "$SGML_CENTRALIZED" > "${SGML_CENTRALIZED}.new"
     152          mv "${SGML_CENTRALIZED}.new" "$SGML_CENTRALIZED"
    150153        else
    151154          echo "Warning: $SGML_ORDINARY was not found in the centralized catalog $SGML_CENTRALIZED" >&2
    152155        fi
    153         if [ ! -s $SGML_CENTRALIZED ]
     156        if [ ! -s "$SGML_CENTRALIZED" ]
    154157        then
    155           rm $SGML_CENTRALIZED
     158          rm "$SGML_CENTRALIZED"
    156159          echo "`basename $0`: removal of $SGML_CENTRALIZED from /etc/sgml/catalog"
    157           sed -e "\:$SGML_POINTER $SGML_CENTRALIZED:d" < /etc/sgml/catalog > /etc/sgml/catalog.new
     160          sed -e "\:$SGML_POINTER \"\\?$SGML_CENTRALIZED\"\\?:d" < /etc/sgml/catalog > /etc/sgml/catalog.new
    158161          mv /etc/sgml/catalog.new /etc/sgml/catalog
    159162        fi
    160163        ;;
Note: See TracBrowser for help on using the repository browser.