summaryrefslogtreecommitdiff
path: root/SL2LS.pl
blob: af2d46080ad417d6b581ebe592734ddd26ca6cb4 (plain)
  1. #!/usr/bin/perl
  2. # http://sourceforge.net/projects/ledger-smb/
  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 = "To install manually:\n" .
  7. "rename the sql-ledger.conf to ledger-smb.conf\n ".
  8. "Delete the SL directory (optional but HIGHLY recommended)\n";
  9. open (SL, "< sql-ledger.conf") || die (
  10. "Could not open sql-ledger.conf: $! \n $filedie");
  11. open (LS, "> ledger-smb.conf") || die (
  12. "Could not open ledger-smb.conf: $! \n $filedie");
  13. while ($line = <SL>){
  14. print LS $line;
  15. }
  16. unlink "sql-ledger.conf";
  17. #TODO: Move/Delete the SL directory
  18. &recursive_unlink("SL");
  19. sub recursive_unlink {
  20. ($dir) = shift @_;
  21. print "Recursively deleting $dir\n";
  22. opendir (DIR, $dir);
  23. while ($file = readdir DIR){
  24. if ($file !~ /^\.+$/){
  25. $file = "$dir/$file";
  26. if (-f $file){
  27. unlink $file;
  28. } elsif (-d $file){
  29. &recursive_unlink("$file");
  30. }
  31. }
  32. }
  33. closedir(DIR);
  34. print "Removing $dir\n";
  35. rmdir $dir;
  36. }