1#! /bin/sh 2 3# Installing a Geomorph user, part 1: the directory with default POV scenes 4 5VERSION=0.60 6SOURCE_DIR=/usr/local/share/geomorph/$VERSION/scenes 7CURDIR=`pwd` 8 9cd ${SOURCE_DIR} 10 11LSCN=$(ls -F -1 *.pov) 12LINC=$(ls -F -1 *.inc) 13 14cd ${CURDIR} 15 16if [ -d $HOME/.geomorph ] 17then 18# Directory exists, rename old scenes before copying 19 20# Behaviour not implemented: If it's a second update for the same version, we don't create a _old file 21 22# Implemented: we create a _old file only if files are different 23 24 if [ -f $HOME/.geomorph/.version ] 25 then 26 OLD_VERSION=`cat $HOME/.geomorph/.version` 27 else 28 OLD_VERSION=0.01 29 fi 30 31# V=$((${VERSION/\./0})) 32# OV=$((${OLD_VERSION/\./0})) 33 34 for SCN in $LSCN 35 do 36 if [ -f $HOME/.geomorph/$SCN ] 37 then 38 if (! cmp $HOME/.geomorph/$SCN $SOURCE_DIR/$SCN) ; then 39 BNAME=$(basename $SCN .pov) 40# if [ ${V} -gt ${OV} ] ; then 41 echo $BNAME'.pov -> '$BNAME'_old.pov' 42 mv -f $HOME/.geomorph/$SCN $HOME/geomorph/$BNAME'_old.pov' 43 fi 44 fi 45 cp -f $SOURCE_DIR/$SCN $HOME/.geomorph/$SCN 46 47 done 48 for INC in $LINC 49 do 50 if [ -f $HOME/.geomorph/$INC ] 51 then 52 if [ ${INC} = "global_settings.inc" ] ; then 53 continue 54 fi 55 if (! cmp $HOME/.geomorph/$INC $SOURCE_DIR/$INC) ; then 56 BNAME=$(basename $INC .inc) 57# if [ ${V} -gt ${OV} ] ; then 58 echo $BNAME'.inc -> '$BNAME'_old.inc' 59 mv -f $HOME/.geomorph/$INC $HOME/geomorph/$BNAME'_old.inc' 60 fi 61 fi 62 cp -f $SOURCE_DIR/$INC $HOME/.geomorph/$INC 63 64 done 65else 66# Directory does not exist 67 68 mkdir -v $HOME/.geomorph 69 cp -fv /usr/local/share/geomorph/$VERSION/scenes/* $HOME/.geomorph 70 71 if [ -f $HOME/.povray/3.6/povray.ini ] 72 then 73 A=`grep Display_gamma $HOME/.povray/3.6/povray.ini | wc -l` 74 if [ $A -gt 0 ] ; then 75 echo `grep Display_gamma $HOME/.povray/3.6/povray.ini | sed s/Display_gamma/global_settings/ | sed s/\$/\}/ | sed s/=/\ {assumed_gamma\ / | sed s/\;//` > $HOME/.geomorph/global_settings.inc 76 fi 77 fi 78fi 79 80# Added 2008-03-28 - We create a geomorph/tmp directory 81# for animations and the like 82 83if [ ! -d $HOME/.geomorph/tmp ] 84then 85 mkdir -v $HOME/.geomorph/tmp 86fi 87 88echo $VERSION > $HOME/.geomorph/.version 89 90