Sul sito Debian.org ho visto questa pagina dove si può generare tutti i tipi di copertine per cd e DVD delle release debian:
http://debian.semistable.com/cdcover.plMi sono domandato perchè non provo a fare qualcosa di simile sul mio spazio web per la distribuzione linux che utilizzo (Ubuntu) ?
Ho provato a costruire una pagina simile a quella di Debian al seguente indirizzo:
http://www.lucaguastalla.com/cgi-bin/cdcover.plPurtroppo non funziona, ottengo il seguente messaggio di errore:
Errore 500 - errore interno al server
Il server ha incontrato un errore interno o un problema di errata configurazione e non riesce a completare la richiesta inserita.
Questo errore può essere causato da uno script CGI non funzionante o da un file .htaccess contenente degli errori.
Questo è il contenuto del file cdcover.pl che ho modificato per gestire le versioni UBUNTU. Ho modificato anche i file eps e png con i loghi ubuntu utilizando gli stessi nomi di file.
#!/usr/bin/perl
use CGI qw/:standard/;
use strict;
use warnings;
my $css=<<END;
END
my $error = "";
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime time;
$year += 1900;
$mon += 1;
my $hostname = `hostname`;
my %release_names = ('4.10' => 'Warty Warthog',
'5.04' => 'Hoary Hedgehog',
'5.10' => 'Breezy Badger',
'6.06 LTS' => 'Dapper Drake',
'6.10' => 'Edgy Eft',
'7.04' => 'Feisty Fawn';
my @arches = ('i386', 'sparc', 'powerpc','amd64');
@arches = sort @arches;
my $xpos = 105.0;
my $ypos = 73.0;
if (param('ok')) {
my $log;
open($log, ">> types.log");
print $log param('file_type'), "\t",
param('output_type'), "\t",
param('release'), "\t",
param('printer_type'), "\n";
close $log;
# check the parameters, if they are ok generate the result, otherwise
# create error messages
# XXX check the date
# append errors like this: $error = li("testing");
unless ($error) {
# fix release codename based on version number
if (exists $release_names{param('release')}) {
param('codename', $release_names{param('release')});
}
elsif (param('release') eq 'unstable') {
param('codename', "");
}
# append snapshot if necessary
if (param('release') eq 'testing') {
param('set_type', param('set_type')." Snapshot");
}
elsif (param('release') eq 'unstable') {
param('set_type', param('set_type')." Snapshot");
}
# calculate position
if (param('label') eq 'Upper') {
$ypos = $ypos + 146;
}
param('offset_x', ($xpos + param('offset_x')) / 10.0);
param('offset_y', ($ypos - param('offset_y')) / 10.0);
# create the result
my $cmdline = "./cdlabelgen ";
if (param('printer_type') eq 'Color') {
$cmdline .= "-e openlogo-nd.eps -E openlogo.eps "
}
else {
$cmdline .= "-e openlogo-nd-bw.eps -E openlogo-bw.eps "
}
$cmdline .= "-c \"".param('operating_system')." ".
param('release')."\" ";
$cmdline .= "-s \"";
if (param('release') ne 'unstable') {
$cmdline .= "\\\"".param('codename')."\\\" ";
}
$cmdline .= param('set_type')." ".param('arch')."\" ";
if ((param('release') eq 'unstable') or
(param('release') eq 'testing')) {
$cmdline .= "-d \"".
param('year')."-".param('month')."-".param('day')."\" ";
}
else {
$cmdline .= "-D ";
}
$cmdline .= "--cd-in-set \"".param('cd')."\" ";
if (param('output_type') eq 'Slim CD Cover') {
$cmdline .= "-m ";
}
elsif (param('output_type') eq 'CD Envelope') {
$cmdline .= "-M ";
}
$cmdline .= "--centerx=\"".param('offset_x')."\" --centery=\"".
param('offset_y')."\" ";
if (param('output_type') eq 'CD Envelope') {
$cmdline .= "-S 2.5,-0.65,0.4 -T 0.75,-0.4,0.4 -b -t ";
}
else {
$cmdline .= "-S 2.5,-0.65,0.4 -T 0.75,-0.1,0.1 -b -t ";
}
if (param('output_type') eq 'CD Label') {
$cmdline .= "cdlabel.ps ";
if (param('file_type') eq 'PDF') {
$cmdline .= " | ps2pdf - -";
print header(-type=>'application/pdf',
-attachment=>'cdlabel.pdf');
}
else {
print header(-type=>'application/postscript',
-attachment=>'cdlabel.ps');
}
}
else {
$cmdline .= "cdcover.ps ";
if (param('file_type') eq 'PDF') {
$cmdline .= " | ps2pdf - -";
print header(-type=>'application/pdf',
-attachment=>'cdcover.pdf');
}
else {
print header(-type=>'application/postscript',
-attachment=>'cdcover.ps');
}
}
my $result = `$cmdline`;
print $result;
exit;
}
}
print header(), start_html(-title=>'Ubuntu Media Cover/Label Generator',
-style=>{-code=>$css}), h1(img {src=>"openlogo-nd-50.png",
align=>"right"},
" Ubuntu Media Cover/Label Generator"),
"<hr noshade style=\"color:black;background-color:black\">",
"This page will allow you to generate covers and labels for your Ubuntu ".
"media sets easily and with a common look. You just need to fill out the ".
"fields below, if anything is missing, if you have problems or suggestions ".
"don't hesitate to contact ".a({-href=>'mailto:lucaguastalla@hotmail.com'},
'Luca Guastalla <lucaguastalla@hotmail.com>'). ".", p;
if ($error) {
print font({-color=>'red'}, 'There are problems with your input, please correct
them and try again:'. ul($error)), p;
}
print startform("post", url(-relative=>1));
print table({-cellspacing=>"3", -cellpadding=>2},
Tr([
th({-colspan=>3, -align=>"left", -valign=>"top"}, "General options affecting the output:"),
# th({-bgcolor=>"#DDDDDD", -align=>"left", -valign=>"top"},"Paper Size:").
# td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
# -name=>'paper_size',
# length=>"24",
# -values=>['A4'],
# -default=>'A4')).
# td({-valign=>"top"}, "Currently only A4 is supported, Letter is on it's way"),
th({-bgcolor=>"#DDDDDD", -align=>"left", -valign=>"top"},"Printer Type:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'printer_type',
length=>"24",
-values=>['Color','Grayscale'],
-default=>'Color')).
td({-valign=>"top"}, "For enhanced contrast select \"Grayscale\" if you are not ".
"planning to print on a color printer"),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"File Type:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'file_type',
-values=>['Postscript', 'PDF'],
-default=>'PDF')).
td({-valign=>"top"}, "Postscript available too, make sure you don't apply any scaling when printing."),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Output Type:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'output_type',
-values=>['Normal CD Cover', 'Slim CD Cover',
'CD Envelope', 'CD Label'],
-default=>'Normal CD Cover')).
td("Currently only CD Covers are supported, CD Labels are a bit experimental"),
th({-colspan=>3, align=>"left", -valign=>"top"}, "How to label the Volume:"),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Operating System:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'operating_system',
-values=>['Ubuntu', 'Kubuntu','Edubuntu', 'Xubuntu'],
-default=>'Ubuntu')),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Release:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'release',
-values=>['4.10', '5.04', '5.10', '6.06 LTS', '6.10','7.04'],
-default=>'6.10')),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Set Type:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'set_type',
-values=>['Desktop', 'Server','Alternate'],
-default=>'Desktop')).
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Architecture:").
td({-valign=>"top"}, popup_menu(-style=>'width: 100%',
-name=>'arch',
-values=>[@arches],
-default=>'i386')),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"CD:").
td({-valign=>"top"}, textfield(-style=>'width: 100%',
-name=>'cd',
-default=>'Binary-1',
-size=>'22',
-maxlength=>40)),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top", -nowrap=>"yes"},"Date (YYYY-MM-DD):").
td({-valign=>"top", -nowrap=>"yes"}, popup_menu(
-name=>'year',
-values=>[(2004..2007)],
-default=>"$year")." - ".
popup_menu(
-name=>'month',
-values=>[(1..12)],
-default=>$mon)." - ".
popup_menu(
-name=>'day',
-values=>[(1..31)],
-default=>$mday)).
th({-colspan=>3, align=>"left", -valign=>"top"}, "Label-specific ".
"options:"),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Label:").
td({-valign=>"top", -nowrap=>"yes"},
popup_menu(-style=>'width: 100%',
-name=>'label',
-values=>['Upper', 'Lower'],
-default=>'Upper')),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Offset X [mm]:").
td({-valign=>"top"}, textfield(-style=>'width: 100%',
-name=>'offset_x',
-default=>'0'), td('mm')),
th({-bgcolor=>"#DDDDDD", align=>"left", -valign=>"top"},"Offset Y [mm]:").
td({-valign=>"top"}, textfield(-style=>'width: 100%',
-name=>'offset_y',
-default=>'0'), td('mm')),
td([""," "]),
td(["",submit(-style=>'width: 100%',
-name=>'ok',
-value=>'Ok')]).
td({-valign=>"top"}, "Don't forget to give me some <a href=\"mailto:lucaguastalla\@hotmail.com\">feedback</a> on how to improve this service, especially if you are using the labels!"),
]));
print endform;
print end_html;