aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-apt-config
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2010-01-25 12:00:31 +0100
committerLoïc Minier <lool@dooz.org>2010-01-25 12:00:31 +0100
commit039e4d658e23b6a9af1242d0b3d21bd652f697a1 (patch)
tree1317d1fa41c14dfc7cf43df1606561d7b252cd9a /pbuilder-apt-config
parent88921aaabaf4ea6bd71605682efc34e387b66019 (diff)
downloadpbuilder-039e4d658e23b6a9af1242d0b3d21bd652f697a1.tar
pbuilder-039e4d658e23b6a9af1242d0b3d21bd652f697a1.tar.gz
Add support for outputting deb-src lines
Diffstat (limited to 'pbuilder-apt-config')
-rwxr-xr-xpbuilder-apt-config56
1 files changed, 47 insertions, 9 deletions
diff --git a/pbuilder-apt-config b/pbuilder-apt-config
index 7dd84a4..3a042d8 100755
--- a/pbuilder-apt-config
+++ b/pbuilder-apt-config
@@ -6,7 +6,6 @@ set -e
self="$(basename "$0")"
# TODO
-# - handle enabling/disabling deb-src
# - currently only handles a single --suite or --profile; allow multiple ones?
# - nicer error messages
# - default output when neither --suite nor --profile is set?
@@ -19,8 +18,8 @@ log() {
}
usage() {
- log "$self [--arch=<arch>] [--components=<comp1>,<comp2>] [--mirror=<mirror>] [--suite=<suite>] [--pockets=<pocket1>,<pocket2>]" >&2
- log "$self [--arch=<arch>] [--components=<comp1>,<comp2>] [--profile=<profile>]" >&2
+ log "$self [--with-sources=[yes|no|disabled]] [--arch=<arch>] [--components=<comp1>,<comp2>] [--mirror=<mirror>] [--suite=<suite>] [--pockets=<pocket1>,<pocket2>]" >&2
+ log "$self [--with-sources=[yes|no|disabled]] [--arch=<arch>] [--components=<comp1>,<comp2>] [--profile=<profile>]" >&2
}
die() {
@@ -74,10 +73,35 @@ guess_vendor_arch_mirror() {
esac
}
-getopt_output="`getopt -o "" -l arch:,components:,mirror:,suite:,pockets:,profile: -n "$self" -s sh -- "$@"`"
+output_sources() {
+ local with_sources="$1"
+ local mirror="$2"
+ local dist="$3"
+ local components="$4"
+
+ case "$with_sources" in
+ yes)
+ echo "deb $mirror $dist $components"
+ echo "deb-src $mirror $dist $components"
+ ;;
+ disabled)
+ echo "deb $mirror $dist $components"
+ echo "#deb-src $mirror $dist $components"
+ ;;
+ no)
+ echo "deb $mirror $dist $components"
+ ;;
+ *)
+ die 'with_sources must be either "yes", "disabled", or "no"'
+ ;;
+ esac
+}
+
+getopt_output="`getopt -o "" -l with-sources::,arch:,components:,mirror:,suite:,pockets:,profile: -n "$self" -s sh -- "$@"`"
eval set -- "$getopt_output"
+with_sources="disabled"
arch="`dpkg --print-architecture`"
components="main"
mirror=""
@@ -88,6 +112,20 @@ profile=""
while :; do
case "$1" in
+ --with-sources)
+ case "$2" in
+ "")
+ with_sources="yes"
+ ;;
+ yes|no|disabled)
+ with_sources="$2"
+ ;;
+ *)
+ die '--with-sources must be either "yes", "disabled", or "no"'
+ ;;
+ esac
+ shift 2
+ ;;
--arch)
arch="$2"
shift 2
@@ -182,9 +220,9 @@ if [ -n "$profile" ]; then
fi
;;
esac
- echo "deb $base_mirror $base_dist $components"
+ output_sources "$with_sources" "$base_mirror" "$base_dist" "$components"
if [ -n "$mirror" ]; then
- echo "deb $mirror $profile $components"
+ output_sources "$with_sources" "$mirror" "$profile" "$components"
fi
;;
ubuntu)
@@ -204,9 +242,9 @@ if [ -n "$profile" ]; then
fi
;;
esac
- echo "deb $base_mirror $base_dist $components"
+ output_sources "$with_sources" "$base_mirror" "$base_dist" "$components"
for pocket in $pockets; do
- echo "deb $base_mirror $base_dist-$pocket $components"
+ output_sources "$with_sources" "$base_mirror" "$base_dist-$pocket" "$components"
done
;;
*)
@@ -223,7 +261,7 @@ if [ -n "$suite" ]; then
fi
mirror="`guess_vendor_arch_mirror "$vendor" "$arch"`"
fi
- echo "deb $mirror $suite $components"
+ output_sources "$with_sources" "$mirror" "$suite" "$components"
exit 0
fi