mirror of
https://github.com/clearlinux/vm-timing-report.git
synced 2026-04-28 10:53:34 +00:00
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:
@@ -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
61
data/vm-report.init
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user