Skip to content

Commit

Permalink
Use exec and avoid bash processes (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
GioF71 authored Sep 23, 2024
1 parent 323dc0b commit c7b2044
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/bin/cmd-line-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function cmdline-timeout() {
CMD_LINE="$CMD_LINE -C "$(quote_if_needed "${SQUEEZELITE_TIMEOUT}")
}

function cmdline-mac-address() {
function cmdline_mac_address() {
if [ -z "${SQUEEZELITE_MAC_ADDRESS}" ]; then
echo "Variable SQUEEZELITE_MAC_ADDRESS not specified"
else
Expand Down
6 changes: 3 additions & 3 deletions app/bin/run-squeezelite-alsa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ else
fi

handle_mac_address
cmdline-mac-address
cmdline_mac_address

echo "Command Line: ["$CMD_LINE"]"

if [[ $actual_user_mode -eq 1 ]]; then
chown -R $USER_NAME:$GROUP_NAME /config
su - $USER_NAME -c "$CMD_LINE"
exec su - $USER_NAME -c "$CMD_LINE"
else
eval $CMD_LINE
eval "exec $CMD_LINE"
fi
4 changes: 2 additions & 2 deletions app/bin/run-squeezelite-pulse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ source logging.sh
add_log_categories

handle_mac_address
cmdline-mac-address
cmdline_mac_address

echo "Command Line: ["$CMD_LINE"]"

chown -R $USER_NAME:$GROUP_NAME /config
su - $USER_NAME -c "$CMD_LINE"
exec su - $USER_NAME -c "$CMD_LINE"

4 changes: 2 additions & 2 deletions app/bin/run-squeezelite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ echo "Ready to start."

if [ "${SQUEEZELITE_MODE^^}" == "${SQUEEZELITE_MODE_ALSA^^}" ]; then
echo "Using ALSA mode";
/app/bin/run-squeezelite-alsa.sh;
exec /app/bin/run-squeezelite-alsa.sh;
elif [ "${SQUEEZELITE_MODE^^}" == "${SQUEEZELITE_MODE_PULSE^^}" ]; then
echo "Using PULSE mode";
/app/bin/run-squeezelite-pulse.sh;
exec /app/bin/run-squeezelite-pulse.sh;
else
echo "Invalid mode ["$SQUEEZELITE_MODE"]";
exit 2;
Expand Down
1 change: 1 addition & 0 deletions doc/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Older build might be dropped in order to save space on docker-hub and incur in l

Date|Type|Description
:---|:---|:---
2024-09-21|Improvement|Use exec instead of eval, avoid bash process
2024-06-01|Update|Sourceforge binaries version bump (see [#313](https://github.com/GioF71/squeezelite-docker/issues/313))
2024-06-01|Update|Sourceforge binaries version bump (see [#311](https://github.com/GioF71/squeezelite-docker/issues/311))
2024-04-20|Maintenance|Fix R2 build (see [#306](https://github.com/GioF71/squeezelite-docker/issues/306))
Expand Down

0 comments on commit c7b2044

Please sign in to comment.