Skip to content

Commit

Permalink
Fix JDK 21 in Actions (hopefully)
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye committed Jan 13, 2025
1 parent a80a18f commit 74ac07a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build-image/first-boot.bash
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fi

# shellcheck disable=SC2154
echo -n "$(timestamp) [openHABian] Updating myself from ${repositoryurl:-https://github.com/openhab/openhabian.git}, ${clonebranch:-openHAB} branch... "
if [[ $(eval "$(openhabian_update "${clonebranch:-openHAB}" &> /dev/null)") -eq 0 ]]; then
if running_in_docker || [[ $(eval "$(openhabian_update "${clonebranch:-openHAB}" &> /dev/null)") -eq 0 ]]; then
echo "OK"
else
echo "FAILED"
Expand Down
9 changes: 2 additions & 7 deletions functions/openhab.bash
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ openhab_setup() {

echo -n "$(timestamp) [openHABian] Setting up openHAB service... "
if ! cond_redirect zram_dependency install ${ohPkgName}; then return 1; fi
if cond_redirect systemctl enable ${ohPkgName}.service; then echo "OK"; else echo "FAILED (enable service)"; return 1; fi
if ! cond_redirect systemctl -q daemon-reload; then echo "FAILED (reload)"; return 1; fi
if cond_redirect systemctl enable --now ${ohPkgName}.service; then echo "OK"; else echo "FAILED (enable service)"; return 1; fi

openhab_misc
create_systemd_dependencies
Expand All @@ -139,12 +140,6 @@ openhab_setup() {
fi
dashboard_add_tile "openhabiandocs"

# see https://github.com/openhab/openhab-core/issues/1937
echo -n "$(timestamp) [openHABian] Restarting openHAB service the hard way to play it safe... "
if cond_redirect systemctl restart ${ohPkgName}.service; then echo "OK"; else echo "FAILED (restart service)"; return 1; fi
sleep 60
pkill -9 java

if [[ -n $INTERACTIVE ]]; then
unset DEBIAN_FRONTEND
whiptail --title "Operation successful!" --msgbox "$successText" 15 80
Expand Down
20 changes: 19 additions & 1 deletion tests/test.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -e

## This function formats log messages
##
Expand All @@ -19,6 +18,25 @@ if [[ $1 == "shellcheck" ]]; then
shellcheck -x -s bash functions/*.bash
shellcheck -x -s bash build-image/*.bash
shellcheck -x -s bash build.bash tests/ci-setup.bash
elif [[ $1 == "docker-install" ]]; then
if [[ -n $2 ]]; then
saved_java_opt="$(ggrep -oP 'java_opt=\K.*' build-image/openhabian.conf)"
gsed -i 's|java_opt=.*$|java_opt='"${2}"'|' build-image/openhabian.conf
fi
if [[ -n $3 ]]; then
saved_debugmode="$(ggrep -oP 'debugmode=\K.*' build-image/openhabian.conf)"
gsed -i 's|debugmode=.*$|debugmode='"${3}"'|' build-image/openhabian.conf
fi
docker buildx build --tag openhabian/install-openhabian -f tests/Dockerfile.rpi5-installation --platform linux/arm64 .
docker run --privileged --rm --platform linux/arm64 --name openhabian -d openhabian/install-openhabian:latest
docker exec -i "openhabian" bash -c './build.bash local-test && /boot/first-boot.bash'
docker stop openhabian
if [[ -n $2 ]]; then
gsed -i 's|java_opt=.*$|java_opt='"${saved_java_opt}"'|' build-image/openhabian.conf
fi
if [[ -n $3 ]]; then
gsed -i 's|debugmode=.*$|debugmode='"${saved_debugmode}"'|' build-image/openhabian.conf
fi
else
echo_process "Please provide a valid test profile, \"shellcheck\". Exiting"
exit 0
Expand Down

0 comments on commit 74ac07a

Please sign in to comment.