From bd41b8025735e4f2f3790aaaacc469fcd5983ce9 Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 31 Jan 2022 23:27:12 +0000 Subject: refactoring build.sh --- src/build.sh | 64 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) (limited to 'src/build.sh') diff --git a/src/build.sh b/src/build.sh index b94b8d3..b4e8f6d 100755 --- a/src/build.sh +++ b/src/build.sh @@ -8,40 +8,44 @@ RESET="\033[0m" source prepare_environment.sh -build_all () { - for line in $(perl build_order.pm); do - name=$(echo $line | cut -d"+" -f1) - buildfile=$(find $XIB_BUILDFILES -wholename "*/$name.xibuild" | head -1) - - if [ -f "$buildfile" ]; then - printf $INFO - printf "Building$NEUTRAL %s$INFO:\n$RESET" $name - ./build_package.sh $buildfile || return 1 - - # Install the package if it is needed for other builds - if echo $line | grep -q '+'; then - printf "$INFO\tInstalling..." - exported_pkg=$(find $XIB_EXPORT -wholename "*/$name.xipkg" | head -1 | xargs realpath) - if [ -f $exported_pkg ]; then - tar -h --no-overwrite-dir -xf $exported_pkg -C $XIB_CHROOT - fi - - printf "$PASS installed to chroot!\n" +build_package () { + name=$(echo $line | cut -d"+" -f1) + buildfile=$(find $XIB_BUILDFILES -wholename "*/$name.xibuild" | head -1) + + if [ -f "$buildfile" ]; then + printf $INFO + printf "Building$NEUTRAL %s$INFO:\n$RESET" $name + ./build_package.sh $buildfile || return 1 + + # Install the package if it is needed for other builds + if echo $line | grep -q '+'; then + printf "$INFO\tInstalling..." + exported_pkg=$(find $XIB_EXPORT -wholename "*/$name.xipkg" | head -1 | xargs realpath) + if [ -f $exported_pkg ]; then + tar -h --no-overwrite-dir -xf $exported_pkg -C $XIB_CHROOT fi - printf $RESET - printf "Finished building %s!\n" $name - else - printf "$ERROR$name does not exist\n" + printf "$PASS installed to chroot!\n" fi - # configure shadow here - if [ "$name" = "shadow" ]; - xichroot "$XIB_CHROOT" /usr/sbin/pwconv - xichroot "$XIB_CHROOT" /usr/sbin/grpconv - xichroot "$XIB_CHROOT" "mkdir -p /etc/default" - xichroot "$XIB_CHROOT" "useradd -D --gid 999" - fi + printf $RESET + printf "Finished building %s!\n" $name + else + printf "$ERROR$name does not exist\n" + fi + + # configure shadow here + if [ "$name" = "shadow" ]; then + xichroot "$XIB_CHROOT" "/usr/sbin/pwconv" + xichroot "$XIB_CHROOT" "/usr/sbin/grpconv" + xichroot "$XIB_CHROOT" "mkdir -p /etc/default" + xichroot "$XIB_CHROOT" "/usr/sbin/useradd -D --gid 999" + fi +} + +build_all () { + for line in $(perl build_order.pm); do + build_package $line || return 1 done } -- cgit v1.2.1