-
-
Notifications
You must be signed in to change notification settings - Fork 387
Expand file tree
/
Copy pathpack_rpm.sh
More file actions
executable file
·79 lines (64 loc) · 1.97 KB
/
Copy pathpack_rpm.sh
File metadata and controls
executable file
·79 lines (64 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
TAG="$1"
ARCH="$2"
VARIANT="$3"
RPM_VERSION="${TAG#v}"
RPM_VERSION="${RPM_VERSION#V}"
#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"
rm -rf "$WORK"
mkdir -p "$WORK/RPMS"
cat >"$WORK/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
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: GPL-3.0-or-later
%define debug_package %{nil}
%define __os_install_post %{nil}
%define __strip /bin/true
${DEPENDS}
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
%description
Qt based cross-platform GUI proxy configuration manager (backend: sing-box).
%install
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
/usr/share/applications/Throne.desktop
%post
update-desktop-database &> /dev/null || :
%postun
update-desktop-database &> /dev/null || :
EOF
rpmbuild -bb \
--define "_topdir $WORK" \
--define "_rpmdir $WORK/RPMS" \
--target "$RPM_ARCH" \
"$WORK/Throne.spec"
find "$WORK/RPMS" -name '*.rpm' -exec mv {} ./Throne.rpm \;