-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·124 lines (99 loc) · 3.24 KB
/
package.sh
File metadata and controls
executable file
·124 lines (99 loc) · 3.24 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
set -euo pipefail
_current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
_root_dir="$(cd "$_current_dir/.." && pwd)"
_build_dir="$_root_dir/build"
_release_dir="$_build_dir/release"
_app_dir="$_release_dir/Helium.AppDir"
_app_name="helium"
_version=$(python3 "$_root_dir/helium-chromium/utils/helium_version.py" \
--tree "$_root_dir/helium-chromium" \
--platform-tree "$_root_dir" \
--print)
_arch=$(cat "$_build_dir/src/out/Default/args.gn" \
| grep ^target_cpu \
| tail -1 \
| sed 's/.*=//' \
| cut -d'"' -f2)
if [ "$_arch" = "x64" ]; then
_arch="x86_64"
fi
_release_name="$_app_name-$_version-$_arch"
_update_info="gh-releases-zsync|imputnet|helium-linux|latest|$_app_name-*-$_arch.AppImage.zsync"
_tarball_name="${_release_name}_linux"
_tarball_dir="$_release_dir/$_tarball_name"
_files="helium
chrome_100_percent.pak
chrome_200_percent.pak
helium_crashpad_handler
chromedriver
icudtl.dat
libEGL.so
libGLESv2.so
libqt5_shim.so
libqt6_shim.so
libvk_swiftshader.so
libvulkan.so.1
locales/
product_logo_256.png
resources.pak
v8_context_snapshot.bin
vk_swiftshader_icd.json
xdg-mime
xdg-settings"
echo "copying release files and creating $_tarball_name.tar.xz"
rm -rf "$_tarball_dir"
mkdir -p "$_tarball_dir"
for file in $_files; do
cp -r "$_build_dir/src/out/Default/$file" "$_tarball_dir" &
done
cp "$_root_dir/package/helium.desktop" "$_tarball_dir"
cp "$_root_dir/package/apparmor.cfg" "$_tarball_dir"
cp "$_root_dir/package/helium-wrapper.sh" "$_tarball_dir/helium-wrapper"
wait
(cd "$_tarball_dir" && ln -sf helium chrome)
if command -v eu-strip >/dev/null 2>&1; then
_strip_cmd=eu-strip
else
_strip_cmd="strip --strip-unneeded"
fi
find "$_tarball_dir" -type f -exec file {} + \
| awk -F: '/ELF/ {print $1}' \
| xargs $_strip_cmd
_size="$(du -sk "$_tarball_dir" | cut -f1)"
pushd "$_release_dir"
TAR_PATH="$_release_dir/$_tarball_name.tar.xz"
tar vcf - "$_tarball_name" \
| pv -s"${_size}k" \
| xz -e9 > "$TAR_PATH" &
# create AppImage
rm -rf "$_app_dir"
mkdir -p "$_app_dir/opt/helium/" "$_app_dir/usr/share/icons/hicolor/256x256/apps/"
cp -r "$_tarball_dir"/* "$_app_dir/opt/helium/"
cp "$_root_dir/package/helium.desktop" "$_app_dir"
cp "$_root_dir/package/helium-wrapper-appimage.sh" "$_app_dir/AppRun"
for out in "$_app_dir/helium.png" "${_app_dir}/usr/share/icons/hicolor/256x256/apps/helium.png"; do
cp "${_app_dir}/opt/helium/product_logo_256.png" "$out"
done
export APPIMAGETOOL_APP_NAME="Helium"
export VERSION="$_version"
# check whether CI GPG secrets are available
if [[ -n "${GPG_PRIVATE_KEY:-}" && -n "${GPG_PASSPHRASE:-}" ]]; then
echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "$GPG_PASSPHRASE"
export APPIMAGETOOL_SIGN_PASSPHRASE="$GPG_PASSPHRASE"
fi
appimagetool \
-u "$_update_info" \
"$_app_dir" \
"$_release_name.AppImage" "$@" &
popd
wait
if [ "${MAKE_DEB:-0}" = 1 ]; then
"$_root_dir/package/mkdeb.sh" "$TAR_PATH"
fi
if [ -n "${SIGN_TARBALL:-}" ]; then
gpg --batch --pinentry-mode loopback \
--detach-sign --passphrase "$GPG_PASSPHRASE" \
--output "$TAR_PATH.asc" "$TAR_PATH"
fi
rm -rf "$_tarball_dir" "$_app_dir"