Introduce remainder of Ubuntu support

Note Ubuntu does not currently use or properly support systemd, so we
cannot obtain a nice systemd-analyze output. So for now we'll just emit
the "uptime" number, which is entirely incorrect but cannot be helped,
and is just a formatting placeholder until Ubuntu 14.10 stable supports
systemd.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2014-08-07 18:01:50 +01:00
parent 27c281d8bd
commit 5bfc504fda
4 changed files with 73 additions and 3 deletions

View File

@@ -9,12 +9,14 @@ bin_PROGRAMS = \
vm-timing-report
bin_SCRIPTS = \
scripts/spin-from-raw.sh
scripts/spin-from-raw.sh \
scripts/gen-ubuntu-rawfs.sh
supportdir = $(datadir)/vm-timing-report
support_DATA = \
scripts/vm-report.sh \
data/vm-report.service
data/vm-report.service \
data/vm-report.init
vm_timing_report_SOURCES = \
src/vm-timing-report.c
@@ -32,5 +34,7 @@ EXTRA_DIST = \
LICENSE \
scripts/vm-report.sh \
scripts/spin-from-raw.sh \
scripts/gen-ubuntu-rawfs.sh
data/vm-report.init
data/vm-report.service

61
data/vm-report.init Normal file
View File

@@ -0,0 +1,61 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: vm-timing-report
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the vm-timing-report service
# Description: VM Timing Report script
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/vm-report
NAME=vm-timing-report
DESC="VM Timing Report"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
test -x $DAEMON || exit 0
set -e
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" $NAME
if ! start-stop-daemon --start --quiet \
--pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
then
log_end_msg 1
else
log_end_msg 0
fi
;;
stop)
log_daemon_msg "Stopping $DESC" $NAME
if start-stop-daemon --stop --retry 30 --quiet \
--pidfile $PIDFILE --exec $DAEMON
then
rm -f $PIDFILE
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
$0 stop
$0 start
;;
status)
status_of_proc -p "$PIDFILE" "$DAEMON" vm-timing-report && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

View File

@@ -51,6 +51,7 @@ install -m 0700 /usr/share/vm-timing-report/vm-report.init $MOUNTPOINT/etc/init.
install -m 0755 /usr/share/vm-timing-report/vm-report.sh $MOUNTPOINT/usr/bin/vm-report
chroot $MOUNTPOINT update-rc.d vm-report defaults
chroot $MOUNTPOINT update-rc.d vm-report enable
sleep 1
sync

View File

@@ -21,7 +21,11 @@ done
while :
do
ANALYZE="`systemd-analyze`"
if [[ -e /usr/lib/upstart || ! -e /dev/virtio-ports/serial0 ]]; then
ANALYZE="`uptime`"
else
ANALYZE="`systemd-analyze`"
fi
if [[ $? -ne 0 ]]; then
# Must wait for systemd-analyze to report a boot time,
# otherwise this is not considered "booted"