diff --git a/.github/workflows/push_pull.yml b/.github/workflows/push_pull.yml index 44510477..f9729c93 100644 --- a/.github/workflows/push_pull.yml +++ b/.github/workflows/push_pull.yml @@ -28,7 +28,7 @@ jobs: qt_version: ${{ matrix.qt_version }} event_name: ${{ github.event_name }} pull_request_number: ${{ github.event.pull_request.number }} - publish: ${{ startsWith(github.event.ref, 'refs/tags') }} + publish: ${{ startsWith(github.event.ref, 'refs/tags') && matrix.qt_version == '5' }} # Build DEB/RPM Packages for APT/DNF Repository (runs only on tagged commits) repo_build: @@ -44,6 +44,6 @@ jobs: repository: hyperion-project/hyperion.releases-ci token: ${{ secrets.HYPERION_BOT_TOKEN }} event-type: releases_repo_build - client-payload: '{ "head_sha": "${{ github.sha }}" }' + client-payload: '{ "head_sha": "${{ github.sha }}", "repo_checkout": "hyperion-project/hyperion.ng" }' env: SECRET_HYPERION_BOT_TOKEN: ${{ secrets.HYPERION_BOT_TOKEN }} diff --git a/.github/workflows/qt5_6.yml b/.github/workflows/qt5_6.yml index 41ee5d33..c773cf5f 100644 --- a/.github/workflows/qt5_6.yml +++ b/.github/workflows/qt5_6.yml @@ -86,7 +86,7 @@ jobs: if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} uses: actions/upload-artifact@v4 with: - name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} path: ${{ inputs.event_name == 'pull_request' && 'deploy/*.tar.gz' || 'deploy/Hyperion-*' }} env: NAME: ${{ format('{0}_{1}_{2}{3}', matrix.os.distribution, matrix.os.codename, matrix.os.architecture[0], inputs.qt_version == '6' && '_qt6' || '') }} @@ -130,7 +130,7 @@ jobs: if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} uses: actions/upload-artifact@v4 with: - name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} path: 'build/Hyperion-*' env: NAME: ${{ inputs.qt_version == '6' && 'macOS_x64_qt6' || 'macOS_x64' }} @@ -200,7 +200,7 @@ jobs: if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} uses: actions/upload-artifact@v4 with: - name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} path: ${{ inputs.event_name == 'pull_request' && 'build/*.exe' || 'build/Hyperion-*' }} env: NAME: ${{ inputs.qt_version == '6' && 'windows_x64_qt6' || 'windows_x64' }} @@ -228,14 +228,15 @@ jobs: - name: 💾 Artifact download uses: actions/download-artifact@v4.1.1 with: - path: artifacts + pattern: artifact-* + path: all-artifacts - name: 📦 Upload uses: softprops/action-gh-release@v1 with: name: Hyperion ${{ env.VERSION }} tag_name: ${{ env.TAG }} - files: "artifacts/**" + files: "all-artifacts/**" draft: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/bin/scripts/install_pr.sh b/bin/scripts/install_pr.sh index 4f38e248..68c4a2dc 100755 --- a/bin/scripts/install_pr.sh +++ b/bin/scripts/install_pr.sh @@ -3,13 +3,13 @@ # Fixed variables api_url="https://api.github.com/repos/hyperion-project/hyperion.ng" -type wget > /dev/null 2> /dev/null +type wget >/dev/null 2>/dev/null hasWget=$? -type curl > /dev/null 2> /dev/null +type curl >/dev/null 2>/dev/null hasCurl=$? -type python3 > /dev/null 2> /dev/null +type python3 >/dev/null 2>/dev/null hasPython3=$? -type python > /dev/null 2> /dev/null +type python >/dev/null 2>/dev/null hasPython2=$? DISTRIBUTION="debian" @@ -17,7 +17,7 @@ CODENAME="bullseye" ARCHITECTURE="" WITH_QT5=false -BASE_PATH='.'; +BASE_PATH='.' if [[ "${hasWget}" -ne 0 ]] && [[ "${hasCurl}" -ne 0 ]]; then echo '---> Critical Error: wget or curl required to download pull request artifacts' @@ -25,12 +25,12 @@ if [[ "${hasWget}" -ne 0 ]] && [[ "${hasCurl}" -ne 0 ]]; then fi if [[ "${hasPython3}" -eq 0 ]]; then - pythonCmd="python3" + pythonCmd="python3" else - if [[ "${hasPython2}" -eq 0 ]]; then - pythonCmd="python" - else - echo '---> Critical Error: python3 or python2 required to download pull request artifacts' + if [[ "${hasPython2}" -eq 0 ]]; then + pythonCmd="python" + else + echo '---> Critical Error: python3 or python2 required to download pull request artifacts' fi exit 1 fi @@ -44,15 +44,15 @@ function request_call() { } while getopts ":a:c:r:t:5" opt; do - case "$opt" in - a) ARCHITECTURE=$OPTARG ;; - c) CONFIGDIR=$OPTARG ;; - r) run_id=$OPTARG ;; - t) PR_TOKEN=$OPTARG ;; - 5) WITH_QT5=true ;; - esac + case "$opt" in + a) ARCHITECTURE=$OPTARG ;; + c) CONFIGDIR=$OPTARG ;; + r) run_id=$OPTARG ;; + t) PR_TOKEN=$OPTARG ;; + 5) WITH_QT5=true ;; + esac done -shift $(( OPTIND - 1 )) +shift $((OPTIND - 1)) # Check for a command line argument (PR number) if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then @@ -70,43 +70,52 @@ echo '************************************************************************** # Determine the architecture, if not given if [[ -z ${ARCHITECTURE} ]]; then - ARCHITECTURE=`uname -m` + ARCHITECTURE=$(uname -m) fi #Test if multiarchitecture setup, i.e. user-space is 32bit -if [[ "${ARCHITECTURE}" == "aarch64" || "${ARCHITECTURE}" == "arm64" ]]; then +if [[ "${ARCHITECTURE}" == "aarch64" ]]; then ARCHITECTURE="arm64" USER_ARCHITECTURE=$ARCHITECTURE - IS_V7L=`cat /proc/$$/maps |grep -m1 -c v7l` - if [ $IS_V7L -ne 0 ]; then + IS_ARMHF=$(grep -m1 -c armhf /proc/$$/maps) + if [ $IS_ARMHF -ne 0 ]; then USER_ARCHITECTURE="armv7" else - IS_V6L=`cat /proc/$$/maps |grep -m1 -c v6l` - if [ $IS_V6L -ne 0 ]; then - USER_ARCHITECTURE="armv6" - fi + IS_ARMEL=$(grep -m1 -c armel /proc/$$/maps) + if [ $IS_ARMEL -ne 0 ]; then + USER_ARCHITECTURE="armv6" + fi + fi + if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then + echo "---> Identified user space target architecture: $USER_ARCHITECTURE" + ARCHITECTURE=$USER_ARCHITECTURE fi - if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then - echo "---> Identified user space target architecture: $USER_ARCHITECTURE" - ARCHITECTURE=$USER_ARCHITECTURE - fi else + # Change x86_xx to amdxx ARCHITECTURE=${ARCHITECTURE//x86_/amd} + # Remove 'l' from armv6l, armv7l + ARCHITECTURE=${ARCHITECTURE//l/} fi -echo 'armv6l armv7l arm64 amd64' | grep -qw ${ARCHITECTURE} +echo 'armv6 armv7 arm64 amd64' | grep -qw ${ARCHITECTURE} if [ $? -ne 0 ]; then - echo "---> Critical Error: Target architecture $ARCHITECTURE is unknown -> abort" - exit 1 + echo "---> Critical Error: Target architecture $ARCHITECTURE is unknown -> abort" + exit 1 else PACKAGE="${ARCHITECTURE}" + + # armv6 has no Qt6 support yet + if [[ "${PACKAGE}" == "armv6" ]]; then + WITH_QT5=true + fi + QTVERSION="5" if [ ${WITH_QT5} == false ]; then QTVERSION="6" PACKAGE="${PACKAGE}_qt6" fi - echo "---> Download package for identified runtime architecture: $ARCHITECTURE and Qt$QTVERSION" + echo "---> Download package for identified runtime architecture: $ARCHITECTURE and Qt$QTVERSION" fi # Determine if PR number exists @@ -146,9 +155,9 @@ if [ -z "$head_sha" ]; then fi if [ -z "$run_id" ]; then -# Determine run_id from head_sha -runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha") -run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """ + # Determine run_id from head_sha + runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha") + run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """ import json,sys,os data = json.load(sys.stdin) @@ -199,9 +208,9 @@ fi # Download packed PR artifact echo "---> Downloading Pull Request #$pr_number, package: $PACKAGE_NAME" if [ $hasCurl -eq 0 ]; then - curl -skH "Authorization: token ${PR_TOKEN}" -o $BASE_PATH/temp.zip -L --get $archive_download_url + curl -# -kH "Authorization: token ${PR_TOKEN}" -o $BASE_PATH/temp.zip -L --get $archive_download_url elif [ $hasWget -eq 0 ]; then - echo "wget" + echo "wget" wget --quiet --header="Authorization: token ${PR_TOKEN}" -O $BASE_PATH/temp.zip $archive_download_url fi @@ -216,44 +225,59 @@ rm $BASE_PATH/temp.zip 2>/dev/null # Create the startup script echo '---> Create startup script' -STARTUP_SCRIPT="#!/bin/bash -e +STARTUP_SCRIPT_STOPSRVS=$( + cat <<'EOF' +#!/bin/bash -e # Stop hyperion service, if it is running -"'CURRENT_SERVICE=$(systemctl --type service | { grep -o "hyperion.*\.service" || true; }) +CURRENT_SERVICE=$(systemctl --type service | grep -o 'hyperion.*\.service' || true) + if [[ ! -z ${CURRENT_SERVICE} ]]; then echo "---> Stop current service: ${CURRENT_SERVICE}" STOPCMD="systemctl stop --quiet ${CURRENT_SERVICE} --now" USERNAME=${SUDO_USER:-$(whoami)} + if [ ${USERNAME} != "root" ]; then STOPCMD="sudo ${STOPCMD}" fi ${STOPCMD} >/dev/null 2>&1 + if [ $? -ne 0 ]; then - echo "---> Critical Error: Failed to stop service: ${CURRENT_SERVICE}, Hyperion may not be started. Stop Hyperion manually." + echo "---> Critical Error: Failed to stop service: ${CURRENT_SERVICE}, Hyperion may not be started. Stop Hyperion manually." else - echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started" + echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started" fi -fi'"" +fi +EOF +) TARGET_CONFIGDIR="$BASE_PATH/config" if [[ ! -z ${CONFIGDIR} ]]; then -STARTUP_SCRIPT+=" + STARTUP_SCRIPT_COPYCONFIG="$( + cat < $BASE_PATH/hyperion_pr$pr_number/$pr_number.sh +echo "${STARTUP_SCRIPT_STOPSRVS} ${STARTUP_SCRIPT_COPYCONFIG} ${STARTUP_SCRIPT_STARTPR}" >"$BASE_PATH/hyperion_pr$pr_number/$pr_number.sh" # Set the executen bit chmod +x -R $BASE_PATH/hyperion_pr$pr_number/$pr_number.sh diff --git a/cmake/package-scripts/prerm b/cmake/package-scripts/prerm index 55f6cd5e..1fd71c7d 100644 --- a/cmake/package-scripts/prerm +++ b/cmake/package-scripts/prerm @@ -35,6 +35,11 @@ then # disable user specific symlink echo "---> Disable service and remove entry" rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null + + # reload daemon after updates + systemctl -q daemon-reload 2> /dev/null + # reset all units with failed status + systemctl -q reset-failed 2> /dev/null elif [ -e /sbin/initctl ] then