Changeset e0d33ef for postlfs/config/compressdoc.xml
- Timestamp:
- 05/30/2005 09:56:30 PM (19 years ago)
- Branches:
- 10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 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, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
- Children:
- 3aa07d1
- Parents:
- f009801
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postlfs/config/compressdoc.xml
rf009801 re0d33ef 23 23 bzip2'ed pages, a feature you can use to free some disk space while keeping 24 24 your documentation available. However, things are not that simple; man 25 directories tend to contain links—hard and symbolic—which defeat 26 simple ideas like recursively calling <command>gzip</command> on them. A 25 directories tend to contain links—hard and symbolic—which defeat 26 simple ideas like recursively calling <command>gzip</command> on them. A 27 27 better way to go is to use the script below.</para> 28 28 … … 43 43 # to allow for a backup, to allow to keep the newest version of a page. 44 44 # 45 # Modified 20040330 by Tushar Teredesai to replace $0 by the name of the 45 # Modified 20040330 by Tushar Teredesai to replace $0 by the name of the 46 46 # script. 47 47 # (Note: It is assumed that the script is in the user's PATH) … … 53 53 # - choose a default compress method to be based on the available 54 54 # tool : gzip or bzip2; 55 # - offer an option to automagically choose the best compression 56 # methed on a per page basis (eg. check which of 55 # - offer an option to automagically choose the best compression 56 # methed on a per page basis (eg. check which of 57 57 # gzip/bzip2/whatever is the most effective, page per page); 58 58 # - when a MANPATH env var exists, use this instead of /etc/man.conf … … 78 78 79 79 --backup Specify a .tar backup shall be done for all directories. 80 In case a backup already exists, it is saved as .tar.old 81 prior to making the new backup. If a .tar.old backup 80 In case a backup already exists, it is saved as .tar.old 81 prior to making the new backup. If a .tar.old backup 82 82 exists, it is removed prior to saving the backup. 83 83 In backup mode, no other action is performed. … … 85 85 And where options are : 86 86 -1 to -9, --fast, --best 87 The compression level, as accepted by gzip and bzip2. 88 When not specified, uses the default compression level 89 for the given method (-6 for gzip, and -9 for bzip2). 87 The compression level, as accepted by gzip and bzip2. 88 When not specified, uses the default compression level 89 for the given method (-6 for gzip, and -9 for bzip2). 90 90 Not used when in backup or decompress modes. 91 91 92 --force, -F Force (re-)compression, even if the previous one was 93 the same method. Useful when changing the compression 94 ratio. By default, a page will not be re-compressed if 95 it ends with the same suffix as the method adds 92 --force, -F Force (re-)compression, even if the previous one was 93 the same method. Useful when changing the compression 94 ratio. By default, a page will not be re-compressed if 95 it ends with the same suffix as the method adds 96 96 (.bz2 for bzip2, .gz for gzip). 97 97 98 --soft, -S Change hard-links into soft-links. Use with _caution_ 99 as the first encountered file will be used as a 98 --soft, -S Change hard-links into soft-links. Use with _caution_ 99 as the first encountered file will be used as a 100 100 reference. Not used when in backup mode. 101 101 102 --hard, -H Change soft-links into hard-links. Not used when in 102 --hard, -H Change soft-links into hard-links. Not used when in 103 103 backup mode. 104 104 … … 106 106 Specify the location of man.conf. Defaults to /etc. 107 107 108 --verbose, -v Verbose mode, print the name of the directory being 109 processed. Double the flag to turn it even more verbose, 108 --verbose, -v Verbose mode, print the name of the directory being 109 processed. Double the flag to turn it even more verbose, 110 110 and to print the name of the file being processed. 111 111 112 112 --fake, -f Fakes it. Print the actual parameters compman will use. 113 113 114 dirs A list of space-separated _absolute_ pathnames to the 115 man directories. When empty, and only then, parse 114 dirs A list of space-separated _absolute_ pathnames to the 115 man directories. When empty, and only then, parse 116 116 ${MAN_CONF}/man.conf for all occurrences of MANPATH. 117 117 … … 120 120 both gzip and bzip2 on man pages, taking into account the hosting fs, 121 121 the architecture, etc... On the overall, the conclusion was that gzip 122 was much more efficient on 'small' files, and bzip2 on 'big' files, 122 was much more efficient on 'small' files, and bzip2 on 'big' files, 123 123 small and big being very dependent on the content of the files. 124 124 125 See the original post from Mickael A. Peters, titled 125 See the original post from Mickael A. Peters, titled 126 126 "Bootable Utility CD", dated 20030409.1816(+0200), and subsequent posts: 127 127 http://linuxfromscratch.org/pipermail/blfs-support/2003-April/038817.html 128 128 129 On my system (x86, ext3), man pages were 35564KB before compression. 130 gzip -9 compressed them down to 20372KB (57.28%), bzip2 -9 got down to 129 On my system (x86, ext3), man pages were 35564KB before compression. 130 gzip -9 compressed them down to 20372KB (57.28%), bzip2 -9 got down to 131 131 19812KB (55.71%). That is a 1.57% gain in space. YMMV. 132 132 133 What was not taken into consideration was the decompression speed. But 134 does it make sense to? You gain fast access with uncompressed man 135 pages, or you gain space at the expense of a slight overhead in time. 133 What was not taken into consideration was the decompression speed. But 134 does it make sense to? You gain fast access with uncompressed man 135 pages, or you gain space at the expense of a slight overhead in time. 136 136 Well, my P4-2.5GHz does not even let me notice this... :-) 137 137 … … 140 140 } 141 141 142 # This function checks that the man page is unique amongst bzip2'd, 142 # This function checks that the man page is unique amongst bzip2'd, 143 143 # gzip'd and uncompressed versions. 144 144 # $1 the directory in which the file resides 145 145 # $2 the file name for the man page 146 # Returns 0 (true) if the file is the latest and must be taken care of, 147 # and 1 (false) if the file is not the latest (and has therefore been 146 # Returns 0 (true) if the file is the latest and must be taken care of, 147 # and 1 (false) if the file is not the latest (and has therefore been 148 148 # deleted). 149 149 function check_unique () … … 177 177 MY_NAME=`basename $0` 178 178 179 # OK, parse the command-line for arguments, and initialize to some 180 # sensible state, that is: don't change links state, parse 181 # /etc/man.conf, be most silent, search man.conf in /etc, and don't 179 # OK, parse the command-line for arguments, and initialize to some 180 # sensible state, that is: don't change links state, parse 181 # /etc/man.conf, be most silent, search man.conf in /etc, and don't 182 182 # force (re-)compression. 183 183 COMP_METHOD= … … 258 258 ;; 259 259 *) 260 echo "\"$1\" is not an absolute path name" 260 echo "\"$1\" is not an absolute path name" 261 261 exit 1 262 262 ;; … … 286 286 esac 287 287 288 # Note: on my machine, 'man --path' gives /usr/share/man twice, once 288 # Note: on my machine, 'man --path' gives /usr/share/man twice, once 289 289 # with a trailing '/', once without. 290 290 if [ -z "$MAN_DIR" ]; then … … 319 319 echo "man.conf is.......: ${MAN_CONF}/man.conf" 320 320 echo -n "Hard-links........: " 321 [ "foo$LN_OPT" = "foo-S" ] && 321 [ "foo$LN_OPT" = "foo-S" ] && 322 322 echo "convert to soft-links" || echo "leave as is" 323 323 echo -n "Soft-links........: " 324 [ "foo$LN_OPT" = "foo-H" ] && 324 [ "foo$LN_OPT" = "foo-H" ] && 325 325 echo "convert to hard-links" || echo "leave as is" 326 326 echo "Backup............: $BACKUP" … … 344 344 echo "Backing up $DIR..." > $DEST_FD0 345 345 [ -f "${DIR_NAME}.tar.old" ] && rm -f "${DIR_NAME}.tar.old" 346 [ -f "${DIR_NAME}.tar" ] && 346 [ -f "${DIR_NAME}.tar" ] && 347 347 mv "${DIR_NAME}.tar" "${DIR_NAME}.tar.old" 348 348 tar -cfv "${DIR_NAME}.tar" "${DIR_NAME}" > $DEST_FD1 … … 361 361 362 362 # Fixes the case when hard-links see their compression scheme change 363 # (from not compressed to compressed, or from bz2 to gz, or from gz 363 # (from not compressed to compressed, or from bz2 to gz, or from gz 364 364 # to bz2) 365 # Also fixes the case when multiple version of the page are present, 365 # Also fixes the case when multiple version of the page are present, 366 366 # which are either compressed or not. 367 367 if [ ! -L "$FILE" -a ! -e "$FILE" ]; then continue; fi … … 371 371 372 372 if [ -d "$FILE" ]; then 373 cd "${MEM_DIR}" # Go back to where we ran "$0", 373 cd "${MEM_DIR}" # Go back to where we ran "$0", 374 374 # in case "$0"=="./compressdoc" ... 375 375 # We are going recursive to that directory … … 426 426 # Take care of hard-links: build the list of files hard-linked 427 427 # to the one we are {de,}compressing. 428 # NB. This is not optimum has the file will eventually be 429 # compressed as many times it has hard-links. But for now, 428 # NB. This is not optimum has the file will eventually be 429 # compressed as many times it has hard-links. But for now, 430 430 # that's the safe way. 431 431 inode=`ls -li "$FILE" | awk '{print $1}'` … … 483 483 484 484 else 485 # There is a problem when we get neither a symlink nor a plain 485 # There is a problem when we get neither a symlink nor a plain 486 486 # file. Obviously, we shall never ever come here... :-( 487 487 echo -n "Whaooo... \"${DIR}/${FILE}\" is neither a symlink " … … 497 497 chmod 755 /usr/sbin/compressdoc</userinput></screen> 498 498 499 <para>Now, as <systemitem class="username">root</systemitem>, you can issue a 500 <command>compressdoc --bz2</command> to compress all your system man 501 pages. You can also run <command>compressdoc --help</command> to get 499 <para>Now, as <systemitem class="username">root</systemitem>, you can issue a 500 <command>compressdoc --bz2</command> to compress all your system man 501 pages. You can also run <command>compressdoc --help</command> to get 502 502 comprehensive help about what the script is able to do.</para> 503 503 504 <para> Don't forget that a few programs, like the <application>X Window 505 System</application> and <application>XEmacs</application> also 506 install their documentation in non standard places (such as 507 <filename class="directory">/usr/X11R6/man</filename>, etc...). Be sure 508 to add these locations to the file <filename>/etc/man.conf</filename>, as a 504 <para> Don't forget that a few programs, like the <application>X Window 505 System</application> and <application>XEmacs</application> also 506 install their documentation in non standard places (such as 507 <filename class="directory">/usr/X11R6/man</filename>, etc...). Be sure 508 to add these locations to the file <filename>/etc/man.conf</filename>, as a 509 509 <envar>MANPATH</envar>=<replaceable>[/path]</replaceable> section.</para> 510 510 … … 518 518 ...</literal></screen> 519 519 520 <para>Generally, package installation systems do not compress man/info pages, 521 which means you will need to run the script again if you want to keep the size 520 <para>Generally, package installation systems do not compress man/info pages, 521 which means you will need to run the script again if you want to keep the size 522 522 of your documentation as small as possible. Also, note that running the script 523 after upgrading a package is safe; when you have several versions of a page 523 after upgrading a package is safe; when you have several versions of a page 524 524 (for example, one compressed and one uncompressed), the most recent one is kept 525 525 and the others deleted.</para>
Note:
See TracChangeset
for help on using the changeset viewer.