blob: 7222ae411abf257250d42b43f5f03b4fd46d6529 (
plain)
- #!/bin/sh
- set -e
- PRG=$(basename "$0")
- function showhelp() {
- cat <<EOF
- Usage: $PRG POOL [ DISTRIBUTION [ OTHERMIRROR] ]
- Examples:
- $PRG sarge
- $PRG sarge+hacks sarge 'deb http://example.com/ sarge hacks'
- EOF
- }
- if [ $# -eq 0 ]; then
- showhelp
- exit 1
- fi
- pool=$1
- distro=${2:-$pool}
- basepath="/var/cache/pbuilder/cow-$pool"
- aptcache="/var/cache/pbuilder/aptcache-$pool/"
- buildresult="$HOME/src/pbuild-$pool/"
- makepaths=''
- for path in "$basepath" "$aptcache" "$buildresult"; do
- if [ ! -d "$path" ]; then
- echo "W: path \"$path\" does not exist"
- makepaths='yes'
- fi
- done
- if [ "$makepaths" = 'yes' ]; then
- if [ "$force" != 'yes' ]; then
- echo -n 'Create the missing paths (y/N)? '
- read response
- case "$response" in
- y|Y)
- :
- ;;
- *)
- exit1 "Cannot continue without those missing paths"
- ;;
- esac
- fi
- fi
- mkdir "$buildresult"
- sudo mkdir "$basepath" "$aptcache"
- sudo cowbuilder --create \
- --buildresult "$buildresult" \
- --distribution "$distro" \
- --basepath "$basepath" \
- --aptcache "$aptcache" \
- ${3:+--othermirror "$3"}
|