#!/bin/sh # meego-contacts-import ####################################################### # Copyright: (C) 2011 MeeGo # License: DO WHAT YOU WANT TO PUBLIC LICENSE # Authors: Gary Birkett, liquid@gmail.com # Tom Swindell, ####################################################### # 20110613_1200 gb # ####################################################### # # minimal script to mount and import Maemo Contacts under very specific circumstances. # ####################################################### # # Setup some globals importcompletedflagfile="/var/lib/maemo-contacts-already-imported" importmountfs="/dev/mmcblk1p1" importmountdir="/media/maemoMyDocs" importfolder="/media/maemoMyDocs/Exported\ contacts" importcommand="/usr/bin/Maemo-Contacts-ImportNow" ####################################################### # # check if we have already completed import [ -e $importcompletedflagfile ] && return 0 ####################################################### # # Check there is a mountpoint to linkup with if [ -z "fdisk -l | grep $importmountfs" ] then # expected mount NOT found, we do not continue return 0 fi ####################################################### # # ensure there is a mountfolder to linkup with if [ ! -d $importmountdir ] then mkdir $importmountdir fi ####################################################### # # Mount the Maemo Filesystem READONLY mount -t vfat -o ro "$importmountfs" "$importmountdir" ####################################################### # # Check the Exported Contacts folder if [ ! -d $importfolder ] then # No Maemo data to import. # unmount and exit umount "$importmountfs" return 0 fi ####################################################### # # Run the import process $importcommand $importfolder ####################################################### # # unmount the filesystem umount "$importmountfs" ####################################################### # # Set the flag so we do not repeat this operation touch $importcompletedflagfile return 0