default_install  &&
cd  doc  &&
make  install-man  &&

local CAMERALIST   &&
CAMERALIST=$INSTALL_ROOT/usr/lib/libgphoto2/print-camera-list  &&
# Installs fdi files for use with HAL 
if spell_ok hal; then
    message "\nInstalling hal fdi data"  &&
    local FDI=${INSTALL_ROOT}/usr/share/hal/fdi/information/10freedesktop   &&
    mkdir -p $FDI  &&
    $CAMERALIST hal-fdi >$FDI/10-camera-libgphoto2.fdi
fi                 &&

# Produce a udev rules file for all the cameras
if spell_ok udev; then
  local TMP_DIR="/tmp"
  local RULE="85-gphoto2.rules"
  local TMP_RULE="$TMP/$RULE"
  local RULE_DIR="$INSTALL_ROOT/lib/udev/rules.d"

  message "\nInstalling udev rules file in $RULE_DIR/$RULE\n"
# asssume udev > 136
  $CAMERALIST udev-rules version 136 script $GP_RUN  > $TMP_RULE  &&
  install -m 644 $TMP_RULE $RULE_DIR          &&
  rm -f $TMP_RULE
else
    # Else we fallback on the old method using hotplug stuff
    if spell_ok hotplug; then
        # create list of cameras
        local DEST=${INSTALL_ROOT}/etc/hotplug/usb                              &&
        mkdir -p $DEST                                                          &&
        local FF=$DEST/usbcam                                                   &&
        $CAMERALIST usb-usermap usbmap > ${FF}.usermap                          &&
        if [ ! -f $FF ];then  
             # enable hotplug to set permissions for device
             cp ${INSTALL_ROOT}/usr/share/doc/libgphoto2/linux-hotplug/usbcam.group $FF &&
             chmod u+x $FF                                                         &&   
             sed -i -e "s/=camera/=video/" $FF
        fi
    fi
fi
