Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37536545
en ru br
ALT Linux repos
S:0.60.11-alt5

Group :: Sound
RPM: bristol

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: bristol-0.60.11-alt-reduce-script-deps.patch
Download


diff --git a/bristol/bin/startBristol.in b/bristol/bin/startBristol.in
index 551bf9c..df4be2e 100755
--- a/bristol/bin/startBristol.in
+++ b/bristol/bin/startBristol.in
@@ -65,6 +65,12 @@ COUNT=256
 
 LOGO=no
 
+#
+# Binaries we use
+VALGRIND_BIN="$(which valgrind 2>/dev/null)"
+CPUFREQ_BIN="$(which cpufreq-set 2>/dev/null)"
+
+
 #
 # The following is configured by the autotools process.
 #
@@ -158,9 +164,9 @@ for index in $*; do
 	fi
 	if [ $index = "-freqtweak" ]; then
 		FREQ=$2
-		if [ $FREQ != 0 -a -x /usr/bin/cpufreq-set -a $execme -eq 0 ]; then
+		if [ $FREQ != 0 -a -x "$CPUFREQ_BIN" -a $execme -eq 0 ]; then
 			echo Setting min CPU speed to $FREQ
-			cpufreq-set -d ${FREQ}
+			"$CPUFREQ_BIN" -d ${FREQ}
 		fi
 	fi
 	if [ $index = "-count" ]; then
@@ -206,6 +212,10 @@ for index in $*; do
 		execme=1
 	fi
 	if [ $index = "-valgrind" ]; then
+		if [ ! -x "$VALGRIND_BIN" ]; then
+			echo "valgrind binary not found" >&2
+			exit 3
+		fi
 		valgrind=1
 	fi
 	if [ $index = "-debug" ]; then
@@ -497,7 +507,7 @@ if [ $engine = 1 ]; then
 		fi
 	else
 		echo checking availability of TCP port $PORT
-		netstat -taln | awk '{print $4}' | grep $PORT > /dev/null
+		netstat -taln | awk '{print $4}' | grep ':$PORT' > /dev/null
 		while [ $? -eq 0 ]; do
 			echo -n "port looked busy, trying "
 			PORT=`expr $PORT + 1`
@@ -535,7 +545,7 @@ else
 					if [ $valgrind = 0 ]; then
 						brighton ${PREARGS} $args -port ${PORT} ${POSTARGS}
 					else
-						valgrind --leak-check=full -v --show-reachable=yes --track-origins=yes brighton $args -port ${PORT} ${POSTARGS}
+						"$VALGRIND_BIN" --leak-check=full -v --show-reachable=yes --track-origins=yes brighton $args -port ${PORT} ${POSTARGS}
 					fi
 				else
 					exec brighton ${PREARGS} $args -port ${PORT} ${POSTARGS}
@@ -567,7 +577,7 @@ else
 					exec bristol -rate ${RATE} -count ${COUNT} ${PREARGS} $args -port $PORT ${POSTARGS}
 				fi
 			else
-				valgrind --leak-check=full -v --show-reachable=yes --track-origins=yes bristol -rate ${RATE} -count ${COUNT} ${PREARGS} $args -port $PORT ${POSTARGS}
+				"$VALGRIND_BIN" --leak-check=full -v --show-reachable=yes --track-origins=yes bristol -rate ${RATE} -count ${COUNT} ${PREARGS} $args -port $PORT ${POSTARGS}
 				engstatus=$?
 			fi
 		else
@@ -591,8 +601,8 @@ fi
 
 sleep 1
 
-if [ $FREQ != 0 -a -x /usr/bin/cpufreq-set ]; then
-	cpufreq-set -d 250MHz
+if [ $FREQ != 0 -a -x "$CPUFREQ_BIN" ]; then
+	"$CPUFREQ_BIN" -d 250MHz
 fi
 # This could be a lot more intelligent but it will work. We need to remove any
 # dangling sockets. Alternatively just delete the files, the check for their
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin