mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 16:04:02 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			116 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			116 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
# Copyright (C) Jamin W. Collins <jcollins@asgardsrealm.net>
 | 
						|
#                and Jordan Mantha <mantha@ubuntu.com>
 | 
						|
# Copyright 2007 (C) Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
 | 
						|
# License: GPLv2 or later
 | 
						|
#
 | 
						|
# This script is a wrapper to use pbuilder with many different
 | 
						|
# distributions / versions.
 | 
						|
#
 | 
						|
# If you want to use this copy of the script only for a single distribution
 | 
						|
# / version, rename it to 'pbuilder-dapper', 'pbuilder-feisty', 'pbuilder-gutsy', 
 | 
						|
# or whatever it is.
 | 
						|
#
 | 
						|
# The only variable you really might need to change is BASE_DIR, if you
 | 
						|
# don't want pbuilder stuff in your home directory.
 | 
						|
#
 | 
						|
# BTS: #255165
 | 
						|
 | 
						|
BASE_DIR="$HOME/pbuilder"
 | 
						|
 | 
						|
ARCH=`dpkg-architecture | grep "DEB_HOST_ARCH=" | cut -f2 -d '='`
 | 
						|
 | 
						|
if [ ! -z `echo \`basename $0\` | grep '-'`  ]
 | 
						|
then
 | 
						|
    if [ $# -lt 1 ]
 | 
						|
    then
 | 
						|
        echo "Insufficient number of arguments."
 | 
						|
        echo "Usage: $0 "$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"<operation>"
 | 
						|
        exit 1
 | 
						|
    fi
 | 
						|
 | 
						|
    DISTRIBUTION=`basename $0 | cut -f2 -d '-'`
 | 
						|
else
 | 
						|
    if [ $# -lt 2 ]
 | 
						|
    then
 | 
						|
        echo "Insufficient number of arguments."
 | 
						|
        echo "Usage: $0 <distribution> ""$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )""<operation>"
 | 
						|
        exit 1
 | 
						|
    fi
 | 
						|
    
 | 
						|
    DISTRIBUTION=$1
 | 
						|
    shift 1
 | 
						|
fi
 | 
						|
 | 
						|
if [ $1 = "i386" ]  || [ $1 = "amd64" ]
 | 
						|
then
 | 
						|
    if [ $ARCH = "amd64" ]
 | 
						|
    then
 | 
						|
        BINARCH=$1
 | 
						|
    else
 | 
						|
        echo "Warning: Architecture switching is not supported on your system; ignoring argument."
 | 
						|
    fi
 | 
						|
    
 | 
						|
    shift 1
 | 
						|
fi
 | 
						|
 | 
						|
OPERATION=$1
 | 
						|
 | 
						|
case $DISTRIBUTION in
 | 
						|
    #warty|hoary|breezy)
 | 
						|
    dapper|edgy|feisty|gutsy)
 | 
						|
        ARCHIVE="http://archive.ubuntu.com/ubuntu"
 | 
						|
        COMPONENTS="universe multiverse"
 | 
						|
        ;;
 | 
						|
    
 | 
						|
    oldstable|sarge|stable|etch|testing|lenny|unstable|sid|experimental)
 | 
						|
        ARCHIVE="http://ftp.debian.org"
 | 
						|
        COMPONENTS="main contrib non-free"
 | 
						|
        ;;
 | 
						|
    
 | 
						|
    *)
 | 
						|
        echo "Warning: Unknown distribution «$DISTRIBUTION»."
 | 
						|
        echo -n "Continue [y/N]? "
 | 
						|
        read continue
 | 
						|
        
 | 
						|
        if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ]
 | 
						|
        then
 | 
						|
            echo " Aborting..."
 | 
						|
            exit 1
 | 
						|
        fi
 | 
						|
        
 | 
						|
        ARCHIVE="http://archive.ubuntu.com/ubuntu"
 | 
						|
        COMPONENTS="universe multiverse"
 | 
						|
        ;;
 | 
						|
esac
 | 
						|
 | 
						|
 | 
						|
case $OPERATION in
 | 
						|
    create|update|build|clean|login|execute)
 | 
						|
        ;;
 | 
						|
    
 | 
						|
    *)
 | 
						|
        echo "Unrecognized argument. Please use one of those:"
 | 
						|
        echo "    create"
 | 
						|
        echo "    update"
 | 
						|
        echo "    build"
 | 
						|
        echo "    clean"
 | 
						|
        echo "    login"
 | 
						|
        echo "    execute"
 | 
						|
        exit 1
 | 
						|
        ;;
 | 
						|
esac
 | 
						|
 | 
						|
 | 
						|
if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ]
 | 
						|
then
 | 
						|
    mkdir -p $BASE_DIR/${DISTRIBUTION}_result
 | 
						|
fi
 | 
						|
 | 
						|
sudo pbuilder $OPERATION \
 | 
						|
    --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \
 | 
						|
    --distribution $DISTRIBUTION \
 | 
						|
    $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \
 | 
						|
    --buildresult $BASE_DIR/$DISTRIBUTION_result \
 | 
						|
    --othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@
 |