aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-03-10 15:27:56 -0500
committerB. Watson <yalhcru@gmail.com>2022-03-10 15:27:56 -0500
commit34c6d442202ea8d112d164b8611a60b8e4832b12 (patch)
treed32ca623563d804b28cd1b381d1be4512e6be119
parent09c600b7a253f5b1714ae26810e53156f10f40ee (diff)
downloadsbostuff-34c6d442202ea8d112d164b8611a60b8e4832b12.tar.gz
sbqrun: added (build and install a list of slackbuilds)
-rwxr-xr-xsbqrun90
1 files changed, 90 insertions, 0 deletions
diff --git a/sbqrun b/sbqrun
new file mode 100755
index 0000000..6b35189
--- /dev/null
+++ b/sbqrun
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+# sbrun wrapper, runs multiple builds.
+
+# usage: sbqrun arg [arg ...]
+
+if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ cat <<EOF
+Usage: $( basename $0 ) [-n] [-t] arg [arg ...]
+
+Run this script from the top level of a SBo repo clone!
+
+If arg is a file, its contents are added to the list of builds. Use -
+to read a list of builds from stdin (possibly piped from sbodeps -q).
+
+If arg is a directory, it's added to the list.
+
+If arg is neither, it's assumed to be a bare build name (with no category/
+directory) and searched for.
+
+Full sbopkg queue syntax is NOT supported, only a simple list of builds
+(no |VAR=value, no @file, no -app). If you need sbopkg, use sbopkg!
+
+Once the list is built, each build is downloaded with sbodl, built with
+sbrun -c, and installed with upkg, in the order given. If the -n and/or
+-t options are given, they will be passed to sbrun.
+EOF
+ exit 0
+fi
+
+source ~/sbostuff/sbostuff.sh
+cdsb
+
+for arg; do
+ if [ "$arg" = "-t" -o "$arg" = "-n" ]; then
+ SBRUN_OPTS="$SBRUN_OPTS $arg"
+ elif [ "$arg" = "-" ]; then
+ while read build; do
+ BUILDS="$BUILDS $build"
+ done
+ elif [ -f "$arg" ]; then
+ BUILDS="$BUILDS `cat $arg`"
+ elif [ -d "$arg" ]; then
+ BUILDS="$BUILDS $arg"
+ else
+ arg=$( echo */$arg )
+ if [ -d "$arg" ]; then
+ BUILDS="$BUILDS $arg"
+ else
+ echo "!!! no idea what '$arg' is, skipping"
+ fi
+ fi
+done
+
+FAILED=""
+COUNT=0
+FAILCOUNT=0
+
+for build in $BUILDS; do
+ : $(( COUNT ++ ))
+ echo "==== sbqrun: COUNT=$COUNT, FAILCOUNT=$FAILCOUNT, starting $build"
+ if ! cdsb "$build"; then
+ echo "==== sbqrun: ERROR: no such build: $build"
+ FAILED+="$build "
+ : $(( FAILCOUNT ++ ))
+ continue
+ fi
+
+ sbodl || echo "==== sbqrun: WARN: download failed, trying build anyway"
+
+ if ! sbrun -c $SBRUN_OPTS; then
+ echo "==== sbqrun: BUILD FAILED: $build, see $(pwd)/build.log"
+ FAILED+="$build "
+ : $(( FAILCOUNT ++ ))
+ else
+ if ! upkg; then
+ echo "==== sbqrun: $build built, but FAILED to install"
+ : $(( FAILCOUNT ++ ))
+ fi
+ fi
+done
+
+echo "==== Processed $COUNT builds"
+if [ "$FAILCOUNT" = "0" ]; then
+ echo "==== No failures"
+ exit 0
+else
+ echo "==== $FAILCOUNT build failures: $FAILED"
+ exit 1
+fi