| 1 | #!/bin/bash |
| 2 | |
| 3 | # Main script, build all packages in the tree. |
| 4 | |
| 5 | set -e |
| 6 | |
| 7 | CWD=$(pwd) |
| 8 | ERROR_LOG=${CWD}/build_error.log |
| 9 | VERSIONING=${CWD}/versioning |
| 10 | |
| 11 | if [ ! -f $VERSIONING ];then |
| 12 | echo "NO $VERSIONING FOUND! ABORTING NOW." >> $ERROR_LOG |
| 13 | echo -e "file: $VERSIONING NOT found!! Aborting" |
| 14 | echo -e "run ${CWD}/GRAB_VERSION.SH to generate the file again." |
| 15 | exit 118 |
| 16 | else |
| 17 | # We source the versioning file here and use it later |
| 18 | . $VERSIONING |
| 19 | fi |
| 20 | |
| 21 | if [ ! -f $ERROR_LOG ];then |
| 22 | touch $ERROR_LOG |
| 23 | fi |
| 24 | |
| 25 | SLACKBUILD="$CWD/LXQt.SlackBuild" |
| 26 | TMP=${TMP:-/tmp} |
| 27 | BUILD_DIR=${BUILD_DIR:-$TMP/lxqt-build} |
| 28 | |
| 29 | check_already_built() { |
| 30 | local PKG=$1 |
| 31 | RESULT="" |
| 32 | if [[ -z $(/bin/ls -A ${CWD}/packages) ]];then |
| 33 | # packages is empty |
| 34 | RESULT="" |
| 35 | elif [[ ! $(find ${CWD}/packages/${PKG} -name $PKG* -print > /dev/null 2>&1) ]]; then |
| 36 | # packages is not empty but we can't find $1 |
| 37 | RESULT="" |
| 38 | else |
| 39 | # we found it |
| 40 | RESULT="found" |
| 41 | fi |
| 42 | return $RESULT |
| 43 | } |
| 44 | |
| 45 | LIST=$(cat ${CWD}/build_order) |
| 46 | COUNTER=0 |
| 47 | TOTAL=$(wc -l ${CWD}/build_order |cut -d " " -f1) |
| 48 | for p in $LIST; do |
| 49 | let COUNTER=COUNTER+1 |
| 50 | if [[ $p == 'libfm-extra' ]]; then |
| 51 | # libfm-extra doesn't have a source directory but uses libfm as well |
| 52 | PKGS=$(find ${CWD}/src -mindepth 1 -maxdepth 1 -type d -name 'libfm' -print) |
| 53 | else |
| 54 | PKGS=$(find ${CWD}/src -mindepth 1 -maxdepth 1 -type d -name $p -print) |
| 55 | fi |
| 56 | ALREADY_BUILT=$(check_already_built $p) |
| 57 | VNUM=${versions[${p}]} |
| 58 | if [[ -e $PKGS && $ALREADY_BUILT != "found" ]];then |
| 59 | echo -e "########################################################" |
| 60 | echo -e "#\t[$COUNTER / $TOTAL] building $p" |
| 61 | echo -e "########################################################" |
| 62 | export VERSION=$VNUM |
| 63 | ${CWD}/lxqt.SlackBuild $p |
| 64 | unset VERSION |
| 65 | echo -e "########################################################" |
| 66 | echo -e "# done building $p!" |
| 67 | echo -e "########################################################" |
| 68 | mkdir -p ${CWD}/packages/${p} |
| 69 | mv ${BUILD_DIR}/${p}*.txz ${CWD}/packages/${p}/ |
| 70 | upgradepkg --reinstall --install-new ${CWD}/packages/${p}/${p}*.txz |
| 71 | else |
| 72 | echo $PKGS not found >> ${ERROR_LOG} |
| 73 | fi |
| 74 | done |
| 75 | |