[med-svn] r5418 - trunk/packages/ensembl/ensembl/57/debian

Steffen Möller moeller at alioth.debian.org
Thu Nov 11 13:25:58 UTC 2010


Author: moeller
Date: 2010-11-11 13:25:50 +0000 (Thu, 11 Nov 2010)
New Revision: 5418

Modified:
   trunk/packages/ensembl/ensembl/57/debian/adjust_shebang_line.sh
Log:
improved on some bork, now also treating PMs


Modified: trunk/packages/ensembl/ensembl/57/debian/adjust_shebang_line.sh
===================================================================
--- trunk/packages/ensembl/ensembl/57/debian/adjust_shebang_line.sh	2010-11-07 18:12:41 UTC (rev 5417)
+++ trunk/packages/ensembl/ensembl/57/debian/adjust_shebang_line.sh	2010-11-11 13:25:50 UTC (rev 5418)
@@ -3,23 +3,41 @@
 for i in "$@"
 do
 	if head -n 1 "$i" | egrep -q '^#!(/usr/bin/perl|/bin/bash)'; then 
-		chmod 755 "$i"
-		echo "OK:         '$i'"
-		continue;
+		if ! echo "$i" | egrep -q '.pm$'; then
+			chmod 755 "$i"
+			echo "OK:         '$i'"
+			continue;
+			fi
 	fi
 	if head -n 1 "$1" | grep -q '^#!'; then
-		echo "Substitute: '$i'"
-		if head -n 1 "$i" | grep perl; then
-			sed -i '1s%#!/.*/perl%#!/usr/bin/perl%' $i
-		else
-			sed -i '1s%#!/.*/bash%#!/bin/bash%' $i
+		if echo "$i" | egrep -q '.pm$'; then
+			echo "Remove: '$i'"
+			sed -i '1d' $i
+			chmod -x "$i"
+		else 
+			echo "Substitute: '$i'"
+			if head -n 1 "$i" | grep -q perl; then
+				echo Perl
+				sed -i '1s%#!\s*/.*/perl%#!/usr/bin/perl%' $i
+				# also seen
+				sed -i '1s%#!perl%#!/usr/bin/perl%' $i
+			else
+				echo BASH
+				sed -i '1s%#!\s*/.*/bash%#!/bin/bash%' $i
+			fi
 		fi
 	else
 		echo "Insert:     '$i'"
-		if echo "$i" | grep ".sh" || egrep "use\s\s*strict\s*;" $i; then
+		if echo "$i" | egrep -q '*.t$'; then
+			if [ ! -x "$i" ]; then
+				# not executable, should then lose shebang line
+				sed -i '1s%^#!.*$//' $i
+			fi
+		fi 
+		if echo "$i" | egrep -q '.(pl|t)$' || egrep -q "use\s\s*strict\s*;" $i; then
 			sed -i '1i#!/usr/bin/perl\n' $i
 			chmod 755 "$i"
-		elif (echo "$i" | grep ".sh" ) || egrep "use\s\s*strict\s*;" $i; then
+		elif (echo "$i" | grep -q ".sh" ) ; then
 			sed -i '1i#!/bin/bash\n' $i
 			chmod 755 "$i"
 		else




More information about the debian-med-commit mailing list