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 ++++++++++++++++++++++++---------------------- src/build_package.sh | 2 +- src/prepare_environment.sh | 3 +++ 3 files changed, 38 insertions(+), 31 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 } diff --git a/src/build_package.sh b/src/build_package.sh index 159155a..0ba7bb2 100755 --- a/src/build_package.sh +++ b/src/build_package.sh @@ -78,7 +78,7 @@ fetch_source () { if [ ! -z ${ADDITIONAL} ]; then for url in ${ADDITIONAL[*]}; do local name=$(basename $url) - curl -Ssl $url > $src_dir/$name + curl -SsL $url > $src_dir/$name done fi } diff --git a/src/prepare_environment.sh b/src/prepare_environment.sh index c4cfe54..1edfd9c 100755 --- a/src/prepare_environment.sh +++ b/src/prepare_environment.sh @@ -20,3 +20,6 @@ if [ -d $XIB_BUILDFILES/.git ]; then else git clone $BUILDFILES_GIT_REPO $XIB_BUILDFILES fi + + +cp /etc/resolv.conf $XIB_CHROOT/etc/resolv.conf -- cgit v1.2.1