An unfinished system to manage all your paper documentation in an easy way.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

install_db.pl 765B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/perl
  2. use strict;
  3. use lib '/opt/autodoc/lib';
  4. use Autodoc;
  5. use JSON;
  6. use DBI;
  7. use warnings;
  8. my $conf = load_conf("../etc/autodoc.json");
  9. print "!!! STOP !!!"x4 . "\n";
  10. print "!!! STOP !!!"x4 . "\n";
  11. print "!!! STOP !!!"x4 . "\n";
  12. print "!!! STOP !!!"x4 . "\n";
  13. print "Running this script on an existing setup WILL ERASE ALL YOUR DATA!!!\n\n";
  14. print "Are you sure you want to continue? [N/y] ";
  15. my $resp = <STDIN>;
  16. chomp $resp;
  17. if ( $resp !~ /^[yY]$/ ) {
  18. print "Ok, bye\n";
  19. exit;
  20. }
  21. print "Creating database schema\n";
  22. system(sprintf("cat %s/%s | mysql -u %s -h %s --password='%s' %s 2>/dev/null",
  23. $conf->{path}{global},
  24. 'etc/schema.sql',
  25. $conf->{sql}{user},
  26. $conf->{sql}{host},
  27. $conf->{sql}{pass},
  28. $conf->{sql}{base}
  29. ));
  30. print "All done\n";