morpheus

suckless linux distro
git clone git://git.2f30.org/morpheus.git
Log | Files | Refs | Submodules | README | LICENSE

commit e2efb538dec611048fc633f4f7e5a3073e145261
parent 80b5cccb1034cf00db7312f2f5c9b00179fc2841
Author: sin <sin@2f30.org>
Date:   Tue Sep 24 16:43:30 +0100

Clean up the stage0 script

Diffstat:
stage0 | 56++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/stage0 b/stage0 @@ -1,4 +1,7 @@ #!/bin/sh +# +# This is the stage0 script, it prepares a basic usable system +# in $root. set -e -x @@ -8,33 +11,46 @@ rm -rf root cross morpheus.log mkdir -p src cross -# Deps list ./build cross-scripts/musl -# Build stage0 packages installed_deps= -pkglist=$(ls pkgs) -for pkg in $pkglist; do +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 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_dep $pkg $deps + break done < DEPS - ./build pkgs/$pkg +} + +build_pkg() { + build_pkg_deps $1 && ./build pkgs/$1 +} + +# Build stage0 packages +pkglist=$(ls pkgs) +for pkg in $pkglist; do + build_pkg $pkg done