diff options
author | davidovski <david@davidovski.xyz> | 2022-01-31 23:27:12 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-01-31 23:27:12 +0000 |
commit | bd41b8025735e4f2f3790aaaacc469fcd5983ce9 (patch) | |
tree | e1092110c4ee5bf4060253b023c94b6a83b40546 /src/build.sh | |
parent | e7763a93f4a2a273233eb6cf4595fee9a756c95a (diff) |
refactoring build.sh
Diffstat (limited to 'src/build.sh')
-rwxr-xr-x | src/build.sh | 64 |
1 files changed, 34 insertions, 30 deletions
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 } |