DPKGARCH=$(dpkg --print-architecture)
UNAMEARCH=$(uname -m)
-if [ "${1:-}" = "buildd" ]; then
- MODE=buildd
- if ! [ -d /srv/buildd/ ]; then
- echo >&2 "Error: /srv/buildd does not exist or is not a directory."
+usage()
+{
+cat << EOF
+usage: $0 [<options>] [buildd]
+
+OPTIONS:
+ -c write config only
+ -h this help
+EOF
+}
+
+extraargs=""
+while getopts "cu" OPTION
+do
+ case $OPTION in
+ c)
+ extraargs="$extraargs -c"
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ *)
+ usage >&2
+ exit 1
+ ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "$#" -gt 1 ]; then
+ usage >&2
+ exit 1
+elif [ "$#" = 1 ]; then
+ if [ "${1:-}" = "buildd" ]; then
+ MODE=buildd
+ if ! [ -d /srv/buildd/ ]; then
+ echo >&2 "Error: /srv/buildd does not exist or is not a directory."
+ exit 1
+ fi
+ else
+ usage >&2
exit 1
fi
else
case "$MODE" in
buildd)
mkdir -p /srv/buildd/unpack
- if ! $SILENT setup-dchroot -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s"
+ if ! $SILENT setup-dchroot $extraargs -f -a "$a" $extra -D -d '/srv/buildd/unpack' -K "$s"
then
return 1
fi
;;
porterbox)
- if ! $SILENT setup-dchroot -f -a "$a" $extra "$s"
+ if ! $SILENT setup-dchroot $extraargs -f -a "$a" $extra "$s"
then
return 1
fi