#!/bin/sh # # Run a new shell inside a script command, logging to the file # $HOME/var/log/build/pkg-arch-host-date.gz # Too often was I building things and losing the details. # - Cameron Simpson 28aug2000 # : ${LOGDIR:=$HOME/var/log} buildlogs=$LOGDIR/build cmd=`basename "$0"` usage="Usage: $cmd [pkgdir]" badopts= if [ $# -gt 0 ] then pkgdir=$1; shift cd "$pkgdir" || { echo "$cmd: chdir($pkgdir) fails" >&2; exit 1; } fi [ $# = 0 ] || { echo "$cmd: extra arguments after pkgdir" >&2; badopts=1; } [ $badopts ] && { echo "$usage" >&2; exit 2; } cwd=`pwd` || exit 1 pkg=`basename "$cwd"` || exit 1 logbase=$pkg-$ARCH-$HOST needdir "$buildlogs" || exit 1 umask 2 session=$cmd-$pkg-$ARCH-$HOST exec term -n "$session" \ screen -S "$session" \ buildenv env ps1pfx=":$ps1pfx" ps2pfx=" $ps2pfx" \ logscript -d "$buildlogs" "$logbase"