aboutsummaryrefslogtreecommitdiff
path: root/sbrun
diff options
context:
space:
mode:
Diffstat (limited to 'sbrun')
-rwxr-xr-xsbrun40
1 files changed, 27 insertions, 13 deletions
diff --git a/sbrun b/sbrun
index 1772c9e..6d3b92e 100755
--- a/sbrun
+++ b/sbrun
@@ -53,7 +53,6 @@ NONET_PATH=/mnt/nonet.$SELF.$$
# Possible future options:
# -f Run script with fakeroot. (still need root/sudo for unshare/nsenter,
# and trackfs won't track failed writes, maybe this isn't that useful?)
-# -I Install package after it's built. Could count as scope creep.
long_help() {
# note: root's pager is used, not the user's, since we use sudo.
@@ -109,7 +108,7 @@ beginning with - must occur before [script] or [variable=value].
-x Run the script with "sh -x", enables shell command tracing.
--i Run an interactive shell in the source directory, after the script
+-I Run an interactive shell in the source directory, after the script
completes *successfully* (nothing happens if it fails). Useful for
development, e.g. place 'exit 0' in the script wherever you need to
examine the state of the source directory. May not work as expected
@@ -123,13 +122,19 @@ beginning with - must occur before [script] or [variable=value].
-c Clean up (remove) source and package directories after the
build completes. This option overrides \$TMP from the environment.
--d Use distcc for the compile. You still have to set DISTCC_HOSTS in the
+-D Use distcc for the compile. You still have to set DISTCC_HOSTS in the
environment, or in one of distcc's config files. This option sets
CC and CXX, allows network access, and disables filesystem tracking.
--u Install the package after building it. This just runs "upkg" in the
+-i Install the package after building it. This just runs "upkg" in the
SlackBuild directory, so "sbrun -u" is just a shortcut for typing
- "sbrun; upkg".
+ "sbrun && upkg". No package will be installed if the build script
+ fails.
+
+-d Download the source before building the package. This just runs "sbodl"
+ in the SlackBuild directory. Note that this is annoying, if you use
+ $SELF's sudo support: the file ends up owned by root, not the user
+ you ran $SELF as.
-h, --help
Show short usage message and exit.
@@ -193,11 +198,11 @@ fairly often with buggy SlackBuilds. The elapsed time display is a nice
convenience (I complain that "This thing takes 2 hours to build!" when
really it's closer to 1 hour).
-The -i option exists because I used to be in the habit of placing 'exec
+The -I option exists because I used to be in the habit of placing 'exec
bash -login' part of the way through a script as a way to get a shell in
the source dir... but this stopped being possible once I added build.log
to sbrun. So now I can stick 'exit 0' part way through the script and use
-'sbrun -i' to get the same thing. -p was added for similar reasons.
+'sbrun -I' to get the same thing. -p was added for similar reasons.
The -c option is the only "end user" option, really. I mostly use it
for building dependencies maintained by other people, not my own stuff.
@@ -211,10 +216,11 @@ except you have to install trackfs.
Since it's *not* intended to replace sbotools or sbopkg, sbrun doesn't
do any of these things:
-- download source files.
+- download source files (though it will call 'sbodl' with the -d option).
- check source file md5sums.
- allow building multiple packages at once (queue files).
-- install/upgrade/remove packages (it *just* builds them).
+- install/upgrade/remove packages (it *just* builds them, though it will
+ call 'upkg' with the -i option).
- dependency resolution.
- sync the repo, or even have any concept of a repo (it only deals
with a single SlackBuild script, in the current directory).
@@ -249,9 +255,10 @@ Usage: $SELF [-option [-option ...]] [script] [variable=value ...]
-S Run the script with strace -ff, outputs in "strace.out.<pid>".
-x Run the script with "sh -x", enables shell command tracing.
-c Clean up (remove) source and package dirs after build completes.
--i Run an interactive shell in the source directory.
+-I Run an interactive shell in the source directory.
-p Run an interactive shell in the \$PKG directory.
-u Install built package with 'upkg'.
+-d Download sources with 'sbodl'.
-h, --help
Show short usage message (you're reading it now) and exit.
-H Show long help message and exit.
@@ -354,14 +361,15 @@ while printf -- "$1" | grep -q ^-; do
-S) TRACK=no; STRACE=-ff ;;
-x) X="-x" ;;
-c) CLEANUP="yes" ;;
- -i) SRCSH="yes" ;;
+ -I) SRCSH="yes" ;;
-p) PKGSH="yes" ;;
- -d) CC="distcc gcc"
+ -D) CC="distcc gcc"
CXX="distcc g++"
TRACK=no
NETWORK=yes
export CC CXX ;;
- -u) UPKG=yes ;;
+ -i) UPKG=yes ;;
+ -d) SBODL=yes ;;
-h|-help|--help) show_help ; exit 0 ;;
-H) long_help ; exit 0 ;;
-*) show_help "$1"; exit 1 ;;
@@ -369,6 +377,8 @@ while printf -- "$1" | grep -q ^-; do
shift
done
+[ "$SBODL" = "yes" ] && sbodl
+
# warn and die append to the log, make sure it starts out empty.
# This is the only place we use tee $BUILDLOG (everything else appends).
{
@@ -380,6 +390,10 @@ echo "== command: $0" "$@"
echo
} | tee $BUILDLOG
+# set the build log's ownership to the calling user, or at least the
+# user that owns the current directory.
+chown "$( stat -c %U.%G . )" $BUILDLOG
+
# rest of arg parsing can use warn or die.
if echo "$1" | grep -qv '='; then
SCRIPT="$1"