Meego Wiki
Views

ARM/N900/DataManagement/ContactsImportScript

From MeeGo wiki
< ARM | N900 | DataManagement
Revision as of 13:58, 13 June 2011 by Lcuk (Talk | contribs)
Jump to: navigation, search
  1. !/bin/bash
# meego-contacts-import ####################################################### # Copyright: (C) 2011 MeeGo # License: DO WHAT YOU WANT TO PUBLIC LICENSE # Authors: Gary Birkett, liquid@gmail.com # Tom Swindell, # Sage ####################################################### # 20110613_1200 gb # ####################################################### # # minimal script to perform following actions: # Bail if We already ran the import # Ensure mount points are available # Mount Maemo EMMC Read Only # Import Contacts # Unmount Maemo EMMC # Smile :) ####################################################### # # Setup some globals importcompletedflagfile="/var/lib/maemo-contacts-already-imported" importmountfs="/dev/mmcblk1p1" importmountdir="/media/maemoMyDocs" importfolder="${importmountdir}/Exported\ contacts" importcommand="/usr/bin/qtcontacts-vcard-import" ####################################################### # # 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 -p $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 #
Personal tools