components/texinfo/svc-texinfo-update
changeset 599 3493d2848bde
parent 559 5ec27e888a6e
child 971 345f87d27ffb
--- a/components/texinfo/svc-texinfo-update	Fri Nov 25 01:35:48 2011 -0800
+++ b/components/texinfo/svc-texinfo-update	Mon Nov 28 02:12:26 2011 -0800
@@ -21,7 +21,7 @@
 #
 
 #
-# Copyright (c) 2011, Oracle and/or its affiliates.  All rights reserved.
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 . /lib/svc/share/smf_include.sh
@@ -66,10 +66,16 @@
 			group_bin=$(ls -l ${dir_file} | \
 				    awk '{print $3":"$4}')
 		fi
-		mv -f ${dir_file}.new ${dir_file}
-		chmod -f 0644 ${dir_file}
-		chown -f ${owner_group} ${dir_file}
-		ln -s ${1} ${dir_file}.backlink 2>/dev/null
+		if [[ -f ${dir_file}.new ]] ; then
+			# new dir file created, replace the original one
+			mv -f ${dir_file}.new ${dir_file}
+			chmod -f 0644 ${dir_file}
+			chown -f ${owner_group} ${dir_file}
+			ln -s ${1} ${dir_file}.backlink 2>/dev/null
+		else
+			# no dir file created (no input files installed)
+			rm -f ${dir_file} ${dir_file}.backlink
+		fi
 		;;
 	esac
 }