Skip to content

Commit

Permalink
Make local webapp build an optional step
Browse files Browse the repository at this point in the history
due to unpredictable npm connection errors.

Show webapp fin message only if webapp build fails
  • Loading branch information
AlvinSchiller committed Jan 12, 2024
1 parent e91bce6 commit f6e323c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions installation/includes/00_constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ GIT_BRANCH_DEVELOP=${GIT_BRANCH_DEVELOP:-future3/develop}

# This message will be displayed at the end of the installation process
# Functions wanting to have something important printed at the end should APPEND to this variable
# example:
# local tmp_fin_message="A Message"
# FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}"
FIN_MESSAGE=""
7 changes: 0 additions & 7 deletions installation/routines/customize_options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,6 @@ Do you want to build the Web App? [Y/n]"
ENABLE_WEBAPP_PROD_DOWNLOAD=true
;;
*)
# This message will be displayed at the end of the installation process
local tmp_fin_message="ATTENTION: You have installed from an unofficial branch.
If you make changes to the Web App sources
you need to rebuild it locally with
$ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u
Read the documentation regarding local Web App builds!"
FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}"
;;
esac
fi
Expand Down
22 changes: 18 additions & 4 deletions installation/routines/setup_jukebox_webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ NODE_MAJOR=20
# Node version for ARMv6 (unofficial builds)
NODE_ARMv6_VERSION=v20.10.0

OPTIONAL_WEBAPP_BUILD_FAILED=false

_jukebox_webapp_install_node() {
print_lc " Install NodeJS"

Expand Down Expand Up @@ -65,9 +67,19 @@ _jukebox_webapp_install_node() {
}

_jukebox_webapp_build() {
print_lc " Building Web App"
cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error
./run_rebuild.sh -u
print_lc " Building Web App"
cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error
if ! ./run_rebuild.sh -u ; then
print_lc " Web App build failed!
Follow instructions shown at the end of installation!"
OPTIONAL_WEBAPP_BUILD_FAILED=true
# This message will be displayed at the end of the installation process
local tmp_fin_message="ATTENTION: The build of the Web App failed during installation.
Please run the build manually with the following command
$ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u
Read the documentation regarding local Web App builds!"
FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}"
fi
}

_jukebox_webapp_download() {
Expand Down Expand Up @@ -127,7 +139,9 @@ _jukebox_webapp_check() {
verify_apt_packages nodejs
fi

verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build"
if [[ "$OPTIONAL_WEBAPP_BUILD_FAILED" == false ]]; then
verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build"
fi
fi

verify_apt_packages nginx
Expand Down

0 comments on commit f6e323c

Please sign in to comment.