pbuilder-dist: fixed another problem when working with more than one architecture. Added an option to store the last log. Added an option to use the same cache directory for .deb's as apt-get when possible.

This commit is contained in:
Siegfried-Angel Gevatter Pujals (RainCT) 2007-08-08 23:55:10 +02:00
parent e5e47f3117
commit b358cfe47c

View File

@ -23,13 +23,22 @@ BASE_DIR="$HOME/pbuilder"
# contrib and non-free in Debian.)
EXTRACOMP=1
# Save the log of the last operation in a dot-file? ('.lastlog' in BASE_DIR)
SAVELOG=0
# Allow this script to use /var/cache/apt/archives/ when possible
SYSCACHE=1
################################
ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
SYSDIST=`lsb_release -cs`
help()
{
echo "Insufficient number of arguments."
echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo "<distribution> " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] <operation>"
echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo "<distribution> " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] <operation>"
exit 1
}
@ -55,8 +64,7 @@ fi
if [ $1 = "i386" ] || [ $1 = "amd64" ]
then
if [ $ARCH = "amd64" ]
then
if [ $ARCH = "amd64" ]; then
BINARCH=$1
else
echo "Warning: Architecture switching is not supported on your system; ignoring argument."
@ -66,17 +74,24 @@ then
fi
if [ $1 = "mainonly" ]
then
if [ $1 = "mainonly" ]; then
EXTRACOMP=0
shift 1
elif [ $1 = "allcomp" ]
then
elif [ $1 = "allcomp" ]; then
EXTRACOMP=1
shift 1
fi
if [ $1 = "withlog" ]; then
SAVELOG=0
shift 1
elif [ $1 = "nolog" ]; then
SAVELOG=1
shift 1
fi
distdata()
{
if [ "$1" = "debian" ]
@ -136,15 +151,23 @@ case $OPERATION in
;;
esac
FOLDERBASE="${DISTRIBUTION}-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )"
if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ]
if [ ! -d $BASE_DIR/${FOLDERBASE}_result ]
then
mkdir -p $BASE_DIR/${DISTRIBUTION}_result
mkdir -p $BASE_DIR/${FOLDERBASE}_result
fi
if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ]
then
DEBCACHE='/var/cache/apt/archives/'
fi
sudo pbuilder $OPERATION \
--basetgz $BASE_DIR/$DISTRIBUTION-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )-base.tgz \
--basetgz $BASE_DIR/$FOLDERBASE-base.tgz \
--distribution $DISTRIBUTION \
$( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \
--buildresult $BASE_DIR/${DISTRIBUTION}_result \
$( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \
$( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \
--buildresult $BASE_DIR/$FOLDERBASE_result \
--othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@