#!/bin/sh -e
# Author: Brian Murray <brian@canonical.com>
# Copyright (C) 2009 Canonical, Ltd.
# License: GPLv3

loc=$(dirname "$0")

if [ "$1" != "--package" ]; then
    echo "Must specify --package followed by a package name" >&2
    exit 1
else
    shift || true
    package="$1"
fi
if [ -z "$package" ]; then
    echo "Must specify package name" >&2
    exit 1
fi
shift || true

comment="Thank you for taking the time to report this bug and helping to make Ubuntu better. This bug did not have a package associated with it, which is important for ensuring that it gets looked at by the proper developers.  You can learn more about finding the right package at https://wiki.ubuntu.com/Bugs/FindRightPackage.  I have classified this bug as a bug in $package.

When reporting bugs in the future please use apport, either via the appropriate application's \"Help -> Report a Problem\" menu or using 'ubuntu-bug' and the name of the package affected.  You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs."

for b in "$@"; do
    "$loc"/update-bug --comment "$comment" --package "$package" $b || {
        echo "ERROR with LP: #$b" >&2
    }
done

