comparison scripts/pkg/pkg.m @ 5993:401ca0de8506

[project @ 2006-09-15 21:51:25 by dbateman]
author dbateman
date Fri, 15 Sep 2006 21:51:25 +0000
parents f1375e3f3b97
children f542445f6b7a
comparison
equal deleted inserted replaced
5992:4289ed95dde8 5993:401ca0de8506
454 cd(wd); 454 cd(wd);
455 error("The pre-install function returned the following error: %s\n", lasterr); 455 error("The pre-install function returned the following error: %s\n", lasterr);
456 end_try_catch 456 end_try_catch
457 endif 457 endif
458 458
459 ## Create the installation directory 459 ## If the directory "inst" doesn't exist, we create it
460 [status, msg] = mkdir(desc.dir); 460 if (!exist([packdir "inst"], "dir"))
461 if (status != 1)
462 error("Couldn't create installation directory: %s\n", msg);
463 endif
464
465 ## If the directory "inst" doesn't exist, we create it
466 if (!exist([packdir "inst"], "dir"))
467 [status, msg] = mkdir([packdir "inst"]); 461 [status, msg] = mkdir([packdir "inst"]);
468 if (status != 1) 462 if (status != 1)
469 rm_rf(desc.dir); 463 rm_rf(desc.dir);
470 error("The 'inst' directory did not exist and could not be created: %s\n", msg); 464 error("The 'inst' directory did not exist and could not be created: %s\n", msg);
471 endif 465 endif
597 endfunction 591 endfunction
598 592
599 function copy_files (desc, packdir, bindir) 593 function copy_files (desc, packdir, bindir)
600 ## Copy the files from "inst" to installdir 594 ## Copy the files from "inst" to installdir
601 if (! dirempty([packdir "inst"])) 595 if (! dirempty([packdir "inst"]))
596 if (! exist (desc.dir, "dir"))
597 [status, output] = mkdir (desc.dir);
598 if (status != 1)
599 error("Couldn't create installation directory %s : %s\n",
600 desc.dir, output);
601 endif
602 endif
602 [status, output] = system(["cp -R " packdir "inst/* " desc.dir]); 603 [status, output] = system(["cp -R " packdir "inst/* " desc.dir]);
603 if (status != 0) 604 if (status != 0)
604 rm_rf(desc.dir); 605 rm_rf(desc.dir);
605 error("Couldn't copy files to the installation directory\n"); 606 error("Couldn't copy files to the installation directory\n");
606 endif 607 endif
617 ## Copy DESCRIPTION 618 ## Copy DESCRIPTION
618 [status, output] = system(["cp " packdir "DESCRIPTION " packinfo]); 619 [status, output] = system(["cp " packdir "DESCRIPTION " packinfo]);
619 if (status != 0) 620 if (status != 0)
620 rm_rf(desc.dir); 621 rm_rf(desc.dir);
621 error("Couldn't copy DESCRIPTION: %s\n", output); 622 error("Couldn't copy DESCRIPTION: %s\n", output);
623 endif
624
625 ## Copy COPYING
626 [status, output] = system(["cp " packdir "COPYING " packinfo]);
627 if (status != 0)
628 rm_rf(desc.dir);
629 error("Couldn't copy COPYING: %s\n", output);
622 endif 630 endif
623 631
624 ## Is there an INDEX file to copy or should we generate one? 632 ## Is there an INDEX file to copy or should we generate one?
625 if (exist([packdir "INDEX"], "file")) 633 if (exist([packdir "INDEX"], "file"))
626 [status, output] = system(["cp " packdir "INDEX " packinfo]); 634 [status, output] = system(["cp " packdir "INDEX " packinfo]);