Skip to content

Commit

Permalink
service: start mpd_oled from a script
Browse files Browse the repository at this point in the history
  • Loading branch information
antiprism committed May 13, 2023
1 parent 8299f2b commit bab1131
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -38,7 +38,7 @@ bin_SCRIPTS = \
scripts/mpd_oled_service_install \
scripts/mpd_oled_service_edit \
scripts/mpd_oled_service_uninstall \
scripts/mpd_oled_launch_test \
scripts/mpd_oled_launch \
scripts/mpd_oled_moode_audio_copy_install \
scripts/mpd_oled_moode_audio_copy_uninstall \
scripts/mpd_oled_moode_audio_copy_report \
Expand Down
5 changes: 5 additions & 0 deletions scripts/mpd_oled_launch_test → scripts/mpd_oled_launch
Expand Up @@ -28,3 +28,8 @@ elif test -f "$raudio_path" ; then
sleep 10
done
fi

# HOME may not be set and cava may require it to be set
[[ -n "$HOME" ]] || export HOME=/tmp

exec "$@"
6 changes: 2 additions & 4 deletions scripts/mpd_oled_service_install.in
@@ -1,16 +1,14 @@
#!/bin/bash

service="mpd_oled"
launch_test="mpd_oled_launch_test"
launch_script="mpd_oled_launch"

tmp_file_name="/tmp/$service.service"
tmp_file_contents="[Unit]
Description=MPD OLED Display
[Service]
ExecStartPre=@prefix@/bin/$launch_test
ExecStart=@prefix@/bin/$service -o 0 -b 21 -g 1 -f 15
TimeoutSec=3min
ExecStart=@prefix@/bin/$launch_script @prefix@/bin/$service -o 0 -b 21 -g 1 -f 15
[Install]
WantedBy=multi-user.target
Expand Down
6 changes: 3 additions & 3 deletions scripts/mpd_oled_usrlocal_check
Expand Up @@ -7,19 +7,19 @@ echo

found_usr="no";
if test -f "/usr/bin/mpd_oled"; then
echo "FOUND: mpd_oled found in /usr/bin"
echo "note: mpd_oled found in /usr/bin"
found_usr="yes"
fi

found="no";
if test -f "/usr/local/bin/mpd_oled"; then
echo "FOUND: mpd_oled found in /usr/local/bin"
echo "note: mpd_oled found in /usr/local/bin"
found="yes"
fi

sysd_file="/etc/systemd/system/mpd_oled.service"
if test -f "$sysd_file" && grep -q "/usr/local/" "$sysd_file"; then
echo "FOUND: mpd_oled service file includes /usr/local"
echo "note: mpd_oled service file includes /usr/local"
found="yes"
fi

Expand Down

0 comments on commit bab1131

Please sign in to comment.