#!/bin/sh

rm -rf target > /dev/null 2>&1

. src/bash/maven.functions

downloadMBootDependencies

createMBootClasspath

compile ".:$MBOOT_CP" target/classes src/main

isCommandSuccessful $? "Failed compiling Maven bootstrapper classes!"

DIST=target/mboot

mkdir -p $DIST

cp -r target/classes $DIST

cp src/bash/* $DIST > /dev/null 2>&1

(
  cd target/mboot
  
  tar czf ../mboot.tar.gz * 
)

cat src/sea/sea-header target/mboot.tar.gz > target/mboot-install.sh
  
chmod +x target/mboot-install.sh

rm -f bootstrap.repo > /dev/null 2>&1