From f377e1884cf13a212f3a84a4790283c9f712e5bb Mon Sep 17 00:00:00 2001 From: bardia Date: Sat, 22 Aug 2026 16:36:06 +0200 Subject: [PATCH 1/6] ci:add rpm packaging to workflow --- script/pack_rpm.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 script/pack_rpm.sh diff --git a/script/pack_rpm.sh b/script/pack_rpm.sh new file mode 100755 index 000000000..e2bb584e3 --- /dev/null +++ b/script/pack_rpm.sh @@ -0,0 +1,75 @@ +#!/bin/bash +set -e + +TAG="$1" +ARCH="$2" + +RPM_VERSION="${TAG#v}" +RPM_VERSION="${RPM_VERSION#V}" +# RPM release fields reject '-', which tags like "v1.2.3-beta1" would otherwise contain. +RPM_VERSION="${RPM_VERSION//-/_}" + +# rpm and this project name arches differently from the amd64/arm64 used elsewhere. +RPM_ARCH=$([[ "$ARCH" == "amd64" ]] && echo "x86_64" || echo "aarch64") + +WORK="$PWD/rpmwork" +BUILDROOT="$WORK/buildroot" +rm -rf "$WORK" +mkdir -p "$BUILDROOT/opt" "$BUILDROOT/usr/share/applications" "$WORK/RPMS" + +cp -r "linux-$ARCH$([[ $3 == "systemqt" ]] && echo "-system-qt")" "$BUILDROOT/opt/Throne" +rm -f "$BUILDROOT/opt/Throne/Throne.debug" + +cat >"$BUILDROOT/usr/share/applications/Throne.desktop" <<-EOF +[Desktop Entry] +Name=Throne +Comment=Qt based cross-platform GUI proxy configuration manager (backend: sing-box) +Exec=sh -c "PATH=/opt/Throne:\$PATH /opt/Throne/Throne -appdata" +Icon=/opt/Throne/Throne.png +Terminal=false +Type=Application +Categories=Network;Application; +EOF + +DEPENDS="" +[[ $3 == "systemqt" ]] && DEPENDS="Requires: qt6-qtbase qt6-qtbase-gui qt6-qtwayland xcb-util-cursor google-noto-emoji-color-fonts" + +# %install is a no-op on purpose: the buildroot above is already fully populated, +# and rpmbuild does not touch existing buildroot contents unless %install does. +cat >"$WORK/Throne.spec" <<-EOF +Name: Throne +Version: ${RPM_VERSION} +Release: 1 +Summary: Qt based cross-platform GUI proxy configuration manager (backend: sing-box) +License: Custom +BuildArch: ${RPM_ARCH} +${DEPENDS} +Requires(post): desktop-file-utils +Requires(postun): desktop-file-utils + +%description +Qt based cross-platform GUI proxy configuration manager (backend: sing-box). + +%install +true + +%files +/opt/Throne +/usr/share/applications/Throne.desktop + +%post +update-desktop-database &> /dev/null || : + +%postun +update-desktop-database &> /dev/null || : +EOF + +rpmbuild -bb \ + --define "_topdir $WORK" \ + --buildroot "$BUILDROOT" \ + --define "_rpmdir $WORK/RPMS" \ + --define "_build_id_links none" \ + --target "$RPM_ARCH" \ + "$WORK/Throne.spec" + +find "$WORK/RPMS" -name '*.rpm' -exec mv {} ./Throne.rpm \; \ No newline at end of file From db6ec58a2b26e574ea8e506f12b8b9a44298470d Mon Sep 17 00:00:00 2001 From: bardia Date: Sat, 22 Aug 2026 22:15:37 +0200 Subject: [PATCH 2/6] ci:add rpm to build.yml --- .github/workflows/build.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e25217a1c..173a26703 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -348,7 +348,7 @@ jobs: mv ghr*linux_amd64/ghr . find . -name artifacts.tgz | xargs -n1 tar xzf #### - sudo apt install nsis + sudo apt install nsis rpm cp ./script/windows_installer.nsi . TAG="${{ github.event.inputs.tag }}" APP_VERSION="${TAG#v}" @@ -390,6 +390,22 @@ jobs: mv Throne.deb Throne-${{ github.event.inputs.tag }}-debian-arm64-system-qt.deb rm -rf Throne #### + bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} amd64 + mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-amd64.rpm + rm -rf Throne rpmwork + #### + bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} amd64 systemqt + mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-amd64-system-qt.rpm + rm -rf Throne rpmwork + #### + bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} arm64 + mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-arm64.rpm + rm -rf Throne rpmwork + #### + bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} arm64 systemqt + mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-arm64-system-qt.rpm + rm -rf Throne rpmwork + #### mv linux-amd64 Throne mv Throne/Throne.debug debug/Throne-${{ github.event.inputs.tag }}-linux-amd64.debug zip -9 -r Throne-${{ github.event.inputs.tag }}-linux-amd64.zip Throne @@ -477,4 +493,4 @@ jobs: - name: Release if: github.event.inputs.publish == 'r' run: | - ./ghr -delete -c ${{ github.sha }} -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment + ./ghr -delete -c ${{ github.sha }} -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment \ No newline at end of file From 3464ed447476372c478729f920f24570ccc0f2d6 Mon Sep 17 00:00:00 2001 From: bardia Date: Sat, 22 Aug 2026 22:34:07 +0200 Subject: [PATCH 3/6] fix: pack_rpm.sh buildroot population + set -e assignment bug --- script/pack_rpm.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/script/pack_rpm.sh b/script/pack_rpm.sh index e2bb584e3..454a61a19 100755 --- a/script/pack_rpm.sh +++ b/script/pack_rpm.sh @@ -3,24 +3,28 @@ set -e TAG="$1" ARCH="$2" +VARIANT="$3" RPM_VERSION="${TAG#v}" RPM_VERSION="${RPM_VERSION#V}" -# RPM release fields reject '-', which tags like "v1.2.3-beta1" would otherwise contain. +#RPM release fields reject '-' RPM_VERSION="${RPM_VERSION//-/_}" # rpm and this project name arches differently from the amd64/arm64 used elsewhere. RPM_ARCH=$([[ "$ARCH" == "amd64" ]] && echo "x86_64" || echo "aarch64") +SUFFIX="" +[[ "$VARIANT" == "systemqt" ]] && SUFFIX="-system-qt" +SRC_DIR="$PWD/linux-$ARCH$SUFFIX" + +DEPENDS="" +[[ "$VARIANT" == "systemqt" ]] && DEPENDS="Requires: qt6-qtbase qt6-qtbase-gui qt6-qtwayland xcb-util-cursor google-noto-emoji-color-fonts" + WORK="$PWD/rpmwork" -BUILDROOT="$WORK/buildroot" rm -rf "$WORK" -mkdir -p "$BUILDROOT/opt" "$BUILDROOT/usr/share/applications" "$WORK/RPMS" +mkdir -p "$WORK/RPMS" -cp -r "linux-$ARCH$([[ $3 == "systemqt" ]] && echo "-system-qt")" "$BUILDROOT/opt/Throne" -rm -f "$BUILDROOT/opt/Throne/Throne.debug" - -cat >"$BUILDROOT/usr/share/applications/Throne.desktop" <<-EOF +cat >"$WORK/Throne.desktop" <<-EOF [Desktop Entry] Name=Throne Comment=Qt based cross-platform GUI proxy configuration manager (backend: sing-box) @@ -31,11 +35,6 @@ Type=Application Categories=Network;Application; EOF -DEPENDS="" -[[ $3 == "systemqt" ]] && DEPENDS="Requires: qt6-qtbase qt6-qtbase-gui qt6-qtwayland xcb-util-cursor google-noto-emoji-color-fonts" - -# %install is a no-op on purpose: the buildroot above is already fully populated, -# and rpmbuild does not touch existing buildroot contents unless %install does. cat >"$WORK/Throne.spec" <<-EOF Name: Throne Version: ${RPM_VERSION} @@ -51,7 +50,12 @@ Requires(postun): desktop-file-utils Qt based cross-platform GUI proxy configuration manager (backend: sing-box). %install -true +rm -rf %{buildroot} +mkdir -p %{buildroot}/opt/Throne +cp -a ${SRC_DIR}/. %{buildroot}/opt/Throne/ +rm -f %{buildroot}/opt/Throne/Throne.debug +mkdir -p %{buildroot}/usr/share/applications +cp ${WORK}/Throne.desktop %{buildroot}/usr/share/applications/Throne.desktop %files /opt/Throne @@ -66,9 +70,7 @@ EOF rpmbuild -bb \ --define "_topdir $WORK" \ - --buildroot "$BUILDROOT" \ --define "_rpmdir $WORK/RPMS" \ - --define "_build_id_links none" \ --target "$RPM_ARCH" \ "$WORK/Throne.spec" From 09b59ac90f012254574e1159ae7fc03d962cdb79 Mon Sep 17 00:00:00 2001 From: bardia Date: Sun, 23 Aug 2026 00:00:09 +0200 Subject: [PATCH 4/6] fix: pack_rpm.sh fails on cross-arch (aarch64) builds --- script/pack_rpm.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/script/pack_rpm.sh b/script/pack_rpm.sh index 454a61a19..115953169 100755 --- a/script/pack_rpm.sh +++ b/script/pack_rpm.sh @@ -41,7 +41,6 @@ Version: ${RPM_VERSION} Release: 1 Summary: Qt based cross-platform GUI proxy configuration manager (backend: sing-box) License: Custom -BuildArch: ${RPM_ARCH} ${DEPENDS} Requires(post): desktop-file-utils Requires(postun): desktop-file-utils From a74b5a23f32291d1cb8e694edc134eca37160349 Mon Sep 17 00:00:00 2001 From: bardia Date: Sun, 23 Aug 2026 00:44:27 +0200 Subject: [PATCH 5/6] fix: heredoc --- script/pack_rpm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/pack_rpm.sh b/script/pack_rpm.sh index 115953169..4643c62c2 100755 --- a/script/pack_rpm.sh +++ b/script/pack_rpm.sh @@ -41,6 +41,9 @@ Version: ${RPM_VERSION} Release: 1 Summary: Qt based cross-platform GUI proxy configuration manager (backend: sing-box) License: Custom +%define debug_package %{nil} +%define __os_install_post %{nil} +%define __strip /bin/true ${DEPENDS} Requires(post): desktop-file-utils Requires(postun): desktop-file-utils From 0390f417be0e549ce716dc67050be4e0dbc3537f Mon Sep 17 00:00:00 2001 From: bardia Date: Sun, 23 Aug 2026 01:18:25 +0200 Subject: [PATCH 6/6] fix: update licence to GPL-3.0-or-later --- script/pack_rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/pack_rpm.sh b/script/pack_rpm.sh index 4643c62c2..990998d0a 100755 --- a/script/pack_rpm.sh +++ b/script/pack_rpm.sh @@ -40,7 +40,7 @@ Name: Throne Version: ${RPM_VERSION} Release: 1 Summary: Qt based cross-platform GUI proxy configuration manager (backend: sing-box) -License: Custom +License: GPL-3.0-or-later %define debug_package %{nil} %define __os_install_post %{nil} %define __strip /bin/true