TYPE3
[iec.git] / src / type3_AndroidCloud / anbox-master / scripts / collect-bug-info.sh
1 #!/bin/sh -e
2
3 TMPDIR=$(mktemp -d)
4
5 if [ $(id -u) -ne 0 ] ; then
6         echo "WARNING: You're not running as root. This will prevent the script from"
7         echo "         adding a few important file for bug diagnostics to the report."
8         echo "         If you want to have a look at the script before giving it root"
9         echo "         access, please have a look at $0."
10         exit 0
11 fi
12
13 echo "This script will collect a few interesting things which developers will"
14 echo "need to have a better insight into the Anbox system when something goes"
15 echo "wrong."
16 echo
17 echo "PLEASE NOTE: The collected log files may collect information about your"
18 echo "system. Please have a look before you're sending them to anyone!"
19 echo
20 echo "Collecting anbox log files ... "
21
22 set -x
23 # Collect several things which are of interest for bug reports
24 cp /var/snap/anbox/common/data/system.log $TMPDIR || true
25 cp /var/snap/anbox/common/containers/lxc-monitord.log $TMPDIR || true
26 cp /var/snap/anbox/common/logs/container.log $TMPDIR || true
27 cp /var/snap/anbox/common/logs/console.log* $TMPDIR || true
28 $SNAP/command-anbox.wrapper system-info > $TMPDIR/system-info.log 2>&1 || true
29
30 if [ -e /etc/systemd/system/snap.anbox.container-manager.service ]; then
31         sudo journalctl --no-pager -u snap.anbox.container-manager.service > $TMPDIR/container-manager.log 2>&1 || true
32 fi
33 set +x
34
35 echo
36 echo "DONE!"
37
38 echo
39 echo "Do you want to include the kernel log of your system? [y/N]"
40 read -r action
41 if [ "$action" = "y" ]; then
42         set -x
43         dmesg > $TMPDIR/kernel.log 2>&1
44         set +x
45 fi
46
47 echo "Generating archive with all log files in $PWD ..."
48 CURDIR=$PWD
49 (cd $TMPDIR; zip -r $CURDIR/anbox-system-diagnostics-$(date --rfc-3339=date --utc).zip *)
50 rm -rf $TMPDIR
51 echo "DONE!"
52
53 echo
54 echo "Now please take the ZIP archive generated in your current directory"
55 echo "and attach it to your bug report. Please don't hesitate to have a"
56 echo "look into the archive before you do so to verify you don't leak any"
57 echo "information you don't want!"