Changeset b614eb09 for postlfs


Ignore:
Timestamp:
10/09/2003 08:17:25 PM (21 years ago)
Author:
Larry Lawrence <larry@…>
Branches:
10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 6.0, 6.1, 6.2, 6.2.0, 6.2.0-rc1, 6.2.0-rc2, 6.3, 6.3-rc1, 6.3-rc2, 6.3-rc3, 7.10, 7.4, 7.5, 7.6, 7.6-blfs, 7.6-systemd, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, basic, bdubbs/svn, elogind, gnome, kde5-13430, kde5-14269, kde5-14686, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, krejzi/svn, lazarus, lxqt, nosym, perl-modules, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, systemd-11177, systemd-13485, trunk, upgradedb, v5_0, v5_1, v5_1-pre1, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
Children:
58964bd
Parents:
a78534d
Message:

compressdoc patch, intro expansion

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1356 af4574ff-66df-0310-9fd7-8a98e5e911e0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postlfs/config/compressdoc.xml

    ra78534d rb614eb09  
    1212
    1313<screen><userinput><command>cat &gt; /usr/bin/compressdoc &lt;&lt; "EOF"</command>
    14 
    1514#!/bin/bash
    16 # VERSION: 20031004.0245
     15# VERSION: 20031009.1920
    1716#
    1817# Compress (with bzip2 or gzip) all man pages in a hierarchy and
     
    129128  BASENAME=`basename "${2}" .bz2`
    130129  BASENAME=`basename "${BASENAME}" .gz`
    131   LIST=
    132   [ -f "$DIR"/"${BASENAME}" -o -L "$DIR"/"${BASENAME}" ] &amp;&amp; LIST="${LIST} ${BASENAME}"
    133   [ -f "$DIR"/"${BASENAME}".gz -o -L "$DIR"/"${BASENAME}".gz ] &amp;&amp; LIST="${LIST} ${BASENAME}.gz"
    134   [ -f "$DIR"/"${BASENAME}".bz2 -o -L "$DIR"/"${BASENAME}".bz2 ] &amp;&amp; LIST="${LIST} ${BASENAME}.bz2"
     130  GZ_FILE="$BASENAME".bz2
     131  BZ_FILE="$BASENAME".bz2
    135132
    136133  # Look for, and keep, the most recent one
    137   LATEST=`(cd "$DIR"; ls -1rt $LIST | tail -1)`
    138   for i in $LIST; do
     134  LATEST=`(cd "$DIR"; ls -1rt "${BASENAME}" "${GZ_FILE}" "${BZ_FILE}" 2&gt;/dev/null | tail -1)`
     135  for i in "${BASENAME}" "${GZ_FILE}".gz "${BZ_FILE}".bz2; do
    139136    [ "$LATEST" != "$i" ] &amp;&amp; rm -f "$DIR"/"$i"
    140137  done
     
    344341
    345342      # Check if the file is already compressed with the specified method
    346       BASE_FILE=`basename \`basename "$FILE" .bz2\` .gz`
     343      BASE_FILE=`basename "$FILE" .gz`
     344      BASE_FILE=`basename "$FILE" .bz2`
    347345      if [ "${FILE}" = "${BASE_FILE}${COMP_SUF}" -a "foo${FORCE_OPT}" = "foo" ]; then continue; fi
    348346
    349347      # If we have a symlink
    350348      if [ -h "$FILE" ]; then
    351         case $FILE in
     349        case "$FILE" in
    352350          *.bz2)
    353351            EXT=bz2 ;;
     
    359357
    360358        if [ ! "$EXT" = "none" ]; then
    361           LINK=`ls -l $FILE | cut -d "&gt;" -f2 | tr -d " " | sed s/\.$EXT$//`
     359          LINK=`ls -l "$FILE" | cut -d "&gt;" -f2 | tr -d " " | sed s/\.$EXT$//`
    362360          NEWNAME=`echo "$FILE" | sed s/\.$EXT$//`
    363361          mv "$FILE" "$NEWNAME"
    364362          FILE="$NEWNAME"
    365363        else
    366           LINK=`ls -l $FILE | cut -d "&gt;" -f2 | tr -d " "`
     364          LINK=`ls -l "$FILE" | cut -d "&gt;" -f2 | tr -d " "`
    367365        fi
    368366
     
    394392        # We do decompress first to re-compress with the selected
    395393        # compression ratio later on...
    396         case $FILE in
     394        case "$FILE" in
    397395          *.bz2)
    398396            bunzip2 $FILE
     
    423421        if [ -n "$HLINKS" ]; then
    424422          for i in $HLINKS; do
    425             NEWFILE=`echo $i | sed s/\.gz$// | sed s/\.bz2$//`
     423            NEWFILE=`echo "$i" | sed s/\.gz$// | sed s/\.bz2$//`
    426424            if [ "$LN_OPT" = "-S" ]; then
    427425              # Make this hard-link a soft- one
     
    439437        # Obviously, we shall never ever come here... :-(
    440438        echo "Whaooo... \"${DIR}/${FILE}\" is neither a symlink nor a plain file. Please check:"
    441         ls -l ${DIR}/${FILE}
     439        ls -l "${DIR}/${FILE}"
    442440        exit 1
    443441      fi
Note: See TracChangeset for help on using the changeset viewer.