#!/bin/sh
#
#
# Copyright (c) 2000 SuSE GmbH Nuernberg, Germany.  All rights reserved.
#
# Author: Ralf Doppelstein  <ralf.doppelstein@suse.de>, 2001
# /etc/init.d/sc_ldap2authorizedkeys

### BEGIN INIT INFO
# Provides:          sc_ldap2authorizedkeys
# Required-Start:    $network $syslog sc_mkwsconfig
# Required-Stop:     $network
# Default-Start:     3 5
# Default-Stop:
# Description:       create the /root/.ssh/authorized_keys file
### END INIT INFO

. /etc/rc.status
. /etc/smartclient/base

base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Reset status of this service
rc_reset
case "$1" in
    start)
        echo -n "Creating SmartClient login environment"
        if ! /usr/bin/sc_check_net 2> $ALL_LOG_DIR/$base; then
            rc_status -s
            rc_exit
        fi
        ldap2authorizedkeys.pl > $ALL_LOG_DIR/$base 2>&1
        rc_status -v
        ;;
    stop)
        ;;
    status)
        # TODO: add status
        ;;
    *)
       echo "Usage: $0 {start|stop|status}"
       exit 1
esac
rc_exit