
#!/bin/sh
###
# Place the autoscan-network init script.
###
config() {
  NEW="$1"
  OLD="`dirname $NEW`/`basename $NEW .new`"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}


config etc/rc.d/rc.autoscan-network.new


###
# Use rc.local to start Autoscan-Network at boot.
###

# if rc.autoscan-network is executable, run it on startup
run=`grep ". /etc/rc.d/rc.autoscan-network" etc/rc.d/rc.local`
if [[ "${run}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local

# Autoscan-Network
# To disable Autoscan-Network chmod rc.autoscan-network to 644
if [ -x /etc/rc.d/rc.autoscan-network ]; then
	sh /etc/rc.d/rc.autoscan-network start
fi
EOF
fi


###
# Use rc.local_shutdown to stop Autoscan-Network daemon
###

# if rc.autoscan-network is executable, stop on shutdown
chmod +x /etc/rc.d/rc.local_shutdown
run=`grep ". /etc/rc.d/rc.autoscan-network" etc/rc.d/rc.local_shutdown`
if [[ "${run}" == "" ]]; then
cat << EOF >>etc/rc.d/rc.local_shutdown

# To disable Autoscan-Network shutdown, chmod rc.autoscan-network to 644
if [ -x /etc/rc.d/rc.autoscan-network ]; then
  . /etc/rc.d/rc.autoscan-network stop
fi
EOF
fi
#



if [ -x /usr/bin/update-mime-database ]; then
  /usr/bin/update-mime-database /usr/share/mime &> /dev/null
fi

if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database 1> /dev/null &> /dev/null
fi

if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache  -f -q /usr/share/icons/hicolor &> /dev/null
fi

