test install creation script
[scpubgit/App-EzPz.git] / bin / ezpz-create-test-ezmlm-install
diff --git a/bin/ezpz-create-test-ezmlm-install b/bin/ezpz-create-test-ezmlm-install
new file mode 100755 (executable)
index 0000000..b766352
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+
+use strictures 1;
+use IO::All;
+use Cwd;
+use IPC::System::Simple qw(run);
+
+die "Usage: ezpz-create-test-ezmlm-install ezmlm-source.tgz build-dir install-dir"
+  unless @ARGV == 3;
+
+my ($ezmlm_tarball, $build_dir_path, $install_to_path) = @ARGV;
+
+my $orig_cwd = io->dir(cwd);
+
+my $build_dir = io->dir(io->dir($build_dir_path)->rel2abs);
+my $install_to = io->dir(io->dir($install_to_path)->rel2abs);
+
+unless ($build_dir->exists) {
+  $build_dir->mkpath;
+  $build_dir->chdir;
+  run 'tar', '-xzf', $ezmlm_tarball;
+  $orig_cwd->chdir;
+}
+
+my ($src_dir) = ($build_dir->all_dirs)[0];
+
+die "No source dir found in ${build_dir}" unless $src_dir;
+
+foreach my $type (qw(bin etc lib man qmail)) {
+  $src_dir->catfile("conf-${type}")->print($install_to->catdir($type)."\n");
+}
+
+$src_dir->chdir;
+
+run make => 'clean';
+run 'make';
+run make => 'man';
+run './ezmlm-test';
+$install_to->catdir('bin')->mkpath;
+run make => 'install';