#!/bin/sh CMD_DIR="$(realpath $(dirname $0))" PATH=$PATH:$CMD_DIR PROJ_DIR="$(realpath $CMD_DIR/..)" while : do >"$TMP/before.txt" find "${PROJ_DIR}" -name '*.txz' mkdir -p "${PROJ_DIR}/patches/packages/" for pkg in $PROJ_DIR/patches/source/*; do ( cd "$pkg" export OUTPUT="${PROJ_DIR}/patches/packages/" PKG_NAME=$(basename $(realpath .)) built=$(find "$OUTPUT" -name "$PKG_NAME-*.txz") if [ -n "$built" ]; then continue fi sh *.SlackBuild built="$(find "$TMP" -name "*.txz")" if [ -z "$built" ]; then continue fi mkdir -p "${OUTPUT}" upgradepkg --install-new "$TMP"/*.txz mv "$TMP"/*.txz "${OUTPUT}" ) done for pkg in $PROJ_DIR/source/**/*; do ( cd "$pkg" export OUTPUT="${PROJ_DIR}/slackware/$(pkg-set.sh)" PKG_NAME=$(basename $(realpath .)) built=$(find "$OUTPUT" -name "$PKG_NAME-*.txz") if [ -n "$built" ]; then continue fi sh *.SlackBuild built="$(find "$TMP" -name "*.txz")" if [ -z "$built" ]; then continue fi mkdir -p "${OUTPUT}" upgradepkg --install-new "$TMP"/*.txz mv "$TMP"/*.txz "${OUTPUT}" ) done >"$TMP/after.txt" find "${PROJ_DIR}" -name '*.txz' NEW_PACKAGES="$(diff $TMP/before.txt $TMP/after.txt | grep "^>" | sed "s#^> ##")" if [ ! $NEW_PACKAGES ]; then break fi done