[SM-Commit] PERFORCE change 77008 by David Michael Leo Brown Jr. for review

Perforce Review Daemon p4review at smee.org
Thu Mar 30 02:20:01 EST 2006


Change 77008 by david_brown at dmlb2000-dmlb2004 on 2006/03/30 08:19:53

	changed to handle symlinks with a different function slightly different
	if the file exists in the system and it's a symlink in the stage root
	we should remove the file from the system and install the symlink
	if it's not a config then stage the symlink in the config stage area
	
	not sure if this is the right approach... it's not that the existsing
	file on the system should have been removed in the first place by the
	package but how do we know that's what happened or not?

Affected files ...

... //sgl/sorcery/proj/proj1/var/lib/sorcery/modules/libstage#18 edit

Differences ...

==== //sgl/sorcery/proj/proj1/var/lib/sorcery/modules/libstage#18 (xtext) ====

@@ -111,6 +111,32 @@
   esac
 }
 
+function stage_install_symlink()
+{
+  local FILE=$1
+  local SAVE=$CONFIG_STAGE_DIRECTORY/$FILE.$(date +%Y%m%d%H%M%S)
+  message "${FILE_COLOR}Symlink $FILE${DEFAULT_COLOR}"
+  case $2 in
+    config)
+      if [[ -e ${INSTALL_ROOT}/$FILE ]]
+      then
+        touch ${INSTALL_ROOT}/$FILE &&
+        mkdir -p $(dirname $SAVE) &&
+        cp -dp $STAGE_DIRECTORY/TRANSL/$FILE ${INSTALL_ROOT}/$SAVE &&
+	rm $STAGE_DIRECTORY/TRANSL/$FILE
+      else
+        cp -dp $STAGE_DIRECTORY/TRANSL/$FILE ${INSTALL_ROOT}/$FILE &&
+	rm $STAGE_DIRECTORY/TRANSL/$FILE
+      fi
+      ;;
+    *)
+      rm -f ${INSTALL_ROOT}/$FILE &&
+      cp -dp $STAGE_DIRECTORY/TRANSL/$FILE ${INSTALL_ROOT}/$FILE &&
+      rm $STAGE_DIRECTORY/TRANSL/$FILE
+      ;;
+  esac
+}
+
 #---------------------------------------------------------------------
 ## @param file
 ## install the file from the stage root to the system does check for
@@ -120,13 +146,12 @@
 {
   if [[ -h $STAGE_DIRECTORY/TRANSL/$1 ]]
   then
-    stage_install_file "$@"
+    stage_install_symlink "$@"
   elif [[ ! -d $STAGE_DIRECTORY/TRANSL/$1 ]]
   then
     stage_install_file "$@"
   elif [[ -d $STAGE_DIRECTORY/TRANSL/$1 ]]
   then
-    message "${MESSAGE_COLOR}$1${DEFAULT_COLOR}"
     stage_install_directory "$@"
   else
     message "${PROBLEM_COLOR}Oh, God I don't know what to do..."



More information about the SM-Commit mailing list