From 5a601b6784c9c32f6f76efdb2acd706435087da5 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 12 Mar 2022 17:38:44 +0000 Subject: fixed postinstall on dash --- xibuild/build_all.sh | 44 ++++++++++++++++++++++++++++++-------------- xibuild/build_package.sh | 15 ++++++--------- xibuild/prepare.sh | 5 ++--- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/xibuild/build_all.sh b/xibuild/build_all.sh index f72e274..74b6a76 100755 --- a/xibuild/build_all.sh +++ b/xibuild/build_all.sh @@ -4,6 +4,7 @@ ERROR="\033[0;31m" INFO="\033[0;34m" PASS="\033[0;32m" NEUTRAL="\033[0;33m" +EXTRA="\033[0;30m" RESET="\033[0m" XIPKG_INSTALL=/usr/lib/xipkg/install.sh @@ -14,18 +15,27 @@ XIPKG_INSTALL=/usr/lib/xipkg/install.sh run_postinstall () { postinstall="$XIB_CHROOT/var/lib/xipkg/postinstall" if [ -d $postinstall ]; then - printf "${INFO}${TABCHAR}postinstall " - for file in $(ls $postinstall/*.sh); do + printf "${EXTRA}(postinstall " + for file in $(ls $postinstall); do + file=$postinstall/$file f=$(basename $file) # run the postinstall file # chmod 755 $file xichroot "$XIB_CHROOT" "/var/lib/xipkg/postinstall/$f" - rm $file - printf "${PASS}${CHECKMARK}\n" + echo $? + if [ "$?" == "0" ]; then + rm $file + printf "${PASS}${CHECKMARK}" + else + printf "${EXTRA}x" + fi done - rmdir $postinstall + printf ")\n" + + [ "$(ls $postinstall | wc -w)" == 0 ] && + rmdir $postinstall fi } @@ -66,13 +76,19 @@ build_all () { done } -if build_all; then - printf "\n${PASS}Built all packages!\n${RESET}" - exit 0 -else - printf "${ERROR} Something went wrong!${NEUTRAL} Press enter to view recent log" - read out; +while true; do + if build_all; then + printf "\n${PASS}Built all packages!\n${RESET}" + exit 0 + else + printf "${ERROR} Something went wrong!${NEUTRAL} Press enter to view recent log" + read out; + + less $(ls -1 --sort time $XIB_EXPORT/repo/*/*.log | head -1 | xargs realpath) - less $(ls -1 --sort time $XIB_EXPORT/repo/*/*.log | head -1 | xargs realpath) - exit 1 -fi + read -p "Retry build? [Y/n]" response + if [ "$response" = "n" ]; then + exit 1 + fi + fi +done diff --git a/xibuild/build_package.sh b/xibuild/build_package.sh index bc34701..f061ad9 100755 --- a/xibuild/build_package.sh +++ b/xibuild/build_package.sh @@ -20,7 +20,7 @@ extract () { tar --lzip -xf "$FILE" ;; "zip" ) - unzip $FILE + unzip -qq -o $FILE ;; * ) tar -xf $FILE @@ -162,14 +162,11 @@ package || exit 1 printf "checking for postinstall... " if command -v postinstall > /dev/null; then echo "adding postinstall" - POSTINSTALL=$(type postinstall | sed '1,3d;$d') - if [ ${#POSTINSTALL} != 0 ]; then - POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall - mkdir -p $POST_DIR - cat /build/$PKG_NAME.xibuild > $POST_DIR/$PKG_NAME.sh - echo "" >> $POST_DIR/$PKG_NAME.sh - echo "postinstall" >> $POST_DIR/$PKG_NAME.sh - fi + POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall + mkdir -p $POST_DIR + cat /build/$PKG_NAME.xibuild > $POST_DIR/$PKG_NAME.sh + echo "" >> $POST_DIR/$PKG_NAME.sh + echo "postinstall" >> $POST_DIR/$PKG_NAME.sh else echo "no postinstall" fi diff --git a/xibuild/prepare.sh b/xibuild/prepare.sh index f7f5733..54e1d81 100755 --- a/xibuild/prepare.sh +++ b/xibuild/prepare.sh @@ -3,7 +3,8 @@ mkdir -p $XIB_DIR $XIB_BUILDFILES $XIB_CHROOT $XIB_EXPORT if [ -d $DEVELOPMENT_BUILDFILES ]; then - cp -r $DEVELOPMENT_BUILDFILES/* $XIB_BUILDFILES/ + export XIB_BUILDFILES=$DEVELOPMENT_BUILDFILES + echo $XIB_BUILDFILES else if [ -d $XIB_BUILDFILES/.git ]; then cd $XIB_BUILDFILES @@ -14,8 +15,6 @@ else fi fi -[ -f $INSTALLED_PACKAGES ] || touch $INSTALLED_PACKAGES - [ -f $XIB_CHROOT/etc/resolv.conf ] || cp /etc/resolv.conf $XIB_CHROOT/etc/resolv.conf cp build_profile $BUILD_PROFILE -- cgit v1.2.1