From: Jason Etheridge Date: Fri, 10 Apr 2020 18:44:58 +0000 (-0400) Subject: mig wrapper to kmig/emig X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=d0b69006c088c76a298aa2ebebf85a8e9a983416 mig wrapper to kmig/emig 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 --- diff --git a/emig.d/bin/mig-env b/emig.d/bin/mig-env index 7ed2b71..5ee9971 100755 --- a/emig.d/bin/mig-env +++ b/emig.d/bin/mig-env @@ -242,6 +242,7 @@ sub mig_env_create { 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"; diff --git a/kmig.d/bin/mig-env b/kmig.d/bin/mig-env index 2ce6f32..0ef503b 100755 --- a/kmig.d/bin/mig-env +++ b/kmig.d/bin/mig-env @@ -272,6 +272,7 @@ sub mig_env_create { 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"; diff --git a/mig b/mig new file mode 100755 index 0000000..ee680de --- /dev/null +++ b/mig @@ -0,0 +1,29 @@ +#!/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."; +} +