#308 closed defect (fixed)
update man hint with following code to rename symlinks to point to the new compressed filenames
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Book | Version: | CVS |
Severity: | normal | Keywords: | |
Cc: |
Description
From: blax <blax@…> To: gerard@… Subject: Man hint Date: Tue, 12 Mar 2002 17:37:42 -0600
Hello, To compress manpages that have symlinks to them I wrote the following perl script: <CODE> #!/usr/bin/perl -w use strict; # Change $lfs_man_dir to your lfs_man_dir root my $lfs_man_dir = "/home/lfs/build/usr/share/man"; chdir("$lfs_man_dir") or die "cannot chdir $lfs_man_dir: $!"; for (my $i = 1; $i < 9; $i++) {
opendir(M_DIR, "man$i") or die "cannot opendir man$i: $!"; chdir("man$i");
# change all symlinks to point to *.bz2 foreach (readdir M_DIR) {
if (-l $_) {
my $link = readlink($_) or die "cannot readlink $_: $!"; unlink($_) or die "cannot unlink $_: $!"; symlink("$link.bz2", "$_.bz2")
or die "cannot create symlink $link.bz2: $!";
}
}
# now compress all files opendir(M_DIR, ".") or die "cannot opendir man$i: $!"; foreach (readdir M_DIR) {
next if -l $_ or /\.(\.)?$/; system("bzip2 $_");
} chdir(".."); closedir(M_DIR);
} </CODE> It changes two things: the symlinks are renamed with a *.bz2 extension and now point to the file they were pointing to *.bz2. Now the files they were pointing to can be compressed and the links point to the proper place. The script doesn't handle hard links but the only man pages that have hard links to them are from the gzip package. I removed all but gzip.1 and created symlinks to it manualy. Cordialy, Jerry Bennett blax@…
Change History (4)
comment:1 by , 23 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 23 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 23 years ago
Keywords: | VERIFIED added |
---|
comment:4 by , 23 years ago
Keywords: | VERIFIED removed |
---|
I've added a slightly different piece of code modified from a shell script that Marc Heerdink sent to lfs-dev. Reasoning being that it's more likely to be understandable to users than perl coding. The code in the man.txt hint still doens't deal with hard links. I'm going to think about that some more. (BTW; it isn't just gzip that does that some other (non LFS-BOOK) packages do it, like Tcl/Tk).
Updated hint has been submitted