#!/bin/sh -e

umask 022
service=`head -1 conf-service`
command=`head -1 conf-home`
home=`env - PATH=$PATH pwd`

test -d package || ( echo 'Wrong working directory.'; exit 1 )
test -d src || ( echo 'Wrong working directory.'; exit 1 )

if test -d ${service}
then
  echo "${service} exists. I assume that svscan is already running."
  exit 0
fi

echo "Creating ${service}..."
mkdir ${service}

if test -r /etc/inittab
then
  ${home}/command/setlock /etc/inittab package/run.inittab
else
  ${home}/command/setlock /etc/rc.local package/run.rclocal
fi
