# check if current sorcery and coreutils are installed
if  [  !  -f  $SGL_LIBRARY_MODULES/libinitd  ]  ;  then
  message -n "${PROBLEM_COLOR}"

  message "You need a newer sorcery to install the simpleinit init system."
  message "Please update your sorcery to the latest devel version and recast"
  message "init.d afterwards!"

  message -n "${DEFAULT_COLOR}"
  message "If you cast init.d as part of an install queue, e.g. during a"
  message "'sorcery system-update', then you can rerun the install queue"
  message "with 'cast --queue' after updating sorcery."
  return 1
fi
if  [  !  -x  /bin/false  ]  ;  then
  message -n "${PROBLEM_COLOR}"

  message "Some init scripts depend on the program /bin/false which is missing"
  message "from your system, please 'cast -c coreutils' and recast init.d!"

  message -n "${DEFAULT_COLOR}"
  message "If you cast init.d as part of an install queue, e.g. during a"
  message "'sorcery system-update', then you can rerun the install queue"
  message "with 'cast --queue' after casting coreutils."
  return 1
fi

message -n "${SPELL_COLOR}"

# First installation of new system
if  [  !  -e  /etc/init.d/smgl_init  ]  ;  then
  message "To ensure proper shutdown of the computer after just installing the new initsystem, please use the 'tshutdown' program. This program will make sure the drives are unmounted and that any services are closed."
  message "The 'tshutdown' program will halt the computer directly, it does not support any arguments."
  message

  unset INITSCRIPTS     # Force the user to redo init script selection
fi

message "IMPORTANT: Answer 'y' when asked about installing initscripts and default providers below unless you know exactly what you are doing."

message -n "${DEFAULT_COLOR}"

# Kludge to make sure the prompts to set the default providers for the new (in
# init.d 2.2.0) facilities default to "y" the first time so we don't make
# systems unbootable after an unattended update.  Remove during stable-rc/0.7.
if [ -r $INSTALL_ROOT/etc/sysconfig/facilities ] && \
  ! grep -q "root_fs" $INSTALL_ROOT/etc/sysconfig/facilities
then
  echo -e "\nroot_fs=mountroot.sh" >> $INSTALL_ROOT/etc/sysconfig/facilities
fi

