Skip to content

Commit

Permalink
fix and add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Nov 17, 2023
1 parent 27e16ca commit cfa01b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions installation/includes/00_constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ RPI_BOOT_CONFIG_FILE="/boot/config.txt"
SHARED_PATH="${INSTALLATION_PATH}/shared"
SETTINGS_PATH="${SHARED_PATH}/settings"
SYSTEMD_USR_PATH="/usr/lib/systemd/user"
VIRTUAL_ENV="${INSTALLATION_PATH}/.venv"

# The default upstream user, release branch, and develop branch
# These are used to prepare the repo for developers
Expand Down
13 changes: 7 additions & 6 deletions installation/routines/setup_jukebox_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ZMQ_TMP_DIR="libzmq"
ZMQ_PREFIX="/usr/local"

JUKEBOX_PULSE_CONFIG="${HOME_PATH}"/.config/pulse/default.pa
JUKEBOX_SERVICE_NAME="${SYSTEMD_USR_PATH}/jukebox-daemon.service"

_show_slow_hardware_message() {
echo " --------------------------------------------------------------------
Expand Down Expand Up @@ -40,7 +41,6 @@ _jukebox_core_install_python_requirements() {

cd "${INSTALLATION_PATH}" || exit_on_error

VIRTUAL_ENV="${INSTALLATION_PATH}/.venv"
python3 -m venv $VIRTUAL_ENV
source "$VIRTUAL_ENV/bin/activate"

Expand Down Expand Up @@ -127,10 +127,9 @@ _jukebox_core_install_settings() {
_jukebox_core_register_as_service() {
echo " Register Jukebox Core user service"

local jukebox_service="${SYSTEMD_USR_PATH}/jukebox-daemon.service"
sudo cp -f "${INSTALLATION_PATH}/resources/default-services/jukebox-daemon.service" "${jukebox_service}"
sudo sed -i "s|%%INSTALLATION_PATH%%|${INSTALLATION_PATH}|g" "${jukebox_service}"
sudo chmod 644 "${jukebox_service}"
sudo cp -f "${INSTALLATION_PATH}/resources/default-services/jukebox-daemon.service" "${JUKEBOX_SERVICE_NAME}"
sudo sed -i "s|%%INSTALLATION_PATH%%|${INSTALLATION_PATH}|g" "${JUKEBOX_SERVICE_NAME}"
sudo chmod 644 "${JUKEBOX_SERVICE_NAME}"

systemctl --user daemon-reload
systemctl --user enable jukebox-daemon.service
Expand All @@ -145,6 +144,8 @@ _jukebox_core_check () {
pulseaudio pulseaudio-module-bluetooth pulseaudio-utils caps \
libasound2-dev \

verify_dirs_exist "${VIRTUAL_ENV}"

local pip_modules=$(get_args_from_file "${INSTALLATION_PATH}/requirements.txt")
verify_pip_modules pyzmq $pip_modules

Expand All @@ -155,7 +156,7 @@ _jukebox_core_check () {

verify_files_chmod_chown 644 root root "${SYSTEMD_USR_PATH}/jukebox-daemon.service"

verify_file_contains_string "${INSTALLATION_PATH}" "${jukebox_service}"
verify_file_contains_string "${INSTALLATION_PATH}" "${JUKEBOX_SERVICE_NAME}"

check_service_enablement jukebox-daemon.service enabled --user
}
Expand Down

0 comments on commit cfa01b7

Please sign in to comment.