summaryrefslogtreecommitdiff
path: root/SL2LS.pl
blob: 3a04c3344d3e1ba6a8d835cff90520964cec506a (plain)
  1. #!/usr/bin/perl
  2. # http://www.ledgersmb.org/
  3. #
  4. # Simple script. Right now, all that needs to be done is that the SL directory
  5. # needs to be deleted and the sql-ledger.conf needs to be renamed.
  6. $filedie =
  7. "To install manually:\n"
  8. . " Rename the sql-ledger.conf to ledger-smb.conf\n"
  9. . " Delete the SL directory (optional but HIGHLY recommended)\n";
  10. open( SL, "< sql-ledger.conf" )
  11. || die("Could not open sql-ledger.conf: $! \n\n $filedie");
  12. open( LS, "> ledger-smb.conf" )
  13. || die("Could not open ledger-smb.conf: $! \n $filedie");
  14. while ( $line = <SL> ) {
  15. print LS $line;
  16. }
  17. unlink "sql-ledger.conf";
  18. #TODO: Move/Delete the SL directory
  19. &recursive_unlink("SL");
  20. sub recursive_unlink {
  21. ($dir) = shift @_;
  22. print "Recursively deleting $dir\n";
  23. opendir( DIR, $dir );
  24. while ( $file = readdir DIR ) {
  25. if ( $file !~ /^\.+$/ ) {
  26. $file = "$dir/$file";
  27. if ( -f $file ) {
  28. unlink $file;
  29. }
  30. elsif ( -d $file ) {
  31. &recursive_unlink("$file");
  32. }
  33. }
  34. }
  35. closedir(DIR);
  36. print "Removing $dir\n";
  37. rmdir $dir;
  38. }