while read type path distro components; do
test "$type" = deb || continue
printf "$type $path $tgt_distro $components\n"
- done < /etc/apt/sources.list
+ done < "$2"
}
get_mirrors () {
- get_sources "$1" | tr '\n' '|' | head -c-1; echo
+ file=${2-/etc/apt/sources.list}
+ announce "Using apt sources file: $file"
+ get_sources "$1" "$file" | tr '\n' '|' | head -c-1; echo
}
build_debs () {
{
set -e
local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts=""
- local keep_pbuilder_config=false
+ local keep_pbuilder_config=false keyring="" custom_keyring=""
local use_system_sources=false
- while getopts 'Bbdkt' o "$@"; do
+ while getopts 'BbdK:kT:t' o "$@"; do
case "$o" in
B) cow_build_opts="--debbuildopts '-B'";;
b) cow_build_opts="--debbuildopts '-b'";;
d) debug_hook=true;;
k) keep_pbuilder_config=true;;
- t) use_system_sources=true;;
+ K) custom_keyring="$OPTARG";;
+ t) use_system_sources=true; custom_sources_file="/etc/apt/sources.list";;
+ T) use_custom_sources=true; custom_sources_file="$OPTARG";;
esac
done
shift $(($OPTIND-1))
[ -x "$(which cowbuilder)" ] \
|| err "package cowbuilder isn't installed"
local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow
+ if [ -e "$custom_keyring" ]; then
+ keyring="$custom_keyring"
+ else
+ keyring="$(mktemp /tmp/keyringXXXXXXXX.asc)"
+ apt-key exportall > "$keyring"
+ fi
cow () {
if ! $use_system_sources; then
cowbuilder "$@" \
--architecture $arch \
--basepath $cow_img
else
- local keyring="$(mktemp /tmp/keyringXXXXXXXX.asc)"
- apt-key exportall > "$keyring"
cowbuilder "$@" \
--distribution $distro \
--architecture $arch \
--basepath $cow_img \
--keyring "$keyring" \
- --othermirror "$(get_mirrors $distro)"
- rm -f $keyring
+ --othermirror "$(get_mirrors $distro $custom_sources_file)"
fi
}
+ if [ ! -e "$custom_keyring" ]; then
+ # Cleanup script created temporary file
+ rm -f $keyring
+ fi
if ! [ -d $cow_img ]; then
announce "Creating base $distro-$arch image..."
local x=30
-i Auto install build deps on host system
-j Build debs in parallel
-k Don't override pbuilder image configurations
+ -K [/path/to/keyring.asc]
+ Use custom keyring file for sources.list in build environment
+ in the format of: apt-key exportall > /path/to/file.asc
-l <modules>
-m [ quicktest | non-dfsg ]
Choose custom list of modules to build
-s [ paranoid | reckless ]
Set FS bootstrap/build -j flags
-t Use system /etc/apt/sources.list in build environment
+ -T [/path/to/sources.list]
+ Use custom /etc/apt/sources.list in build environment
-u <suite-postfix>
Specify a custom suite postfix
-v Set version
-b Binary-only build
-d Enable cowbuilder debug hook
-k Don't override pbuilder image configurations
+ -K [/path/to/keyring.asc]
+ Use custom keyring file for sources.list in build environment
+ in the format of: apt-key exportall > /path/to/file.asc
-t Use system /etc/apt/sources.list in build environment
+ -T [/path/to/sources.list]
+ Use custom /etc/apt/sources.list in build environment
create-dbg-pkgs