#!/bin/sh
# Copyright © 2020 fosslinux
#
# This file is part of live-bootstrap. 
#
# live-bootstrap is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# live-bootstrap is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with live-bootstrap.  If not, see <http://www.gnu.org/licenses/>.

set -ex

PATH=/after/bin:/bin

# Part 2: cp and chown (mescc-tools-extra)
cd mescc-tools-extra
kaem --file go.kaem
cd ..

# Part 3: Remove remaining dependencies on / (root of /after)
/after/bin/cp ../bin/hex2 bin/hex2
/after/bin/cp ../bin/M1 bin/M1
/after/bin/cp ../bin/M2-Planet bin/M2-Planet
/after/bin/cp ../bin/blood-elf bin/blood-elf
/after/bin/cp ../bin/get_machine bin/get_machine
/after/bin/cp ../bin/mes-m2 bin/mes-m2
/after/bin/cp ../bin/kaem bin/kaem
/after/bin/cp ../catm bin/catm
/after/bin/chmod 755 bin/hex2 bin/M1 bin/M2-Planet bin/blood-elf \
    bin/get_machine bin/mes-m2 bin/kaem bin/catm

# Part 4: blynn-compiler

cd blynn-compiler
kaem --file go.kaem
cd ..

# Part 5: mes
kaem --file mes.kaem
