Skip to content

Commit

Permalink
add check for mpd setup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Nov 15, 2023
1 parent b4d78ea commit 1693d80
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions installation/install-jukebox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ echo GIT_BRANCH $GIT_BRANCH
echo GIT_URL $GIT_URL

CURRENT_USER="${SUDO_USER:-$(whoami)}"
CURRENT_USER_GROUP=$(id -gn "$CURRENT_USER")
HOME_PATH=$(getent passwd "$CURRENT_USER" | cut -d: -f6)
echo "Current User: $CURRENT_USER"
echo "User home dir: $HOME_PATH"
Expand Down
22 changes: 21 additions & 1 deletion installation/routines/setup_mpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,32 @@ _mpd_install_os_dependencies() {

_mpd_configure() {
# MPD will be setup as user process (rather than a system-wide process)
mkdir -p ~/.config/mpd
mkdir -p $(dirname "$MPD_CONF_PATH")

cp -f "${INSTALLATION_PATH}/resources/default-settings/mpd.default.conf" "${MPD_CONF_PATH}"

# Prepare new mpd.conf
sed -i 's|%%JUKEBOX_AUDIOFOLDERS_PATH%%|'"$AUDIOFOLDERS_PATH"'|' "${MPD_CONF_PATH}"
sed -i 's|%%JUKEBOX_PLAYLISTS_PATH%%|'"$PLAYLISTS_PATH"'|' "${MPD_CONF_PATH}"
}

_mpd_check () {
echo "Check MPD Installation" | tee /dev/fd/3
verify_apt_packages mpd mpc

verify_chmod_chown 755 "${CURRENT_USER}" "${CURRENT_USER_GROUP}" "${MPD_CONF_PATH}"

verify_file_contains_string "${AUDIOFOLDERS_PATH}" "${MPD_CONF_PATH}"
verify_file_contains_string "${PLAYLISTS_PATH}" "${MPD_CONF_PATH}"

check_service_state mpd.socket inactive
check_service_state mpd inactive
check_service_enablement mpd.socket disabled
check_service_enablement mpd disabled

check_service_state --user mpd active
check_service_enablement --user mpd.socket enabled
check_service_enablement --user mpd enabled
}

setup_mpd() {
Expand Down Expand Up @@ -70,6 +88,8 @@ setup_mpd() {
systemctl --user enable mpd
# Start MPD now, but not the socket: MPD is already started and we expect a reboot anyway
systemctl --user start mpd

_mpd_check
fi

echo "DONE: setup_mpd"
Expand Down

0 comments on commit 1693d80

Please sign in to comment.