Changeset 62b2fb0 for postlfs/config
- Timestamp:
- 04/21/2008 10:39:09 PM (16 years ago)
- Branches:
- 10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 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:
- 47aad0c8
- Parents:
- 48e6b2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postlfs/config/compressdoc.xml
r48e6b2a r62b2fb0 33 33 <screen role="root"><?dbfo keep-together="auto"?><userinput>cat > /usr/sbin/compressdoc << "EOF" 34 34 <literal>#!/bin/bash 35 # VERSION: 20080421.1 12135 # VERSION: 20080421.1320 36 36 # 37 37 # Compress (with bzip2 or gzip) all man pages in a hierarchy and … … 66 66 # that don't exist or don't have sufficient permissions. 67 67 # 68 # Modified 20080421 by Lars Bamberger to (sort of) automatically choose 69 # a compression method based on the size of the manpage. A couple bug 70 # fixes were added by Dan Nicholson. 71 # 68 72 # TODO: 69 73 # - choose a default compress method to be based on the available 70 74 # tool : gzip or bzip2; 71 # - offer an option to automagically choose the best compression72 # methed on a per page basis (eg. check which of73 # gzip/bzip2/whatever is the most effective, page per page);74 75 # - when a MANPATH env var exists, use this instead of /etc/man_db.conf 75 76 # (useful for users to (de)compress their man pages; … … 89 90 --bzip2, --bz2, -b 90 91 Compress using gzip or bzip2. 92 --automatic 93 Compress using either gzip or bzip2, depending on the 94 size of the file to be compressed. Files larger than 5 95 kB are bzipped, files larger than 1 kB are gzipped and 96 files smaller than 1 kB are not compressed. 91 97 92 98 --decompress, -d … … 217 223 --bzip2|--bz2|-b) 218 224 COMP_SUF=.bz2 225 COMP_METHOD=$1 226 shift 227 ;; 228 --automatic) 229 COMP_SUF=TBD 219 230 COMP_METHOD=$1 220 231 shift … … 333 344 case $COMP_METHOD in 334 345 --bzip2|--bz2|-b) echo -n "bzip2";; 335 --gzip|__gz|-g) echo -n "gzip";; 346 --gzip|--gz|-g) echo -n "gzip";; 347 --automatic) echo -n "compressing";; 336 348 --decompress|-d) echo -n "decompressing";; 337 349 *) echo -n "unknown";; … … 416 428 if ! check_unique "$DIR" "$FILE"; then continue; fi 417 429 430 # With automatic compression, get the uncompressed file size of 431 # the file (dereferencing symlinks), and choose an appropriate 432 # compression method. 433 if [ "$COMP_METHOD" = "--automatic" ]; then 434 declare -i SIZE 435 case "$FILE" in 436 *.bz2) 437 SIZE=$(bzcat "$FILE" | wc -c) ;; 438 *.gz) 439 SIZE=$(zcat "$FILE" | wc -c) ;; 440 *) 441 SIZE=$(wc -c < "$FILE") ;; 442 esac 443 if (( $SIZE >= (5 * 2**10) )); then 444 COMP_SUF=.bz2 445 elif (( $SIZE >= (1 * 2**10) )); then 446 COMP_SUF=.gz 447 else 448 COMP_SUF= 449 fi 450 fi 451 418 452 # Check if the file is already compressed with the specified method 419 453 BASE_FILE=`basename "$FILE" .gz`
Note:
See TracChangeset
for help on using the changeset viewer.