1#!/bin/sh -e
2#
3#    apport: note if there are crash dumps available for apporting
4#
5#    Copyright (C) 2009 Canonical Ltd.
6#    Copyright (C) 2011-2014 Dustin Kirkland
7#
8#    Authors: Dustin Kirkland <kirkland@byobu.org>
9#
10#    This program is free software: you can redistribute it and/or modify
11#    it under the terms of the GNU General Public License as published by
12#    the Free Software Foundation, version 3 of the License.
13#
14#    This program is distributed in the hope that it will be useful,
15#    but WITHOUT ANY WARRANTY; without even the implied warranty of
16#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17#    GNU General Public License for more details.
18#
19#    You should have received a copy of the GNU General Public License
20#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22__apport_detail() {
23	for i in /var/crash/*.crash; do
24		if [ -f "$i" ]; then
25			printf "\nTo file bugs on the existing crash reports, run:\n"
26			which apport-cli >/dev/null || printf "  sudo apt-get install apport\n"
27			for i in /var/crash/*.crash; do
28				printf "  apport-cli $i\n"
29			done
30			printf "\nTo clear the pending reports:\n"
31			printf "  rm -f /var/crash/*.crash\n\n"
32			return
33		fi
34	done
35	printf "No pending crash reports\n"
36}
37
38__apport() {
39	# Print {!} if a /var/crash/*.crash file exists
40	for i in /var/crash/*.crash; do
41		if [ -f "$i" ]; then
42			color y k; printf "{!}"; color --
43			return
44		fi
45	done
46	rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/apport"*
47}
48
49# vi: syntax=sh ts=4 noexpandtab
50