File: setup-conflinks-perl

package info (click to toggle)
tetex-base 3.0.dfsg.3-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 239,592 kB
  • ctags: 10,610
  • sloc: xml: 103,461; perl: 9,398; ruby: 2,850; python: 1,551; php: 1,067; sh: 981; lisp: 494; makefile: 371; awk: 88
file content (148 lines) | stat: -rw-r--r-- 4,498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/perl
# 
# setup-conflinks, internal packaging script for tetex-base and -extra.
# $Id: setup-conflinks-perl 113 2005-08-04 15:02:54Z frn $
# The eperl code is taken from the auctex package, Copyright (C) 1999,
# 2000, 01, 02, 03, 04 by Davide Giovanni Maria Salvetti.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to: The Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# On Debian GNU/Linux System you can find a copy of the GNU General Public
# License in "/usr/share/common-licenses/GPL".
#
#
use strict;
use warnings;
use diagnostics;

use Getopt::Long;
use File::Basename;

###################################
#        internal Variables
###################################

my $progname = $0;
my $package;


###################################
#        teTeX Variables
###################################

my @base_conffiles = ( 
"tex/cslatex/fonttext.cfg", 
"tex/cslatex/hyphen.cfg", 
"tex/latex/base/latex209.cfg", 
"tex/latex/base/ltxdoc.cfg", 
"tex/latex/base/ltxguide.cfg", 
"tex/latex/base/texsys.cfg", 
"tex/latex/graphics/color.cfg", 
"tex/latex/graphics/graphics.cfg", 
"context/config/texexec.ini", 
"context/config/texexec.rme"
);
# $BASE_UCF is substituted by a space-separated list
# my $base_ucf = "mktex.cnf dvips/config.builtin35 updmap.d/00updmap.cfg dvipdfm/config language.dat generic/fontmath.cfg generic/fonttext.cfg generic/preload.cfg";
my @base_ucf = split / /, "mktex.cnf dvips/config.builtin35 updmap.d/00updmap.cfg dvipdfm/config language.dat generic/fontmath.cfg generic/fonttext.cfg generic/preload.cfg";

###################################
# Function definitions
###################################

sub usage () {
    print <<USAGE
setup-conflinks script

Usage: setup-conflinks --package=[base|extra]
USAGE
}

sub move_and_link {
    # if destination is /etc/texmf, second arg must be "."
    # third arg is optional
    my ($source, $dest, $newname, $too_many_args) = @_;

    die "$progname: function move_and_link called with too many arguments: @_" if $too_many_args;
    die "$progname: Not enough arguments, only got:" . ($source||"") unless $source && $dest;

    my $etcdir = "debian/$package/etc/texmf/";
    my $basedir = "debian/$package/usr/share/texmf/";
    my $sourcedir = $basedir . dirname($source);
    my $oldname = basename ($source);
    $source = "$sourcedir/$oldname";

    $newname = $oldname unless $newname;
    my $destdir = $etcdir . $dest;
    my $linkdir = "/etc/texmf/$dest";
    $dest = "$destdir/$newname";
    (my $linkdest = "$linkdir/$newname") =~ s@/./@/@;
 
    mkdir $destdir unless -d $destdir;
# condition negated for testing
    if (! -f $sourcedir || -d $source) {
	print "Source: $source,\n Dest: $dest\n";
	print "Linkdest: $linkdest\n";
# Commented for testing
#	rename $source, $dest or die "$progname: cannot move $source to $dest: $!";
#	symlink $linkdest, $source;
    } else {
	die "*** $progname: $source does not exit";
    };
}

###################################
# Here starts the main program
###################################


GetOptions ('package=s' => \$package );
$package = "tetex-$package";

for ($package) {
    if (/base/) {

# miscellaneous config files
	for my $conffile (@base_conffiles) {
	    ( my $destdir = dirname ($conffile) ) =~ s@^tex/@@;
	    $destdir  =~ s@/.*@@;
# commented for testing
#	    move_and_link $conffile, $destdir;
	};
	move_and_link "tex/generic/config", ".", "generic";

# ucf move
# commented for testing
# 	rename "debian/$package/usr/share/texmf/web2c/updmap.cfg",
#                "debian/$package/usr/share/texmf/web2c/00updmap.cfg" 
# 		 or die "debian/$package/usr/share/texmf/web2c/updmap.cfg not found";
	for (@base_ucf){print "$_\n"};
#	print "@base_ucf\n";
# 	for my $ucffile (){
# 	};
    }
    elsif (/extra/) {
	print "extra\n";
    }
    else { usage }
};

#print "$package\n";

# Local Variables:
# mode: cperl
# skeleton-pair: t
# End: