PERFORCE change 123027 for review

Constantine A. Murenin cnst at FreeBSD.org
Fri Jul 6 18:37:17 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=123027

Change 123027 by cnst at dale on 2007/07/06 18:37:09

	Improved the script, now it creates the dev/lm directory if it doesn't exist, and renames the files if they already exist, so that the new files can be linked. (Previously, it was just giving errors in these circumstances.)

Affected files ...

.. //depot/projects/soc2007/cnst-sensors/sensors.ln.sh#2 edit

Differences ...

==== //depot/projects/soc2007/cnst-sensors/sensors.ln.sh#2 (text+ko) ====

@@ -1,12 +1,24 @@
 #!/bin/sh
-# $P4: //depot/projects/soc2007/cnst-sensors/sensors.ln.sh#1 $
+# $P4: //depot/projects/soc2007/cnst-sensors/sensors.ln.sh#2 $
 # Author: Constantine A. Murenin, 2007-07
 
 # This file creates symbolic links for GSoC2007 cnst_sensors project
 
 SPREFIX=`pwd`		#source prefix, i.e. this directory	XXX
 TPREFIX=${@:-/usr/src}	#target prefix, i.e. /usr/src
-#echo "Target prefix: $PREFIX"
+#echo "Source prefix: $SPREFIX;	Target prefix: $TPREFIX"
+
+#create some directories that are specific for this project,
+#if they don't exist already
+for i in "sys/dev/lm"
+do
+	DIR2C=$TPREFIX/$i	#directory to create
+	if [ ! -d $DIR2C ]
+	then
+		mkdir $DIR2C && \
+			echo "Created $DIR2C"
+	fi
+done
 
 for i in `find ./ -name "*.*" -type d`
 do
@@ -23,6 +35,10 @@
 		then
 #			echo "Removing $TFILE" && ls -l $TFILE
 			rm $TFILE
+		elif [ -f $TFILE ]
+		then
+			mv $TFILE $TFILE.orig.`date +%Y-%m-%dT%H%M%S%z` && \
+				echo "File $TFILE renamed"
 		fi
 		ln -sh $SFILE $TFILE || \
 			echo "File $FILEINDIR not copied to $TDIR, file already exists"


More information about the p4-projects mailing list