Changeset 2fa79e3b for postlfs/config


Ignore:
Timestamp:
10/04/2003 01:47:13 AM (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_0-pre1, v5_1, v5_1-pre1, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
Children:
60e14d4
Parents:
b7d0bb4
Message:

applied compressdoc patch

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postlfs/config/compressdoc.xml

    rb7d0bb4 r2fa79e3b  
    1414
    1515#!/bin/bash
     16# VERSION: 20031004.0245
    1617#
    1718# Compress (with bzip2 or gzip) all man pages in a hierarchy and
    18 # update symlinks - By Marc Heerdink &lt;marc@koelkast.net&gt;.
     19# update symlinks - By Marc Heerdink &lt;marc @ koelkast.net&gt;
    1920# Modified to be able to gzip or bzip2 files as an option and to deal
    20 # with all symlinks properly by Mark Hymers # &lt;markh@linuxfromscratch.org&gt;
     21# with all symlinks properly by Mark Hymers &lt;markh @ linuxfromscratch.org&gt;
    2122#
    22 # Modified 20030925 by Yann E. Morin &lt;yann.morin.1998 @ # anciens.enib.fr&gt;
     23# Modified 20030930 by Yann E. Morin &lt;yann.morin.1998 @ anciens.enib.fr&gt;
    2324# to accept compression/decompression, to correctly handle hard-links,
    2425# to allow for changing hard-links into soft- ones, to specify the
     
    2728#
    2829# TODO:
    29 #        - inverse the quiet option into a verbose one, so as to be silent
    30 #          by default;
    3130#        - choose a default compress method to be based on the available
    3231#          tool : gzip or bzip2;
     
    4241    echo "Unknown option : $1"
    4342  fi
    44   echo "Usage: $0 &lt;comp_method&gt; [options] [dirs]"
     43  ( echo "Usage: $0 &lt;comp_method&gt; [options] [dirs]" &amp;&amp; \
    4544  cat &lt;&lt; EOT
    4645Where comp_method is one of :
     
    7069                as the method adds (.bz2 for bzip2, .gz for gzip).
    7170
    72   -s            Change hard-links into soft-links. Use with _caution_ as the
     71  --soft, -S    Change hard-links into soft-links. Use with _caution_ as the
    7372                first encountered file will be used as a reference. Not used
    7473                when in backup mode.
     74
     75  --hard, -H    Change soft-links into hard-links. Not used when in backup mode.
    7576
    7677  --conf=dir, --conf dir
     
    108109  does not even let me notice this... :-)
    109110EOT
     111) | less
    110112}
    111113
     
    145147
    146148# OK, parse the command-line for arguments, and initialize to some sensible
    147 # state, that is keep hardlinks, parse /etc/man.conf, be most silent, search
    148 # man.conf in /etc, and don't force (re-)compression.
     149# state, that is : don't change links state, parse /etc/man.conf, be most
     150# silent, search man.conf in /etc, and don't force (re-)compression.
    149151COMP_METHOD=
    150152COMP_SUF=
    151153COMP_LVL=
    152 FORCE_COMP=no
     154FORCE_OPT=
    153155LN_OPT=
    154156MAN_DIR=
     
    180182      ;;
    181183    --force|-F)
    182       FORCE_COMP=yes
    183       shift
    184       ;;
    185     --soft|-s)
    186       LN_OPT=-s
     184      FORCE_OPT=-F
     185      shift
     186      ;;
     187    --soft|-S)
     188      LN_OPT=-S
     189      shift
     190      ;;
     191    --hard|-H)
     192      LN_OPT=-H
    187193      shift
    188194      ;;
     
    276282  echo "Compression level.: $COMP_LVL"
    277283  echo "Compression suffix: $COMP_SUF"
    278   echo "Force compression.: $FORCE_COMP"
    279   echo "man.conf is.......: ${MAN_CONF}/man.conf ($MAN_CONF)"
    280   echo -n "Hard links........: "
    281   [ "$LN_OPT" = "-s" -o "$LN_OPT" = "--soft" ] &amp;&amp; echo -n "Convert to symlinks" || echo -n "Keep hardlinks"
    282   echo " ($LN_OPT)"
     284  echo -n "Force compression.: "
     285  [ "foo$FORCE_OPT" = "foo-F" ] &amp;&amp; echo "yes" || echo "no"
     286  echo "man.conf is.......: ${MAN_CONF}/man.conf"
     287  echo -n "Hard-links........: "
     288  [ "foo$LN_OPT" = "foo-S" ] &amp;&amp; echo "convert to soft-links" || echo "leave as is"
     289  echo -n "Soft-links........: "
     290  [ "foo$LN_OPT" = "foo-H" ] &amp;&amp; echo "convert to hard-links" || echo "leave as is"
    283291  echo "Backup............: $BACKUP"
    284292  echo "Faking (yes!).....: $FAKE"
    285293  echo "Directories.......: $MAN_DIR"
    286   echo "Silence level.....: $VERBOSE_LVL ($VERBOSE_OPT)"
     294  echo "Verbosity level...: $VERBOSE_LVL"
    287295  exit 0
    288296fi
     
    310318# I need to take into account the localized man, so I'm going recursive
    311319for DIR in $MAN_DIR; do
     320  MEM_DIR=`pwd`
    312321  cd "$DIR"
    313322  for FILE in *; do
     
    322331
    323332    if [ -d "$FILE" ]; then
     333      cd "${MEM_DIR}"  # Go back to where we ran "$0", in case "$0"=="./compressdoc" ...
    324334      # We are going recursive to that directory
    325335      echo "-&gt; Entering ${DIR}/${FILE}..." &gt; $DEST_FD0
    326336      # I need not pass --conf, as I specify the directory to work on
    327337      # But I need exit in case of error
    328       "$0" ${COMP_METHOD} ${COMP_LVL} ${LN_OPT} ${VERBOSE_OPT} "${DIR}/${FILE}" || exit 1
     338      "$0" ${COMP_METHOD} ${COMP_LVL} ${LN_OPT} ${VERBOSE_OPT} ${FORCE_OPT} "${DIR}/${FILE}" || exit 1
    329339      echo "&lt;- Leaving ${DIR}/${FILE}." &gt; $DEST_FD1
     340      cd "$DIR"  # Needed for the next iteration of the loop
    330341
    331342    else # !dir
     
    334345      # Check if the file is already compressed with the specified method
    335346      BASE_FILE=`basename \`basename "$FILE" .bz2\` .gz`
    336       if [ "${FILE}" = "${BASE_FILE}${COMP_SUF}" -a "${FORCE_COMP}" = "no" ]; then continue; fi
     347      if [ "${FILE}" = "${BASE_FILE}${COMP_SUF}" -a "foo${FORCE_OPT}" = "foo" ]; then continue; fi
    337348
    338349      # If we have a symlink
     
    356367        fi
    357368
    358         rm -f "$FILE" &amp;&amp; ln -s "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
     369        if [ "$LN_OPT" = "-H" ]; then
     370          # Change this soft-link into a hard- one
     371          rm -f "$FILE" &amp;&amp; ln "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
     372          chmod --reference "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
     373        else
     374          # Keep this soft-link a soft- one.
     375          rm -f "$FILE" &amp;&amp; ln -s "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
     376        fi
    359377        echo "Relinked $FILE" &gt; $DEST_FD1
    360378
     
    387405        esac
    388406
    389         # Compress the file with the highest compression ratio, if needed
     407        # Compress the file with the given compression ratio, if needed
    390408        case $COMP_SUF in
    391409          *bz2)
     
    406424          for i in $HLINKS; do
    407425            NEWFILE=`echo $i | sed s/\.gz$// | sed s/\.bz2$//`
    408             ln ${LN_OPT} "${FILE}$COMP_SUF" "${NEWFILE}$COMP_SUF"
     426            if [ "$LN_OPT" = "-S" ]; then
     427              # Make this hard-link a soft- one
     428              ln -s "${FILE}$COMP_SUF" "${NEWFILE}$COMP_SUF"
     429            else
     430              # Keep the hard-link a hard- one
     431              ln "${FILE}$COMP_SUF" "${NEWFILE}$COMP_SUF"
     432            fi
    409433            chmod 644 "${NEWFILE}$COMP_SUF" # Really work only for hard-links. Harmless for soft-links
    410434          done
Note: See TracChangeset for help on using the changeset viewer.