#!/bin/sh
#
# Startup Petris
#

# Say what we are doing
echo -n "Waiting for petris"
# First wait for the libraries to become available...
while   [ ! -f /lib/libncurses.so.5 -o ! -f /lib/libc.so.6 -o ! -f /lib/ld-linux.so.2 ] ; do
  echo -n "."
  sleep 1
done
# ...then wait for petris
which petris > /dev/null
while [ $? -ne 0 ] ; do
  echo -n "."
  sleep 1
  which petris > /dev/null
done
# Keep running petris until it's killed or crashes
while [ $? -eq 0 ] ; do
    clear
    sleep 1
    petris
done
exit 0
