├── .cvsignore ├── .gitignore ├── Linux+IPv6-HOWTO.pdf ├── Linux+IPv6-HOWTO.de.pdf ├── Linux+IPv6-HOWTO.fr.pdf ├── Linux+IPv6-HOWTO.pt_BR.pdf ├── generate-en-de.sh ├── generate-all.sh ├── README ├── info.txt ├── copytohowtodir.sh ├── sgmllyxtabletagfix.pl ├── sgmllyxquotefix.pl ├── runsgmlfix.sh ├── lyxcodelinewrapper.pl ├── make.sh ├── generate.sh ├── ldp.dsl └── check_urls.pl /.cvsignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | Linux+IPv6-HOWTO*/* 3 | -------------------------------------------------------------------------------- /Linux+IPv6-HOWTO.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tLDP/Linux-IPv6/HEAD/Linux+IPv6-HOWTO.pdf -------------------------------------------------------------------------------- /Linux+IPv6-HOWTO.de.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tLDP/Linux-IPv6/HEAD/Linux+IPv6-HOWTO.de.pdf -------------------------------------------------------------------------------- /Linux+IPv6-HOWTO.fr.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tLDP/Linux-IPv6/HEAD/Linux+IPv6-HOWTO.fr.pdf -------------------------------------------------------------------------------- /Linux+IPv6-HOWTO.pt_BR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tLDP/Linux-IPv6/HEAD/Linux+IPv6-HOWTO.pt_BR.pdf -------------------------------------------------------------------------------- /generate-en-de.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Generate all available howtos 4 | 5 | list="Linux+IPv6-HOWTO.sgml Linux+IPv6-HOWTO.de.sgml" 6 | 7 | for lyx in $list; do 8 | ./generate.sh $lyx $* || exit 1 9 | done 10 | 11 | echo -en "\a" 12 | -------------------------------------------------------------------------------- /generate-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Generate all available howtos 4 | 5 | list="Linux+IPv6-HOWTO.sgml Linux+IPv6-HOWTO.de.sgml Linux+IPv6-HOWTO.fr.sgml Linux+IPv6-HOWTO.pt_BR.sgml" 6 | 7 | for lyx in $list; do 8 | ./generate.sh $lyx 9 | done 10 | 11 | echo -en "\a" 12 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the "in-progress" document source repository for the 2 | 3 | LINUX+IPv6-HOWTO 4 | 5 | also containing translations which isn't (fully) supported by tLDP. 6 | 7 | 8 | Generated versions are published: 9 | - http://mirrors.deepspace6.net/howtos/ 10 | - http://mirrors.bieringer.de/ 11 | 12 | Released versions are also published on tLDP: 13 | - http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/ 14 | 15 | 16 | 2017-03-04 Peter Bieringer 17 | -------------------------------------------------------------------------------- /info.txt: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | This is the working directory of 4 | Peter Bieringer 5 | pb (at) bieringer.de 6 | 7 | Content: 8 | Linux+IPv6-HOWTO.lyx (online next) 9 | LyX file of the Linux+IPv6-HOWTO 10 | 11 | lyxcodelinewrapper.pl 12 | Perl program which wraps too long "code" lines in a LyX file 13 | 14 | sgmllyxtabletagfix.pl 15 | Perl program which fixes table tags 16 | 17 | sgmllyxquotefix.pl 18 | Perl program which fixes quote tags 19 | 20 | copytohowtodir.sh 21 | Shell program which copy SGML file to local howto directory 22 | 23 | runsgmlfix.sh 24 | Shell program which runs all the SGML code fix programs 25 | 26 | generate.sh 27 | Shell program which run different generation steps (needed for local review) 28 | requires: sgml-common opensp openjade docbook-utils-pdf recode htmldoc 29 | 30 | 2017-01-08 Test 31 | -------------------------------------------------------------------------------- /copytohowtodir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # $Id$ 4 | # 5 | # Small helper script to copy SGML file to howto dir 6 | # 7 | # (P) & (C) by Peter Bieringer 8 | # 9 | # 20020119/PB: initial 10 | 11 | 12 | FILE_SGML="Linux+IPv6-HOWTO.sgml" 13 | 14 | DIRSRC="./" 15 | DIRDST="../../howto/docbook/" 16 | 17 | if [ ! -f "${DIRSRC}${FILE_SGML}" ]; then 18 | echo "ERR : Missing SGML file '${DIRSRC}${FILE_SGML}'!" 19 | exit 1 20 | fi 21 | 22 | if [ -f "${DIRDST}${FILE_SGML}" ]; then 23 | if [ "${DIRDST}${FILE_SGML}" -nt "${DIRSRC}${FILE_SGML}" ]; then 24 | echo "ERR : SGML file at destination is newer than source!" 25 | exit 1 26 | fi 27 | fi 28 | 29 | if [ -f "${DIRDST}${FILE_SGML}" ]; then 30 | echo "INF : Remove old SGML file '${DIRDST}${FILE_SGML}'" 31 | rm "${DIRDST}${FILE_SGML}" 32 | fi 33 | 34 | echo "INF : Copy new SGML file" 35 | cp "${DIRSRC}${FILE_SGML}" "${DIRDST}${FILE_SGML}" 36 | -------------------------------------------------------------------------------- /sgmllyxtabletagfix.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # $Id$ 4 | # 5 | # SGML LyX table tag fix tool 6 | # 7 | # (P) & (C) 2002 by Peter Bieringer 8 | # 9 | # Published under the GNU GPL licence 10 | # 11 | # Takes SGML output exported by LyX and fix a bug in the table tag. 12 | # Don't know the reason what causes this, but it is wrong. 13 | # -> This bug is fixed in LyX 1.1.6fix4 14 | # 15 | # Example: 16 | # - 17 | # + 18 | # 19 | # Changes: 20 | # 20020119/PB: Initial release 21 | # 20020125/PB: Minor review 22 | # 20020130/PB: add comment 23 | # 24 | 25 | print STDERR "INF : Fix 'colspec' lines\n"; 26 | 27 | while () { 28 | my $line = $_; 29 | chomp $line; 30 | 31 | #print "$line"; 32 | #print "\n"; 33 | 34 | if ($line =~ /^$/) { 36 | print STDERR "C"; 37 | 38 | # Substitute '/>' with '>' 39 | $line =~ s/\/>$/>/g; 40 | }; 41 | }; 42 | 43 | print $line . "\n"; 44 | }; 45 | print STDERR "\n"; 46 | -------------------------------------------------------------------------------- /sgmllyxquotefix.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # $Id$ 4 | # 5 | # SGML LyX qoute entinity fix tool 6 | # 7 | # (P) & (C) 2002 by Peter Bieringer 8 | # 9 | # Published under the GNU GPL licence 10 | # 11 | # Takes SGML output exported by LyX and fix a bug regarding quote entinities 12 | # Don't know the reason what causes this, but it is wrong. 13 | # 14 | # Replaces: 15 | # “ -> " 16 | # ” -> " 17 | # 18 | # Changes: 19 | # 20020125: Initial release 20 | # 20020713: spelling fix 21 | # 22 | # Known bugs: 23 | # Entity must be in one line 24 | 25 | print STDERR "INF : Replacing special quotes entities\n"; 26 | 27 | while () { 28 | my $line = $_; 29 | chomp $line; 30 | 31 | #print "$line"; 32 | #print "\n"; 33 | 34 | if ($line =~ /“/) { 35 | print STDERR "<"; 36 | # Substitute 37 | $line =~ s/“/"/g; 38 | }; 39 | if ($line =~ /”/) { 40 | print STDERR ">"; 41 | # Substitute 42 | $line =~ s/”/"/g; 43 | }; 44 | 45 | 46 | print $line . "\n"; 47 | }; 48 | print STDERR "finished\n"; 49 | -------------------------------------------------------------------------------- /runsgmlfix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # $Id$ 4 | # 5 | # Small helper script to fix broken SGML code 6 | # 7 | # (P) & (C) by Peter Bieringer 8 | # 9 | # 20020119/PB: initial 10 | 11 | if [ -z "$1" ]; then 12 | FILE_SGML="Linux+IPv6-HOWTO.sgml" 13 | else 14 | FILE_SGML="$1" 15 | fi 16 | 17 | FILE_LYX="`basename $FILE_SGML .sgml`.lyx" 18 | FILE_TMP="tmp.sgml" 19 | 20 | PROG_FIX_TABLETAG="sgmllyxtabletagfix.pl" 21 | PROG_FIX_QUOTE="sgmllyxquotefix.pl" 22 | 23 | if [ "$FILE_LYX" -nt "$FILE_SGML" ]; then 24 | echo "ERR : LyX file '$FILE_LYX' is newer than SGML file '$FILE_SGML' - forgot to export?" 25 | exit 1 26 | fi 27 | 28 | if [ -f "$FILE_TMP" ]; then 29 | echo "INF : Temporary file exists, remove it!" 30 | rm "$FILE_TMP" 31 | fi 32 | 33 | if [ -f "$FILE_TMP" ]; then 34 | echo "ERR : Ooops, temporary file still exists!" 35 | exit 1 36 | fi 37 | 38 | echo "INF : Fix SGML now" 39 | cat "$FILE_SGML" | ./$PROG_FIX_TABLETAG | ./$PROG_FIX_QUOTE >$FILE_TMP 40 | 41 | echo "INF : Remove old SGML file '$FILE_SGML'" 42 | rm "$FILE_SGML" 43 | 44 | echo "INF : Rename temporary file to '$FILE_SGML'" 45 | mv "$FILE_TMP" "$FILE_SGML" 46 | 47 | 48 | -------------------------------------------------------------------------------- /lyxcodelinewrapper.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # $Id$ 4 | # 5 | # LyX codeline wrapper tool 6 | # 7 | # (P) & (C) 2002-2009 by Peter Bieringer 8 | # 9 | # Published under the GNU GPL licence 10 | # 11 | # Takes LyX code from stdin and pipes a modified to stdout. 12 | # Wraps length of code lines to a given limit. 13 | # Marks second and next lines with a given character. 14 | # 15 | # Attention: no warranty that the new LyX code is very well! 16 | # Use diff to check proper work 17 | # 18 | # Changes: 19 | # 20020118: Initial try 20 | # 20020119: Improve tool, do not touch code lines including LyX tags 21 | # 20090214/PB: adjustments for LyX format 345 22 | # 23 | # Known bugs: 24 | # * Sure some 25 | # 26 | # Known limitations: 27 | # * Code lines containing LyX tags are currently not supported and skipped 28 | 29 | my $lyx_format_supported = "474"; 30 | 31 | sub print_long_line ($); 32 | 33 | my $TAG_CODE = 0; 34 | my $line_carry = ""; 35 | my $lines_original = ""; 36 | my $line_limit = 79; 37 | #my $linebreakchar = chr(172); 38 | my $linebreakchar = "¬"; # UTF-8 support 39 | 40 | #my $debug = 1; 41 | my $debug = 0; 42 | 43 | while () { 44 | my $line = $_; 45 | chomp $line; 46 | 47 | #print "$line"; 48 | #print "\n"; 49 | # 50 | if ($line =~ /^\\lyxformat ([0-9]+)$/) { 51 | if ($1 ne $lyx_format_supported) { 52 | die "Lyx format not supported: $1"; 53 | }; 54 | } elsif ($line =~ /^\\begin_layout Code$/ && $TAG_CODE != 1) { 55 | print STDERR "INF: Code tag starts\n"; 56 | $TAG_CODE = 1; 57 | $line_carry = ""; 58 | $lines_original = ""; 59 | next; 60 | } elsif ($line =~ /^\\end_layout$/ && $TAG_CODE == 1) { 61 | print STDERR "INF: Code tag ends\n"; 62 | 63 | if ($lines_original =~ /\\/) { 64 | # Ooops, lines contain a LyX tag, currently not supported, so let it be 65 | #print STDERR "WARN: Lines contain LyX code tag, let it like it is\n: '$lines_original'"; 66 | print STDERR "WARN: Lines contain LyX code tag, let it like it is\n"; 67 | if ($debug & 0x01) { print "G"; }; 68 | print "\\begin_layout Code" . "\n" . $lines_original . "\\end_layout" . "\n"; 69 | } elsif ($lines_original =~ /$linebreakchar/) { 70 | # Code line already wrapped 71 | print STDERR "INF: Code line already wrapped, let it like it is\n"; 72 | if ($debug & 0x01) { print "F"; }; 73 | print "\\begin_layout Code" . "\n" . $lines_original . "\\end_layout" . "\n"; 74 | } else { 75 | print_long_line $line_carry; 76 | }; 77 | 78 | $TAG_CODE = 0; 79 | $line_carry = ""; 80 | $lines_original = ""; 81 | next; 82 | } elsif ($line =~ /^\\layout/ && $TAG_CODE == 1) { 83 | die "unsupported"; 84 | print STDERR "INF: Code tag ends\n"; 85 | 86 | if ($lines_original =~ /\\/) { 87 | # Ooops, lines contain a LyX tag, currently not supported, so let it be 88 | #print STDERR "WARN: Lines contain LyX code tag, let it like it is\n: '$lines_original'"; 89 | print STDERR "WARN: Lines contain LyX code tag, let it like it is\n"; 90 | if ($debug & 0x01) { print "A"; }; 91 | print "\\begin_layout Code" . "\n" . $lines_original; 92 | } elsif ($lines_original =~ /$linebreakchar/) { 93 | # Code line already wrapped 94 | print STDERR "INF: Code line already wrapped, let it like it is\n"; 95 | if ($debug & 0x01) { print "B"; }; 96 | print "\\begin_layout Code" . "\n" . $lines_original; 97 | } else { 98 | print_long_line $line_carry; 99 | }; 100 | 101 | $line_carry = ""; 102 | $lines_original = ""; 103 | $TAG_CODE = 0; 104 | print $line . "\n"; 105 | next; 106 | }; 107 | 108 | if ($TAG_CODE != 1) { 109 | print $line . "\n"; 110 | } else { 111 | $lines_original .= $line . "\n"; 112 | 113 | if ($line eq "") { 114 | # empty lines are skipped here 115 | next; 116 | }; 117 | 118 | print STDERR "INF: Found code line: '" . $line . "'\n"; 119 | $line_carry .= $line; 120 | }; 121 | }; 122 | 123 | sub print_long_line ($){ 124 | my $line = shift; 125 | print STDERR "INF: Print code line: '" . $line . "'\n"; 126 | 127 | my $l = 0; 128 | my $c = ""; 129 | 130 | if (length($line) == 0) { 131 | if ($debug & 0x01) { print "C"; }; 132 | my $s = "\\begin_layout Code" . "\n" . "\n" . "\\end_layout" . "\n"; 133 | print $s; 134 | return; 135 | }; 136 | 137 | while ($l < length($line)) { 138 | my $t = 0; 139 | print STDERR "INF: Step: $l\n"; 140 | 141 | if ($l == 0) { 142 | $c = ""; 143 | } else { 144 | $c =$linebreakchar; 145 | } 146 | 147 | if (length($line) - $l <= $line_limit) { 148 | if ($debug & 0x01) { print "D"; }; 149 | my $s = "\\begin_layout Code" . "\n" . $c . substr($line, $l) . "\n" . "\\end_layout" . "\n"; 150 | print STDERR "INF: Step end\n"; 151 | print $s; 152 | print STDERR $s; 153 | last; 154 | }; 155 | 156 | for ($t = $line_limit; $t > 0; $t--) { 157 | if (substr($line, $l + $t, 1) eq " ") { 158 | print STDERR "INF: Found at pos: $t\n"; 159 | last; 160 | }; 161 | }; 162 | 163 | if ($t == 0) { $t = $line_limit }; 164 | print STDERR "INF: Start printing l=$l t=$t\n"; 165 | if ($debug & 0x01) { print "E"; }; 166 | my $s = "\\begin_layout Code" . "\n" . $c . substr($line, $l, $t) . "\n" . "\\end_layout" . "\n\n"; 167 | print $s; 168 | print STDERR $s; 169 | $l = $l + $t; 170 | }; 171 | }; 172 | 173 | print STDERR "\n\nWARNING: check code using utility 'diff' for proper LyX output!\n"; 174 | -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # (P) & (C) 2011 - 2011 by Dr. Peter Bieringer 4 | # 5 | # Wrapper script for HOWTO generator script 6 | # 7 | # Requires: "generate.sh" 8 | # 9 | # Changelog 10 | # 11 | # 12 | # 20110511/PB: use absolute paths, extend error checking 13 | 14 | 15 | URL_BASE="http://cvs.tldp.org/go.to/LDP/LDP/users/Peter-Bieringer/" 16 | 17 | FILE_EN="Linux+IPv6-HOWTO.sgml" 18 | FILE_DE="Linux+IPv6-HOWTO.de.sgml" 19 | FILE_FR="Linux+IPv6-HOWTO.fr.sgml" 20 | FILE_PT_BR="Linux+IPv6-HOWTO.pt_BR.sgml" 21 | 22 | options_wget="--quiet" 23 | 24 | DIR_BASE="$HOME/howtos" 25 | DIR_DOWNLOAD="$HOME/howtos/download" 26 | 27 | DIR_DEST_BASE="/var/www/html/howtos" 28 | 29 | ## logging 30 | log() { 31 | local level="$1" 32 | shift 33 | 34 | printf "%-6s: %s\n" "$level" "$*" 35 | } 36 | 37 | ## download file 38 | download() { 39 | local url_base="$1" 40 | local file="$2" 41 | 42 | if [ -z "$url_base" ]; then 43 | log "ERROR" "'url_base' empty" 44 | return 1 45 | fi 46 | 47 | if [ -z "$file" ]; then 48 | log "ERROR" "'file' empty" 49 | return 1 50 | fi 51 | 52 | if [ -z "$DIR_DOWNLOAD" ]; then 53 | log "ERROR" "no download directory given" 54 | return 1 55 | fi 56 | 57 | if [ ! -d "$DIR_DOWNLOAD" ]; then 58 | log "ERROR" "download directory doesn't exist: $DIR_DOWNLOAD" 59 | return 1 60 | fi 61 | 62 | if [ "$force_download" != "1" ]; then 63 | log "NOTICE" "skip download $url_base/$file (use option -d)" 64 | return 0 65 | fi 66 | 67 | log "INFO" "start download $url_base/$file to directory $DIR_DOWNLOAD" 68 | wget $options_wget -N -P "$DIR_DOWNLOAD" "$url_base/$file" 69 | local result=$? 70 | if [ $result -eq 0 ]; then 71 | log "INFO" "download successful: $url_base/$file (stored to $DIR_DOWNLOAD)" 72 | else 73 | log "ERROR" "download not successful: $url_base/$file" 74 | fi 75 | 76 | return $result 77 | } 78 | 79 | ## check, whether processing should be started 80 | check() { 81 | local file_download="$1" 82 | local file="$2" 83 | local dir_html="$3" 84 | 85 | if [ -z "$file" ]; then 86 | log "ERROR" "'file' empty" 87 | return 1 88 | fi 89 | 90 | if [ -z "$file_download" ]; then 91 | log "ERROR" "'file_download' empty" 92 | return 1 93 | fi 94 | 95 | if [ -z "$dir_html" ]; then 96 | log "ERROR" "'dir_html' empty" 97 | return 1 98 | fi 99 | 100 | log "INFO" "check file: $file" 101 | 102 | if [ ! -f "$file_download" ]; then 103 | log "WARN" "no downloaded file available: $file_download" 104 | return 1 105 | fi 106 | 107 | if [ ! -f "$file" ]; then 108 | log "NOTICE" "no 'old' file available: $file (copy now)" 109 | cp -p "$file_download" "$file" 110 | if [ $? -ne 0 ]; then 111 | log "ERROR" "can't copy 'new' file to 'old' file: $file_download -> $file" 112 | return 1 113 | fi 114 | 115 | return 0 116 | else 117 | if cmp -s "$file_download" "$file"; then 118 | log "INFO" "'old' is identical with 'new' file: $file" 119 | else 120 | log "NOTICE" "'old' is not equal with 'new' file: $file" 121 | cp -p "$file_download" "$file" 122 | if [ $? -ne 0 ]; then 123 | log "ERROR" "can't copy 'new' file to 'old' file: $file_download -> $file" 124 | return 1 125 | fi 126 | return 0 127 | fi 128 | # check contents of destination directory 129 | log "INFO" "check directory: $dir" 130 | 131 | if [ ! -d "$dir" ]; then 132 | log "NOTICE" "directory still not exist: $dir" 133 | return 0 134 | fi 135 | 136 | local num_files="`find "$dir" -mindepth 1 -maxdepth 1 -type f | wc -l`" 137 | if [ $num_files -eq 0 ]; then 138 | # directory is empty 139 | log "NOTICE" "directory is empty: $dir" 140 | return 0 141 | fi 142 | 143 | local num_files_old="`find "$dir" -mindepth 1 -maxdepth 1 -type f ! -newer "$file" | wc -l`" 144 | if [ $num_files_old -ne 0 ]; then 145 | # force regeneration 146 | log "NOTICE" "directory contains old files: $dir ($num_files_old)" 147 | return 0 148 | fi 149 | 150 | # 'old' file already exists 151 | if [ "$file" -nt "$file_download" ]; then 152 | log "WARN" "'old' is newer than 'new' file: $file" 153 | return 1 154 | fi 155 | fi 156 | 157 | if [ "$force_generate" = "1" ]; then 158 | log "NOTICE" "force regeneration of: $file" 159 | return 0 160 | fi 161 | 162 | # nothing to do 163 | log "DEBUG" "no indication for start processing file found: $file" 164 | return 1 165 | } 166 | 167 | ## process/generate output 168 | process() { 169 | log "INFO" "start processing file: $file" 170 | pushd $DIR_BASE >/dev/null || return 1 171 | ./generate.sh "$file" 172 | local result=$? 173 | popd >/dev/null 174 | if [ $result -ne 0 ]; then 175 | log "ERROR" "processing of file not successful: $file" 176 | return 1 177 | fi 178 | 179 | log "INFO" "processing of file successful: $file" 180 | } 181 | 182 | 183 | ## copy output 184 | copy() { 185 | local file="$1" 186 | 187 | if [ -z "$DIR_DEST_BASE" ]; then 188 | log "ERROR" "destination directory for output not given 'DIR_DEST_BASE'" 189 | fi 190 | 191 | if [ ! -d "$DIR_DEST_BASE" ]; then 192 | log "ERROR" "destination directory for output doesn't exist: $DIR_DEST_BASE" 193 | return 1 194 | fi 195 | 196 | log "INFO" "start syncing files of master file: $file" 197 | 198 | local file_pdf="${file/.sgml/.pdf}" 199 | local file_html="${file/.sgml/.html}" 200 | local dir_html="${file/.sgml}" 201 | 202 | local file_base="`basename "${file/.sgml}"`" 203 | 204 | local file_dest_pdf="$DIR_DEST_BASE/${file_base}.pdf" 205 | local file_dest_html="$DIR_DEST_BASE/${file_base}.html" 206 | local dir_dest_html="$DIR_DEST_BASE/$file_base" 207 | 208 | local file_dest_status="$DIR_DEST_BASE/${file_base}.last" 209 | 210 | log "INFO" "copy PDF file: $file_pdf" 211 | cp -p "$file_pdf" "$file_dest_pdf" 212 | if [ $? -ne 0 ]; then 213 | log "ERROR" "can't copy PDF file: $file_pdf" 214 | return 1 215 | fi 216 | 217 | if [ ! -f "$file_dest_pdf" ]; then 218 | log "ERROR" "destination PDF file is not a file or doesn't exist: $file_dest_pdf" 219 | return 1 220 | fi 221 | 222 | chmod 644 "$file_dest_pdf" 223 | if [ $? -ne 0 ]; then 224 | log "ERROR" "can't adjust permissions of PDF file: $file_dest_pdf" 225 | return 1 226 | fi 227 | 228 | log "INFO" "copy HTML file: $file_html" 229 | cp -p "$file_html" "$file_dest_html" 230 | if [ $? -ne 0 ]; then 231 | log "ERROR" "can't copy HTML file: $file_html" 232 | return 1 233 | fi 234 | 235 | if [ ! -f "$file_dest_html" ]; then 236 | log "ERROR" "destination HTML file is not a file or doesn't exist: $file_dest_html" 237 | return 1 238 | fi 239 | 240 | chmod 644 "$file_dest_html" 241 | if [ $? -ne 0 ]; then 242 | log "ERROR" "can't adjust permissions of HTML file: $file_dest_html" 243 | return 1 244 | fi 245 | 246 | if [ ! -d "$dir_html" ]; then 247 | log "ERROR" "source directory for HTML doesn't exist: $dir_html" 248 | return 1 249 | fi 250 | 251 | if [ ! -d "$dir_dest_html" ]; then 252 | log "ERROR" "destination directory for HTML doesn't exist: $dir_dest_html" 253 | return 1 254 | fi 255 | 256 | if [ ! -w "$dir_dest_html" ]; then 257 | log "ERROR" "destination directory for HTML isn't writable: $dir_dest_html" 258 | return 1 259 | fi 260 | log "INFO" "copy HTML directory: $dir_html -> $dir_dest_html" 261 | rsync --delete -r "$dir_html/" "$dir_dest_html/" 262 | if [ $? -ne 0 ]; then 263 | log "ERROR" "can't sync HTML dir: $dir_html" 264 | return 1 265 | fi 266 | 267 | log "INFO" "update status file: $file_dest_status" 268 | touch "$file_dest_status" 269 | if [ $? -ne 0 ]; then 270 | log "ERROR" "can't update status file: $file_dest_status" 271 | return 1 272 | fi 273 | } 274 | 275 | 276 | 277 | 278 | 279 | ## main 280 | main() { 281 | for file in $*; do 282 | download "$URL_BASE" "$file" 283 | if [ $? -ne 0 ]; then 284 | continue 285 | fi 286 | 287 | dir="$DIR_BASE/${file/.sgml}" 288 | 289 | check "$DIR_DOWNLOAD/$file" "$DIR_BASE/$file" "$dir" 290 | if [ $? -eq 0 ]; then 291 | process "$DIR_BASE/$file" 292 | fi 293 | 294 | copy "$DIR_BASE/$file" 295 | done 296 | } 297 | 298 | 299 | # parse options 300 | while getopts "dg" opt; do 301 | case $opt in 302 | d) 303 | force_download=1 304 | ;; 305 | g) 306 | force_download=1 307 | force_generate=1 308 | ;; 309 | \?) 310 | echo "Invalid option: -$OPTARG" >&2 311 | ;; 312 | esac 313 | done 314 | 315 | shift $((OPTIND-1)) 316 | 317 | case $1 in 318 | 'de') 319 | files="$FILE_DE" 320 | ;; 321 | 'en') 322 | files="$FILE_EN" 323 | ;; 324 | 'fr') 325 | files="$FILE_FR" 326 | ;; 327 | 'pt') 328 | files="$FILE_PT_BR" 329 | ;; 330 | 'all') 331 | files="$FILE_EN $FILE_DE $FILE_FR $FILE_PT_BR" 332 | ;; 333 | esac 334 | 335 | main $files 336 | -------------------------------------------------------------------------------- /generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # (P) & (C) 2003-2017 by Dr. Peter Bieringer 4 | # 5 | # Generator script 6 | # 7 | # $Id: $ 8 | # 9 | # Requires: htmldoc recode docbook-utils-pdf 10 | # 11 | # Changelog 12 | # 13 | # 20020117/PB: review 14 | # 20020128/PB: change PDF generation to LDP conform one, PS is still not LDP conform 15 | # 20070401/PB: disable sgmlfixer (no longer needed) 16 | # add support for XML file, replace nsgmls by onsgmls 17 | # 20090214/PB: remove tag from SGML, onsgmls don't like it 18 | # 20090523/PB: extend required binary check 19 | # 20091220/PB: catch recode problem 20 | # 20110508/PB: force UTF-8 as input format to fix mixed charset problems in HTML 21 | # renice whole script 22 | # support also ldp.dsl stored in same directory as the script 23 | # 20110509/PB: add charset meta header on each html page to force UTF-8 24 | # 20161215/PB: remove VGWort URL appender 25 | # 20170303/PB: add stylesheet hacks based on input from Mike Wright 26 | 27 | loglevel=6 28 | 29 | # parse options 30 | while getopts "ql:" opt; do 31 | case $opt in 32 | q) 33 | loglevel=4 34 | ;; 35 | l) 36 | loglevel=$OPTARG 37 | echo "INFO : set loglevel to: $loglevel" 38 | ;; 39 | \?) 40 | echo "Invalid option: -$OPTARG" >&2 41 | ;; 42 | esac 43 | done 44 | 45 | shift $((OPTIND-1)) 46 | 47 | if [ -z "$1" ]; then 48 | file_input="Linux+IPv6-HOWTO.sgml" 49 | #file_input="Linux+IPv6-HOWTO.xml" 50 | else 51 | file_input="$1" 52 | fi 53 | 54 | if echo "$file_input" | grep -q ".sgml$"; then 55 | # ok, SGML 56 | true 57 | elif echo "$file_input" | grep -q ".xml$"; then 58 | # ok, XML 59 | true 60 | else 61 | echo "ERR: file is not a SGML/XML file: $file_input" 62 | exit 1 63 | fi 64 | 65 | if head -1 "$file_input" |grep -q DOCTYPE ; then 66 | doctype="SGML" 67 | elif head -1 "$file_input" |grep -q "xml version" ; then 68 | doctype="XML" 69 | else 70 | echo "ERR: file is not a SGML file: $file_input" 71 | exit 1 72 | fi 73 | 74 | echo "Used SGML file: $file_input" 75 | 76 | file_base="${file_input%.*}" 77 | 78 | ONSGMLS="/usr/bin/onsgmls" 79 | JADE="/usr/bin/jade" 80 | DB2PS="/usr/bin/db2ps" 81 | DB2PDF="/usr/bin/db2pdf" 82 | LDP_PRINT="/usr/local/bin/ldp_print" 83 | PS2ASCII="/usr/bin/ps2ascii" 84 | RECODE="/usr/bin/recode" 85 | HTMLDOC="/usr/bin/htmldoc" 86 | 87 | #LDP_PDFPS="yes" 88 | 89 | checklist_bin="ONSGMLS JADE DB2PS DB2PDF PS2ASCII RECODE HTMLDOC" 90 | 91 | if [ "$LDP_PDFPS" = "yes" ]; then 92 | checklist_bin="$checklist_bin LDP_PRINT" 93 | fi 94 | 95 | 96 | file_ps="$file_base.ps" 97 | file_pdf="$file_base.pdf" 98 | file_txt="$file_base.txt" 99 | file_html="$file_base.html" 100 | 101 | file_ldpdsl="/usr/local/share/sgml/dsssl/ldp.dsl" 102 | if [ ! -f $file_ldpdsl ]; then 103 | # try local stored one 104 | file_ldpdsl="`dirname $0`" 105 | if [ "$file_ldpdsl" = "." ]; then 106 | file_ldpdsl="`pwd`" 107 | fi 108 | file_ldpdsl="$file_ldpdsl/ldp.dsl" 109 | fi 110 | 111 | file_xmldcl="/usr/share/sgml/xml.dcl" 112 | dir_dssslstylesheets="/usr/share/sgml/docbook/dsssl-stylesheets" 113 | 114 | if [ ! -f "$file_ldpdsl" ]; then 115 | echo "ERR: Missing DSL file: $file_ldpdsl" 116 | exit 1 117 | fi 118 | 119 | 120 | if [ ! -f $file_input ]; then 121 | echo "ERR: Missing SGML file, perhaps export DocBook of LyX won't work" 122 | exit 1 123 | fi 124 | 125 | # look for required files 126 | for f in $file_ldpdsl $file_xmldcl; do 127 | if [ ! -e $f ]; then 128 | echo "Missing file: $f" 129 | exit 1 130 | fi 131 | done 132 | 133 | # look for required binaries 134 | for name in $checklist_bin; do 135 | f="${!name}" 136 | 137 | if [ ! -e $f ]; then 138 | echo "Missing file: $f ($name)" 139 | exit 1 140 | fi 141 | if [ ! -x $f ]; then 142 | echo "Cannot executue: $f ($name)" 143 | exit 1 144 | fi 145 | done 146 | 147 | # run sgmlfix 148 | #if [ -e ./runsgmlfix.sh ]; then 149 | # ./runsgmlfix.sh "$file_input" 150 | #else 151 | # echo "WARN: cannot execute 'runsgmlfix.sh'" 152 | #fi 153 | 154 | export SP_ENCODING=UTF-8 155 | export SP_CHARSET_FIXED=yes 156 | 157 | ## Functions 158 | validate_sgml() { 159 | # remove tags , 160 | perl -pi -e 's|||g' "$file_input" 161 | 162 | echo "INFO : Validate SGML/XML code '$file_input'" 163 | if [ "$doctype" = "XML" ]; then 164 | local options="$file_xmldcl" 165 | fi 166 | [ $loglevel -ge 7 ] && set -x 167 | 168 | $ONSGMLS -s $options $file_input 169 | local retval=$? 170 | [ $loglevel -ge 7 ] && set +x 171 | if [ $retval -gt 0 ]; then 172 | echo "ERR: Validation results in errors!" 173 | return 1 174 | else 175 | echo "INFO : Validation was successfully" 176 | fi 177 | } 178 | 179 | create_html_multipage() { 180 | echo "INFO : Create HTML multipages" 181 | if [ ! -d "$file_base" ]; then 182 | mkdir "$file_base" || exit 1 183 | fi 184 | pushd "$file_base" >/dev/null || exit 1 185 | rm -f * 186 | [ $loglevel -ge 7 ] && set -x 187 | $JADE -t sgml -i html -D $dir_dssslstylesheets -d "${file_ldpdsl}#html" ../$file_input 188 | local retval=$? 189 | [ $loglevel -ge 7 ] && set +x 190 | 191 | style_multipage=$(cat </dev/null 220 | return $retval 221 | } 222 | 223 | create_html_singlepage() { 224 | echo "INFO : Create HTML singlepage '$file_html' from '$file_input'" 225 | [ $loglevel -ge 7 ] && set -x 226 | $JADE -t sgml -i html -V nochunks -d "${file_ldpdsl}#html" $file_input >$file_html 227 | local retval=$? 228 | [ $loglevel -ge 7 ] && set +x 229 | 230 | style_singlepage=$(cat <