1. Faheem Mitha
  2. ccl-debian

Commits

Faheem Mitha  committed a953e3a

Make sure trap is set to delete all files. Add comments.

  • Participants
  • Parent commits 208074f
  • Branches default

Comments (0)

Files changed (1)

File check_files_uptodate

View file
  • Ignore whitespace
 #!/bin/sh
 
-echo "One or more of debian/build_interface_databases.m4,
-debian/control.m4, and debian/rules.m4 is newer than rules,
-checking..."
+echo "One or more of debian/build_interface_databases.m4, debian/control.m4, and debian/rules.m4 is newer than rules,"
+
+LIST_OF_FILES_TO_DELETE=""
 
 checkfiles ()
 {
     m4 -DBOOTSTRAP=true debian/$1.m4 > debian/$1.BOOTSTRAPtrue.tmp
     m4 -DBOOTSTRAP=false debian/$1.m4 > debian/$1.BOOTSTRAPfalse.tmp
 
-    trap 'rm -rf debian/$1.BOOTSTRAPtrue.tmp debian/$1.BOOTSTRAPfalse.tmp' EXIT
+    # Increment list of temporary files to delete
+    LIST_OF_FILES_TO_DELETE+=" debian/$1.BOOTSTRAPtrue.tmp debian/$1.BOOTSTRAPfalse.tmp"
 
-    # if debian/FILENAME not the same as debian/FILENAME.BOOTSTRAPtrue.tmp
-    # and debian/FILENAME not the same as
-    # debian/FILENAME.BOOTSTRAPfalse.tmp, then exit
+    # set trap to delete list of files on exit
+    trap "rm $LIST_OF_FILES_TO_DELETE" EXIT
+
+    # if debian/FILENAME not the same as
+    # debian/FILENAME.BOOTSTRAPtrue.tmp and debian/FILENAME not the
+    # same as debian/FILENAME.BOOTSTRAPfalse.tmp, then exit
 
     if ! { cmp -s debian/$1 debian/$1.BOOTSTRAPtrue.tmp || cmp -s debian/$1 debian/$1.BOOTSTRAPfalse.tmp; }
     then
-	echo "'debian/$1' is out of date with respect to 'debian/$2.m4'. You need to run 'BOOTSTRAP=true ./genscripts' or 'BOOTSTRAP=false ./genscripts' inside the 'debian' directory"
+	echo "'debian/$1' is out of date with respect to 'debian/$1.m4'. You need to run 'BOOTSTRAP=true ./genscripts' or 'BOOTSTRAP=false ./genscripts' inside the 'debian' directory"
 	exit 1
     fi
 }