From: Rob H. <for...@us...> - 2003-01-06 09:02:30
|
Update of /cvsroot/sandweb/sandweb/tools In directory sc8-pr-cvs1:/tmp/cvs-serv2901/tools Modified Files: install_script.pl instimages.pl Log Message: made it possible to install the image dir as part of the standard sandweb install, also backed the logo image out of framework.html ( need to investigate the ramifications of this more ) Index: install_script.pl =================================================================== RCS file: /cvsroot/sandweb/sandweb/tools/install_script.pl,v retrieving revision 1.19 retrieving revision 1.20 diff -U2 -r1.19 -r1.20 --- install_script.pl 6 Jan 2003 08:15:20 -0000 1.19 +++ install_script.pl 6 Jan 2003 09:02:27 -0000 1.20 @@ -23,5 +23,5 @@ my $cfgdir = $config::cfgdir || '/usr/local/etc'; my $cgidir = $config::cgidir || '/var/www/cgi-bin'; -my $imgdir = $config::cgidir || '/var/www/images'; +my $imgdir = $config::imgdir || '/var/www/images'; my $tmpldir = $config::tmpldir || "$PREFIX/lib/sandweb/templates"; my $cachedir = $config::cachedir || '/var/cache/sandweb'; @@ -89,5 +89,5 @@ # Images -$cgidir = instimages($imgdir); +$imgdir = instimages($imgdir); exit(3) if (!$imgdir); @@ -121,6 +121,4 @@ # updating config file -system('tools/change-entry.pl', "$cfgdir/sandweb.cfg", 'image_dir="/images"', "image_dir=\"$imgdir\""); -system('tools/change-entry.pl', "$cfgdir/sandweb.cfg", 'cgi_path="/cgi-bin"', "cgi_path=\"$cgidir\""); system('tools/change-entry.pl', "$cfgdir/sandweb.cfg", 'template_dir="../templates"', "template_dir=\"$tmpldir\""); system('tools/change-entry.pl', "$cfgdir/sandweb.cfg", 'log_dir="../var/log"', "log_dir=\"$logdir\""); @@ -179,4 +177,5 @@ print CFG '$cfgdir = ' . "'$cfgdir';\n"; print CFG '$cgidir = ' . "'$cgidir';\n"; +print CFG '$imgdir = ' . "'$imgdir';\n"; print CFG '$tmpldir = ' . "'$tmpldir';\n"; print CFG '$cachedir = ' . "'$cachedir';\n"; Index: instimages.pl =================================================================== RCS file: /cvsroot/sandweb/sandweb/tools/instimages.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -U2 -r1.1 -r1.2 --- instimages.pl 6 Jan 2003 08:15:19 -0000 1.1 +++ instimages.pl 6 Jan 2003 09:02:28 -0000 1.2 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w # -# instimages.pl : script for installing sandweb images +# instimages.pl : script for installing SandWeb images # @@ -8,10 +8,10 @@ my $imgdir = $_[0]; - if (!$imgdir) { - print("-------------------------------\n"); - print("Installing SandWeb images...\n\n"); - print("Specify the location you wish to install the SandWeb images.\n"); + if (!-d $imgdir) { + print("-------------------------\n"); + print("Installing images...\n\n"); + print("Specify the location you wish to install the images.\n"); print("Enter the full path [default: $imgdir] : "); - + my $tmp = ''; chomp($tmp = <STDIN>); @@ -20,25 +20,32 @@ } } + print("Installing images into $imgdir... "); - if (system('tools/mkdirto.pl', '755', "$imgdir")) { - return(0); + my $create = 1; + if (!-d $imgdir) { + $tmp = 'y'; + print("That directory does not exist, do you wish to create it?(Y/n): "); + chomp($tmp = <STDIN>); + if (($tmp eq 'n') || ($tmp eq 'N')) { + # exiting + return(0); + } + system('tools/mkdirto.pl', 755, $imgdir); } - - print("Installing SandWeb images into $imgdir... "); - + opendir(DIR, "images/"); - my @files = readdir(DIR); - closedir(DIR); - - foreach my $filename (@files) { - next if (($filename !~ /\.html$/) && ($filename !~ /\.js$/)); - if (system('cp', "images/$filename", "$imgdir/")) { - print("working directory: ", `pwd`); - return(0); + my @files = readdir(DIR); + closedir(DIR); + + foreach my $filename (@files) { + next if ($filename !~ /\.png$/); + if (system('cp', "images/$filename", "$imgdir/")) { + print("working directory: ", `pwd`); + return(0); } } - print("done.\n"); return($imgdir); -} +} + 1; |