Annexe D : A few script
if [ ! -z $GETD_AT_MOUNT ]; then
    # open gqview too see pics...
    gqview $GETD_PATH &

    # save pid, will automatically close it on exit...
    echo "$!" > /tmp/GQVIEW_PID

else
    # kill the viewer...
    GQVIEW_PID=`cat /tmp/GQVIEW_PID`
    kill -s SIGQUIT "$GQVIEW_PID"
    exit 0
fi

# change for the dir you want
WORK_DIR=/mnt/work

if [ ! -z $GETD_AT_MOUNT ]; then
    # update the local copy when plug the device :
    cp -druxfp "$GETD_PATH/"* "$WORK_DIR"

else
    # end : synch with the travelling disk
    cp -druxfp "$WORK_DIR/"* "$GETD_PATH"

    # you can check the return status and popup an info window like that :
    if [  $?  != 0 ]; then
        getd-dialog -t error "error while backing up files. target may be full" &

        # inform GETD of error, that will stop the umount process....
        exit 255
    else
        getd-dialog -t info "backup done" &
        exit 0
    fi
fi
# the mount point for this crypted virtual disk, file name and cipher type
VIRTUAL_DISK=/mnt/virtual_disk
VIRTUAL_DISK_CRYPT_TYPE=des_ede3
VIRTUAL_DISK_FILE=cpfile

# ##################################
# what to do at mount
# ##################################
at_mount() {
    # will request passwork from user
  PASS=`getd-dialog -t password -m "Password for crypted file"`
  CODE=$?


    if [ -z $PASS ]; then
        # abort, may popup but kind of borring....
        exit 0
    fi

    if [ $CODE != 251 ]; then
        # abort, may popup but kind of borring....
        exit 0
    fi

    # suppose the slot 7 is always empty, descriptor 6 too
    echo $PASS | cat > ~/tmp_pass
    exec 6< ~/tmp_pass
    rm ~/tmp_pass
    losetup -e "$VIRTUAL_DISK_CRYPT_TYPE" -p 6 -k 256 /dev/loop7  "$GETD_PATH/$VIRTUAL_DISK_FILE"
    CODE=$?

    if [ $CODE != 0 ] ; then
        getd-dialog -t error -m "cannot attach file to loopback" &
        exit 255
    fi

    mount /dev/loop7 "$VIRTUAL_DISK"

    if[ $? != 0 ] ; then
        getd-dialog -t error -m "mounting of crypted disk fail" &
        losetup -d /dev/loop7
        exit 255
    fi

    # you have a new volume !!!!!!
   return 0
}

# ####################################
# and on umount
# ####################################
at_umount() {
    umount /dev/loop7
    if [ $? != 0 ]; then
         # in use, no need of message, GETD will do it
         exit 255
    fi

    losetup -d /dev/loop7
    return
}

# ##########################################
# real beginning
# ##########################################
if [ ! -z $GETD_AT_MOUNT ]; then
    at_mount
else
    at_umount
    exit 0
fi

# mount external HDD with 2 vfat partition, ID 1 and 5 ( sdx1, sdx5 )

# performer AFTER ( auto ) mouting of the partition 1 by getd
at_mount()
{
    # partition a mount : 5 ( /dev/sdx5 ) on mount point /mnt/usb/sauve_b
    mount -t vfat -o noexec $GETD_MAIN_DEV"5" /mnt/usb/sauve_b
    CODE=$?
    if [ $CODE != 0 ] ; then
        getd-dialog -t error -m "Can't mount second usb storage" &
        exit 255
    fi

   # copy the previous code for more partition....
}

# performer BEFORE getd umount the partition 1
at_umount()
{
    umount /mnt/usb/sauve_b
    CODE=$?
    if [ $CODE != 0 ] ; then
        getd-dialog -t error -m "Can't Umount second usb storage" &
        exit 255
    fi

   # copy the previous code for more partition....
}

# what has to be done...
if [ ! -z $GETD_AT_MOUNT ]; then
    at_mount
else
    at_umount
fi
exit 0