#!/bin/sh /etc/rc.common
START=90
# place your own startup commands here
#
# REMEMBER: You *MUST* place an '&' after launching programs you 
#   that are to continue running in the background.
#
#   i.e. 
#   BAD:  upnpd
#   GOOD: upnpd &
# 
# Failure to do this will result in the startup process halting
# on this file and the diagnostic light remaining on (at least
# for WRT54G(s) models).
#

config_cb() {                                                   
if [ "$2" == "shfs" ] ; then                                    
    SHFS_BOOT=$1                                                
fi                                                              
}                                                              
                                                               
config_load fstab                                              
                                                               
start() {                                                      
                                                               
if [ "$SHFS_BOOT" == "boot" ]                                  
then                                                          
  config_get SHFS_HOST shfs host        
  #config_get SHFS_KEY shfs key         
  config_get SHFS_USER  shfs user                               
  config_get SHFS_DIR shfs dir                                  
  shfsmount  -c  "ssh -y -i /etc/dropbear/${SHFS_HOST}.key  %u@%h /bin/bash" \
     ${SHFS_USER}@${SHFS_HOST}:${SHFS_DIR} /mnt/1&                            
                                                                                                                                                        
fi                                                                            
                                                                              
CUS_EXT=/mnt/1/etc/init.d/custom-user-startup                                 
if [ -x "$CUS_EXT" ]                                                          
then                                                                          
. $CUS_EXT                                                                    
fi                                                                            
                                                                              
}                                                                             
                                                                              
stop() {                                                                      
                                                                              
if [ "$SHFS_BOOT" == "boot" ]                                                 
then                                                                          
  umount /mnt/1                                                               
fi                                                                            
                                                                              
}  
