# plymouth-ready - send an event to indicate plymouth is up
#
# This job checks that plymouth-splash is running, or that plymouth
# is up if it was started from initrd. The login managers use the
# event to avoid a race with plymouth-splash:
#
# https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/982889

description "Send an event to indicate plymouth is up"

task
start on startup or started plymouth-splash
instance $UPSTART_EVENTS

emits plymouth-ready

script
  if [ "$UPSTART_EVENTS" = started ] || \
     status plymouth-splash | grep -q "start/started" || \
     plymouth --ping
  then
    initctl emit plymouth-ready
  fi
end script
