~rainct/ubuntu-dev-tools/dev

8 by Luke Yelavich
* Added pbuilder-dist. Rename to feisty/gutsy/etc to use pbuilder with
1
#!/bin/sh
18.3.5 by Siegfried-Angel Gevatter Pujals (RainCT)
Complete the README file. Unify all script headers. Delete pbuilder-template (same as -dist). Change my mail address.
2
# Copyright (C) Jamin W. Collins <jcollins@asgardsrealm.net>
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
3
#                and Jordan Mantha <mantha@ubuntu.com>
4
# Copyright 2007 (C) Siegfried-A. Gevatter <siggi.gevatter@gmail.com>
5
# License: GPLv2 or later
18.3.5 by Siegfried-Angel Gevatter Pujals (RainCT)
Complete the README file. Unify all script headers. Delete pbuilder-template (same as -dist). Change my mail address.
6
#
7
# This script is a wrapper to use pbuilder with many different
8
# distributions / versions.
9
#
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
10
# If you want to use this copy of the script only for a single distribution
11
# / version, rename it to 'pbuilder-dapper', 'pbuilder-feisty', 'pbuilder-gutsy', 
18.3.8 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: filename related improvements. Updated AUTHORS, and sorted them A-Z. Updated debian/copyright and fixed a problem there (some scripts don't have the 'or later' clause).
12
# or whatever it is. If you have an amd64, you can also use names like
13
# 'pbuilder-feisty-i386', etc.
18.3.5 by Siegfried-Angel Gevatter Pujals (RainCT)
Complete the README file. Unify all script headers. Delete pbuilder-template (same as -dist). Change my mail address.
14
#
15
# The only variable you really might need to change is BASE_DIR, if you
16
# don't want pbuilder stuff in your home directory.
17
#
18
# BTS: #255165
19
20
BASE_DIR="$HOME/pbuilder"
8 by Luke Yelavich
* Added pbuilder-dist. Rename to feisty/gutsy/etc to use pbuilder with
21
18.3.7 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: Implemented architecture choosing for amd64.
22
ARCH=`dpkg-architecture | grep "DEB_HOST_ARCH=" | cut -f2 -d '='`
23
18.3.8 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: filename related improvements. Updated AUTHORS, and sorted them A-Z. Updated debian/copyright and fixed a problem there (some scripts don't have the 'or later' clause).
24
if [ ! -z `echo \`basename $0\` | grep -- '-'`  ] && [ `basename $0` != 'pbuilder-dist' ]
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
25
then
26
    if [ $# -lt 1 ]
27
    then
28
        echo "Insufficient number of arguments."
18.3.7 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: Implemented architecture choosing for amd64.
29
        echo "Usage: $0 "$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"<operation>"
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
30
        exit 1
31
    fi
18.3.8 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: filename related improvements. Updated AUTHORS, and sorted them A-Z. Updated debian/copyright and fixed a problem there (some scripts don't have the 'or later' clause).
32
    
33
    BINARCH=`basename $0 | cut -f3 -d '-'`
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
34
    DISTRIBUTION=`basename $0 | cut -f2 -d '-'`
35
else
36
    if [ $# -lt 2 ]
37
    then
38
        echo "Insufficient number of arguments."
18.3.7 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: Implemented architecture choosing for amd64.
39
        echo "Usage: $0 <distribution> ""$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )""<operation>"
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
40
        exit 1
41
    fi
42
    
43
    DISTRIBUTION=$1
18.3.7 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: Implemented architecture choosing for amd64.
44
    shift 1
45
fi
46
47
if [ $1 = "i386" ]  || [ $1 = "amd64" ]
48
then
49
    if [ $ARCH = "amd64" ]
50
    then
51
        BINARCH=$1
52
    else
53
        echo "Warning: Architecture switching is not supported on your system; ignoring argument."
54
    fi
55
    
56
    shift 1
57
fi
58
59
OPERATION=$1
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
60
61
case $DISTRIBUTION in
62
    #warty|hoary|breezy)
63
    dapper|edgy|feisty|gutsy)
64
        ARCHIVE="http://archive.ubuntu.com/ubuntu"
65
        COMPONENTS="universe multiverse"
66
        ;;
67
    
68
    oldstable|sarge|stable|etch|testing|lenny|unstable|sid|experimental)
69
        ARCHIVE="http://ftp.debian.org"
70
        COMPONENTS="main contrib non-free"
71
        ;;
72
    
73
    *)
74
        echo "Warning: Unknown distribution «$DISTRIBUTION»."
75
        echo -n "Continue [y/N]? "
76
        read continue
77
        
78
        if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ]
79
        then
80
            echo " Aborting..."
81
            exit 1
82
        fi
83
        
84
        ARCHIVE="http://archive.ubuntu.com/ubuntu"
85
        COMPONENTS="universe multiverse"
86
        ;;
87
esac
88
18.3.5 by Siegfried-Angel Gevatter Pujals (RainCT)
Complete the README file. Unify all script headers. Delete pbuilder-template (same as -dist). Change my mail address.
89
8 by Luke Yelavich
* Added pbuilder-dist. Rename to feisty/gutsy/etc to use pbuilder with
90
case $OPERATION in
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
91
    create|update|build|clean|login|execute)
92
        ;;
93
    
94
    *)
95
        echo "Unrecognized argument. Please use one of those:"
96
        echo "    create"
97
        echo "    update"
98
        echo "    build"
99
        echo "    clean"
100
        echo "    login"
101
        echo "    execute"
102
        exit 1
103
        ;;
8 by Luke Yelavich
* Added pbuilder-dist. Rename to feisty/gutsy/etc to use pbuilder with
104
esac
18.3.5 by Siegfried-Angel Gevatter Pujals (RainCT)
Complete the README file. Unify all script headers. Delete pbuilder-template (same as -dist). Change my mail address.
105
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
106
107
if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ]
108
then
109
    mkdir -p $BASE_DIR/${DISTRIBUTION}_result
8 by Luke Yelavich
* Added pbuilder-dist. Rename to feisty/gutsy/etc to use pbuilder with
110
fi
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
111
112
sudo pbuilder $OPERATION \
113
    --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \
114
    --distribution $DISTRIBUTION \
18.3.7 by Siegfried-Angel Gevatter Pujals (RainCT)
pbuilder-dist: Implemented architecture choosing for amd64.
115
    $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \
18.3.6 by Siegfried-Angel Gevatter Pujals (RainCT)
Improved (mainly rewrote) pbuilder-dist. (Other insignificant changes.)
116
    --buildresult $BASE_DIR/$DISTRIBUTION_result \
117
    --othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@