7109099 application/texinfo-update's start method throws errors
authorPetr Cvachoucek <petr.cvachoucek@oracle.com>
Mon, 28 Nov 2011 02:12:26 -0800
changeset 599 3493d2848bde
parent 598 398722c80922
child 600 5828c439789b
7109099 application/texinfo-update's start method throws errors
components/texinfo/svc-texinfo-update
--- 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
 }