#!/bin/sh
if test -f /tmp/patch-lwsm; then
    echo "enabling lwsm"
    isi services -a lwsm enable
    rm -f /tmp/patch-lwsm
fi
if test -f /tmp/patch-auth; then
    echo "enabling auth"
    isi services -a auth enable
    rm -f /tmp/patch-auth
fi
if test -f /tmp/patch-smb; then
    echo "enabling smb"
    isi services -a smb enable
    rm -f /tmp/patch-smb
fi

# Restart papi since we changed libisi_smb.so
pkill isi_papi_d

sleep 10
for SERVICENAME in lwreg lsass lwio netlogon npfs onefs rdr srv srvsvc
do
    if ! /usr/likewise/bin/lwsm status $SERVICENAME |grep running ; then
	echo "starting $SERVICENAME"
	/usr/likewise/bin/lwsm start $SERVICENAME
    fi
done

exit 0
