1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-24 13:38:34 +00:00
morpheus/stage0
2013-09-24 16:50:24 +01:00

57 lines
933 B
Bash
Executable File

#!/bin/sh
#
# This is the stage0 script, it prepares a basic usable system
# in $root.
set -e -x
rm -rf root cross morpheus.log
. ./prepare-env
. ./prepare-root
mkdir -p src cross
./build cross-scripts/musl
installed_deps=
build_pkg_dep() {
pkg=$1; deps=$2
# Build dependencies for package in order
for d in $deps; do
install=1
for i in $installed_deps; do
if [ $i == $d ]; then
# If already installed, then skip it
install=0
break
fi
done
if [ $install -eq 1 ]; then
./build cross-scripts/$d
installed_deps="$installed_deps $d"
fi
done
}
build_pkg_deps() {
pkg=$1
while read line; do
if [ $(echo $line | cut -d' ' -f1) != $pkg ]; then
continue
fi
deps=$(echo $line | cut -d' ' -f2-)
build_pkg_dep $pkg $deps
break
done < DEPS
}
build_pkg() {
build_pkg_deps $1 && ./build pkgs/$1
}
# Build stage0 packages
pkglist=$(ls pkgs)
for pkg in $pkglist; do
build_pkg $pkg
done