@@ -1,16 +1,16 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
# Check if already running | # Check if already running | ||||
PROCS=`ps -f -u $USER | grep /share/cadence/src/cadence.py | grep python` | |||||
PROCS=$(ps -f -u $USER | grep /share/cadence/src/cadence.py | grep python) | |||||
if [ x"$PROCS" != x"" ]; then | if [ x"$PROCS" != x"" ]; then | ||||
# One instance only | # One instance only | ||||
PROC=`echo "$PROCS" | head -n 1` | |||||
PROC=$(echo "$PROCS" | head -n 1) | |||||
# Get PID | # Get PID | ||||
PID=`echo "$PROC" | awk '{printf$2}'` | |||||
PID=$(echo "$PROC" | awk '{printf$2}') | |||||
# Last check, just to make sure | # Last check, just to make sure | ||||
if [ x"$PID" != x"" ]; then | if [ x"$PID" != x"" ]; then | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
if [ -f /usr/bin/python3 ]; then | if [ -f /usr/bin/python3 ]; then | ||||
PYTHON=/usr/bin/python3 | PYTHON=/usr/bin/python3 | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
if [ -f /usr/bin/python3 ]; then | if [ -f /usr/bin/python3 ]; then | ||||
PYTHON=/usr/bin/python3 | PYTHON=/usr/bin/python3 | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
if [ -f /usr/bin/python3 ]; then | if [ -f /usr/bin/python3 ]; then | ||||
PYTHON=/usr/bin/python3 | PYTHON=/usr/bin/python3 | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
# Script to bridge/start pulseaudio into JACK mode | # Script to bridge/start pulseaudio into JACK mode | ||||
INSTALL_PREFIX="X-PREFIX-X" | INSTALL_PREFIX="X-PREFIX-X" | ||||
@@ -12,7 +12,7 @@ fi | |||||
if [ ! -f ~/.pulse/client.conf ]; then | if [ ! -f ~/.pulse/client.conf ]; then | ||||
echo "autospawn = no" > ~/.pulse/client.conf | echo "autospawn = no" > ~/.pulse/client.conf | ||||
else | else | ||||
if (! cat ~/.pulse/client.conf | grep "autospawn = no" > /dev/null); then | |||||
if ! grep "autospawn = no" < ~/.pulse/client.conf > /dev/null; then | |||||
sed -i '/autospawn =/d' ~/.pulse/client.conf | sed -i '/autospawn =/d' ~/.pulse/client.conf | ||||
echo "autospawn = no" >> ~/.pulse/client.conf | echo "autospawn = no" >> ~/.pulse/client.conf | ||||
fi | fi | ||||
@@ -24,19 +24,19 @@ if [ ! -f ~/.pulse/daemon.conf ]; then | |||||
echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | ||||
echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | ||||
else | else | ||||
if (! cat ~/.pulse/daemon.conf | grep "default-sample-format = float32le" > /dev/null); then | |||||
if ! grep "default-sample-format = float32le" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/default-sample-format = /d' ~/.pulse/daemon.conf | sed -i '/default-sample-format = /d' ~/.pulse/daemon.conf | ||||
echo "default-sample-format = float32le" >> ~/.pulse/daemon.conf | echo "default-sample-format = float32le" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "realtime-scheduling = yes" > /dev/null); then | |||||
if ! grep "realtime-scheduling = yes" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/realtime-scheduling = /d' ~/.pulse/daemon.conf | sed -i '/realtime-scheduling = /d' ~/.pulse/daemon.conf | ||||
echo "realtime-scheduling = yes" >> ~/.pulse/daemon.conf | echo "realtime-scheduling = yes" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "rlimit-rttime = -1" > /dev/null); then | |||||
if ! grep "rlimit-rttime = -1" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/rlimit-rttime =/d' ~/.pulse/daemon.conf | sed -i '/rlimit-rttime =/d' ~/.pulse/daemon.conf | ||||
echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "exit-idle-time = -1" > /dev/null); then | |||||
if ! grep "exit-idle-time = -1" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/exit-idle-time =/d' ~/.pulse/daemon.conf | sed -i '/exit-idle-time =/d' ~/.pulse/daemon.conf | ||||
echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
@@ -80,8 +80,8 @@ esac | |||||
IsPulseAudioRunning() | IsPulseAudioRunning() | ||||
{ | { | ||||
PROCESS=`ps -u $USER | grep pulseaudio` | |||||
if [ "$PROCESS" == "" ]; then | |||||
PROCESS=$(ps -u $USER | grep pulseaudio) | |||||
if [ "$PROCESS" = "" ]; then | |||||
false | false | ||||
else | else | ||||
true | true | ||||
@@ -90,7 +90,7 @@ IsPulseAudioRunning() | |||||
if (IsPulseAudioRunning); then | if (IsPulseAudioRunning); then | ||||
{ | { | ||||
if (`jack_lsp | grep "PulseAudio JACK Sink:" > /dev/null`); then | |||||
if jack_lsp | grep "PulseAudio JACK Sink:" > /dev/null; then | |||||
{ | { | ||||
echo "PulseAudio is already running and bridged to JACK" | echo "PulseAudio is already running and bridged to JACK" | ||||
} | } | ||||
@@ -98,7 +98,7 @@ if (IsPulseAudioRunning); then | |||||
{ | { | ||||
echo "PulseAudio is already running, bridge it..." | echo "PulseAudio is already running, bridge it..." | ||||
if [ "$PLAY_ONLY" == "yes" ]; then | |||||
if [ "$PLAY_ONLY" = "yes" ]; then | |||||
{ | { | ||||
pactl load-module module-jack-sink > /dev/null | pactl load-module module-jack-sink > /dev/null | ||||
pacmd set-default-source jack_in > /dev/null | pacmd set-default-source jack_in > /dev/null | ||||
@@ -118,7 +118,7 @@ if (IsPulseAudioRunning); then | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$FILE -n`); then | |||||
if pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$FILE -n > /dev/null 2>&1; then | |||||
echo "Initiated PulseAudio successfully!" | echo "Initiated PulseAudio successfully!" | ||||
else | else | ||||
echo "Failed to initialize PulseAudio!" | echo "Failed to initialize PulseAudio!" | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
# Script to bridge/start pulseaudio into loopback mode | # Script to bridge/start pulseaudio into loopback mode | ||||
INSTALL_PREFIX="X-PREFIX-X" | INSTALL_PREFIX="X-PREFIX-X" | ||||
@@ -12,7 +12,7 @@ fi | |||||
if [ ! -f ~/.pulse/client.conf ]; then | if [ ! -f ~/.pulse/client.conf ]; then | ||||
echo "autospawn = no" > ~/.pulse/client.conf | echo "autospawn = no" > ~/.pulse/client.conf | ||||
else | else | ||||
if (! cat ~/.pulse/client.conf | grep "autospawn = no" > /dev/null); then | |||||
if ! grep "autospawn = no" < ~/.pulse/client.conf > /dev/null; then | |||||
sed -i '/autospawn =/d' ~/.pulse/client.conf | sed -i '/autospawn =/d' ~/.pulse/client.conf | ||||
echo "autospawn = no" >> ~/.pulse/client.conf | echo "autospawn = no" >> ~/.pulse/client.conf | ||||
fi | fi | ||||
@@ -24,19 +24,19 @@ if [ ! -f ~/.pulse/daemon.conf ]; then | |||||
echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | ||||
echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | ||||
else | else | ||||
if (! cat ~/.pulse/daemon.conf | grep "default-sample-format = float32le" > /dev/null); then | |||||
if ! grep "default-sample-format = float32le" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/default-sample-format = /d' ~/.pulse/daemon.conf | sed -i '/default-sample-format = /d' ~/.pulse/daemon.conf | ||||
echo "default-sample-format = float32le" >> ~/.pulse/daemon.conf | echo "default-sample-format = float32le" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "realtime-scheduling = yes" > /dev/null); then | |||||
if ! grep "realtime-scheduling = yes" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/realtime-scheduling = /d' ~/.pulse/daemon.conf | sed -i '/realtime-scheduling = /d' ~/.pulse/daemon.conf | ||||
echo "realtime-scheduling = yes" >> ~/.pulse/daemon.conf | echo "realtime-scheduling = yes" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "rlimit-rttime = -1" > /dev/null); then | |||||
if ! grep "rlimit-rttime = -1" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/rlimit-rttime =/d' ~/.pulse/daemon.conf | sed -i '/rlimit-rttime =/d' ~/.pulse/daemon.conf | ||||
echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
if (! cat ~/.pulse/daemon.conf | grep "exit-idle-time = -1" > /dev/null); then | |||||
if ! grep "exit-idle-time = -1" < ~/.pulse/daemon.conf > /dev/null; then | |||||
sed -i '/exit-idle-time =/d' ~/.pulse/daemon.conf | sed -i '/exit-idle-time =/d' ~/.pulse/daemon.conf | ||||
echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | echo "exit-idle-time = -1" >> ~/.pulse/daemon.conf | ||||
fi | fi | ||||
@@ -77,8 +77,8 @@ esac | |||||
IsPulseAudioRunning() | IsPulseAudioRunning() | ||||
{ | { | ||||
PROCESS=`ps -u $USER | grep pulseaudio` | |||||
if [ "$PROCESS" == "" ]; then | |||||
PROCESS=$(ps -u $USER | grep pulseaudio) | |||||
if [ "$PROCESS" = "" ]; then | |||||
false | false | ||||
else | else | ||||
true | true | ||||
@@ -98,7 +98,7 @@ if (IsPulseAudioRunning); then | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$FILE -n`); then | |||||
if pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$FILE -n > /dev/null 2>&1; then | |||||
echo "Initiated PulseAudio successfully!" | echo "Initiated PulseAudio successfully!" | ||||
else | else | ||||
echo "Failed to initialize PulseAudio!" | echo "Failed to initialize PulseAudio!" | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
if [ -f /usr/bin/python3 ]; then | if [ -f /usr/bin/python3 ]; then | ||||
PYTHON=/usr/bin/python3 | PYTHON=/usr/bin/python3 | ||||
@@ -1,4 +1,4 @@ | |||||
#!/bin/bash | |||||
#!/bin/sh | |||||
if [ -f /usr/bin/python3 ]; then | if [ -f /usr/bin/python3 ]; then | ||||
PYTHON=/usr/bin/python3 | PYTHON=/usr/bin/python3 | ||||
@@ -8,7 +8,7 @@ fi | |||||
INSTALL_PREFIX="X-PREFIX-X" | INSTALL_PREFIX="X-PREFIX-X" | ||||
if [ "$1"x == "--system-start-by-x11-startup"x ]; then | |||||
if [ "$1"x = "--system-start-by-x11-startup"x ]; then | |||||
# called via $STARTUP in 21cadence-session-inject | # called via $STARTUP in 21cadence-session-inject | ||||
$PYTHON $INSTALL_PREFIX/share/cadence/src/cadence_session_start.py --system-start & | $PYTHON $INSTALL_PREFIX/share/cadence/src/cadence_session_start.py --system-start & | ||||
shift | shift | ||||
@@ -17,7 +17,7 @@ if [ "$1"x == "--system-start-by-x11-startup"x ]; then | |||||
else | else | ||||
exec x-session-manager | exec x-session-manager | ||||
fi | fi | ||||
elif [ "$1"x == "--maybe-system-start"x ]; then | |||||
elif [ "$1"x = "--maybe-system-start"x ]; then | |||||
# called via autostart cadence-session-start.desktop | # called via autostart cadence-session-start.desktop | ||||
# this will check if jack is already running before trying to restart things | # this will check if jack is already running before trying to restart things | ||||
exec $PYTHON $INSTALL_PREFIX/share/cadence/src/cadence_session_start.py --system-start-desktop | exec $PYTHON $INSTALL_PREFIX/share/cadence/src/cadence_session_start.py --system-start-desktop | ||||