When using the debian/utils.sh script to build FreeSWITCH packages,

add the ability to pass -T[path to custom sources path] and -K[custom keyfile path]
options to build the FS packages with a custom sources and keyring path.

FS-7373
This commit is contained in:
William King 2015-03-16 08:59:37 -07:00
parent 9872c52c57
commit 4738da1325
1 changed files with 30 additions and 9 deletions

39
debian/util.sh vendored
View File

@ -274,26 +274,30 @@ get_sources () {
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))
@ -309,6 +313,12 @@ build_debs () {
[ -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 "$@" \
@ -316,17 +326,18 @@ build_debs () {
--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
@ -466,6 +477,9 @@ commands:
-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
@ -477,6 +491,8 @@ commands:
-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
@ -490,7 +506,12 @@ commands:
-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