#!/bin/sh MOUNT_POINT=$(hal-get-property --udi "$1" --key volume.mount_point) if test -z "$MOUNT_POINT"; then gthumb --import-photos else ROOT=${MOUNT_POINT} dcim=$(ls "${ROOT}" | grep -i dcim) if [ $? -eq 0 ]; then ROOT="${ROOT}/$dcim" # if there is only one dir in the dcim directory, enter it if test $(/bin/ls -1 "${ROOT}" | wc -l) -eq 1; then ROOT="${ROOT}/$(ls -1 "${ROOT}" | head -n 1)" fi fi exec /usr/bin/gthumb "${ROOT}" fi