let's not name these differently than the emig.d/ counterparts
[migration-tools.git] / kmig.d / bin / kmig-iconv
diff --git a/kmig.d/bin/kmig-iconv b/kmig.d/bin/kmig-iconv
deleted file mode 100755 (executable)
index 455e91a..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/perl -w
-###############################################################################
-=pod
-
-=head1 NAME
-
-kmig-iconv 
-
-Attempts to invoke B<iconv> on the specified tracked file, placing the
-output in [file].iconv
-
-If given no other arguments, the invocation will lool like
-
-=over 5
-
-iconv -f ISO-8859-1 -t UTF-8 -o <file>.utf8 <file>
-
-=back
-
-otherwise, the arguments will be passed through like so
-
-=over 5
-
-iconv [other arguments...] -o <file>.utf8 <file>
-
-=back
-
-You'll need to invoke B<kmig-add> prior to using commands like B<kmig-iconv>
-
-=head1 SYNOPSIS
-
-B<kmig-iconv> <file> [other arguments...]
-
-=cut
-
-###############################################################################
-
-use strict;
-use Switch;
-use Env qw(
-    HOME MYSQL_HOST MYSQL_TCP_PORT MYSQL_USER MYSQL_DATABASE MYSQL_PW
-    MIGSCHEMA MIGBASEWORKDIR MIGBASEGITDIR MIGGITDIR MIGWORKDIR
-);
-use Pod::Usage;
-use DBI;
-use Cwd 'abs_path';
-use FindBin;
-my $mig_bin = "$FindBin::Bin/";
-use lib "$FindBin::Bin/";
-use KMig;
-
-pod2usage(-verbose => 2) if ! $ARGV[0] || $ARGV[0] eq '--help';
-
-KMig::die_if_no_env_migschema();
-KMig::die_if_mig_tracking_table_does_not_exist();
-
-my $file = abs_path($ARGV[0]);
-if ($file =~ /^$MIGBASEWORKDIR/) {
-    call_iconv(@ARGV);
-} else {
-    print "File falls outside of MIGWORKDIR ($MIGWORKDIR): $file\n";
-}
-
-exit 0;
-
-###############################################################################
-
-sub call_iconv {
-    my $file = abs_path(shift);
-    my @args = @_;
-
-    my $tracked_file_id = KMig::check_for_tracked_file($file);
-    if ($tracked_file_id) {
-        my $data = KMig::status_this_file($file);
-        print "iconv'ing tracked file: $file\n";
-
-        if (scalar(@args) == 0) {
-            @args = (
-                 '-f'
-                ,'ISO-8859-1'
-                ,'-t'
-                ,'UTF-8'
-                ,'--verbose'
-            );
-        }
-
-        system('iconv', @args, '-o', $file . '.utf8', $file);
-        system('touch', $file . '.utf8'); # handle 0-byte files
-
-        my $dbh = KMig::db_connect();
-        my $utf8_file = $dbh->quote($file . '.utf8');
-        if (! -e $file . '.utf8') {
-            print "utf8 file does not exist: $utf8_file\n";
-            $utf8_file = $dbh->quote('');
-        }
-
-        my $rv = $dbh->do("
-            UPDATE m_tracked_file
-            SET utf8_filename = $utf8_file
-            WHERE base_filename = " . $dbh->quote($file) . "
-            ;
-        ") || die "Error inserting into table m_tracked_file: $!\n";
-        KMig::db_disconnect($dbh);
-    } else {
-        print "File not currently tracked: $file\n";
-    }
-}