/usr/bin/phablet-bootchart is in phablet-tools 1.2+16.04.20160317-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | #! /bin/sh
set -eu
TMPDIR=$(mktemp -d /tmp/$(basename $0).XXXXX)
SUITE="trusty"
PREFIX="ubuntu-phablet"
CHARTOPTS="${CHARTOPTS---crop-after=unity8 --annotate=unity8}"
SKIPINST=""
KEEPTAR=""
PNOPTS=""
BUILDID=""
OUTDIR="."
SFX="png"
ERROR=""
ADBOPTS=""
YESTOALL=""
cleanup(){
[ -n "$ERROR" ] && echo "Error: $ERROR"
[ -d "$TMPDIR" ] && rm -rf $TMPDIR >/dev/null 2>&1
}
usage(){
cat <<EOF
Usage: $(basename $0) (Options) [build id]
Options:
-n|--noinstall do not perform installation
-k|--keeptarball keep tarball around
-w|--wlancfg <path to wlan file> point to wlan config
-o|--outdir <path to output directory> define (and create) output dir
-f|--format (png|svg) output format (default: png)
-s|--serial <adb serial> operate on certain adb device
-y|--yes-to-all do not ask when wiping (for automation)
If [build id] is provided this image will be used for installation
EOF
exit 0
}
reboot_and_wait(){
adb $ADBOPTS reboot && adb $ADBOPTS wait-for-device
[ -n "$1" ] && sleep $1
}
do_install(){
if [ -z "$YESTOALL" ]; then
echo -n "This will wipe all data on the device, proceed ? (y/n) "
read yesno
[ "$yesno" != "y" ] && exit 1
fi
echo "Installing Image $1"
if [ -z "$(fastboot devices)" ]; then
adb $ADBOPTS reboot bootloader || \
ERROR="can not reboot to bootloader" exit 1
fi
FLASHOPTS="--developer-mode --password 0000 --channel devel-proposed --bootstrap"
[ -n "$1" ] && FLASHOPTS="${FLASHOPTS} --revision $1"
ubuntu-device-flash $FLASHOPTS
adb $ADBOPTS wait-for-device
}
trap cleanup EXIT INT QUIT ILL KILL SEGV TERM
[ -x /usr/bin/pybootchartgui ] || ERROR="please install pybootchartgui" exit 1
while [ $# -gt 0 ]; do
case "$1" in
-n|--noinstall)
SKIPINST=1
;;
-y|--yes-to-all)
YESTOALL=1
;;
-k|--keeptarball)
KEEPTAR=1
;;
-w|--wlancfg)
[ -n "$2" ] && PNOPTS="-n $2" shift || \
ERROR="-w needs a file path" exit 1
;;
-s|--serial)
[ -n "$2" ] && ADBOPTS="$ADBOPTS -s $2" shift || \
ERROR="-s needs serial" exit 1
;;
-f|--format)
if [ -n "$2" ]; then
SFX="$2" shift || \
ERROR="-f needs png or svg as argument" exit 1
CHARTOPTS="$CHARTOPTS -f $SFX"
fi
;;
-o|--outdir)
[ -n "$2" ] && OUTDIR="$2" shift || \
ERROR="-o needs a path" exit 1
[ -d "$OUTDIR" ] || mkdir -p $OUTDIR
;;
-h|--help)
usage
;;
*[0-9])
BUILDID=$1
;;
*)
ERROR="$1 is unknown" exit 1
;;
esac
shift
done
[ -z "$SKIPINST" ] && do_install "$BUILDID"
echo "Enabling network"
phablet-network $PNOPTS || \
ERROR="need working network on the device" exit 1
echo "Making Image writable"
phablet-config writable-image || \
ERROR="could not make image writable" exit 1
reboot_and_wait 30
echo "Installing bootchart"
adb $ADBOPTS shell "echo 0000|sudo -p \"\" -S \
FLASH_KERNEL_SKIP=true apt-get install -yq --force-yes bootchart"
echo "Disabling Welcome Wizard"
phablet-config welcome-wizard --disable || \
ERROR="could not disable welcome wizard" exit 1
echo "Disabling Intro Demo"
phablet-config edges-intro --disable || \
ERROR="could not disable intro" exit 1
echo "Rebooting three times to get accurate data"
reboot_and_wait 60
reboot_and_wait 60
reboot_and_wait 1
adb $ADBOPTS shell "echo 0000|sudo -p \"\" -S rm -rf /var/log/bootchart/*"
sleep 60
echo "Pulling and processing bootchart tarball"
while [ -n "$(adb $ADBOPTS shell pgrep collector)" ]; do
sleep 30
done
sleep 30
adb $ADBOPTS pull /var/log/bootchart $TMPDIR/
VER="$(adb $ADBOPTS shell system-image-cli -i | grep "^.* ver" | tr -d '[:cntrl:]')"
VER="${VER##* }"
SUITE="$(adb $ADBOPTS shell lsb_release -cs | tr -d '[:cntrl:]')"
echo "Creating $SFX for $VER."
OUTNAME="$OUTDIR/$PREFIX-$SUITE-$VER"
CHARTOPTS="$CHARTOPTS -o $OUTNAME.$SFX"
pybootchartgui -q $CHARTOPTS $TMPDIR/*.tgz >/dev/null 2>&1
if [ -n "$KEEPTAR" ]; then
cp $TMPDIR/*.tgz $OUTNAME.tgz
echo "Keeping tarball at $OUTNAME.tgz"
fi
echo "Created $OUTNAME.$SFX"
|