It won't handle first time setup; you'll need to call emig or kmig explicitly
until an environment is loaded.
Example:
kmig env create demo
kmig env use demo
mig init
mig add foo.txt etc
Also, the older ~/.mig environment directory, if used with the new mig, will
need to be moved or merged into ~/.emig, and the various *.env files ammended
with:
export MIGCMD=emig
print FILE "export PGDATABASE=$PGDATABASE\n";
print FILE "export PGUSER=$PGUSER\n";
print FILE "export PGOPTIONS='-c search_path=$migration_schema,public,evergreen'\n";
+ print FILE "export MIGCMD=emig\n";
print FILE "export MIGENVPROMPT=$migration_schema\n";
print FILE "export MIGSCHEMA=$migration_schema\n";
print FILE "export MIGBASEWORKDIR=$MIGBASEWORKDIR\n";
print FILE "export MYSQL_USER=$MYSQL_USER\n";
#TODO - brittle; need to escape the password string
print FILE "export MYSQL_PW=$MYSQL_PW\n";
+ print FILE "export MIGCMD=kmig\n";
print FILE "export MIGENVPROMPT=$migration_schema\n";
print FILE "export MIGSCHEMA=$migration_schema\n";
print FILE "export MIGBASEWORKDIR=$MIGBASEWORKDIR\n";
--- /dev/null
+#!/usr/bin/perl -w
+###############################################################################
+=pod
+
+=head1 NAME
+
+mig - git-like program for tracking and manipulating legacy data files for
+migrations. This is a smart wrapper around emig and kmig (for Evergreen and
+Koha migrations, respectively). It'll fail if the MIGCMD environment variable
+is not set. Environments created through kmig env and emig env should set
+MIGCMD accordingly.
+
+=cut
+
+###############################################################################
+
+use strict;
+use Env qw(
+ MIGCMD
+);
+use Pod::Usage;
+
+pod2usage(-verbose => 2) if ! $ARGV[0];
+if ($MIGCMD) {
+ system($MIGCMD,@ARGV);
+} else {
+ die "Please use emig/kmig to load an environment.";
+}
+