building appimage on the nixos for debian
This commit is contained in:
73
packaging/appimage/build.sh
Executable file
73
packaging/appimage/build.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
echo "Usage: $0 [OUTPUT.AppImage]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repo_root="$(cd -- "$script_dir/../.." && pwd)"
|
||||
output="${1:-$repo_root/KompAC.AppImage}"
|
||||
work_dir="$(mktemp -d /tmp/komp-ac-appimage-build.XXXXXX)"
|
||||
cleanup() {
|
||||
case "$work_dir" in
|
||||
/tmp/komp-ac-appimage-build.*)
|
||||
rm -rf -- "$work_dir"
|
||||
;;
|
||||
*)
|
||||
echo "Refusing to remove unexpected temporary directory: $work_dir" >&2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
trap cleanup EXIT INT TERM HUP
|
||||
|
||||
(
|
||||
cd -- "$repo_root"
|
||||
nix build '.?submodules=1#portable-server' --out-link "$work_dir/portable-server"
|
||||
)
|
||||
|
||||
set +e
|
||||
(
|
||||
cd -- "$repo_root/client-gui2"
|
||||
yarn tauri build --bundles appimage
|
||||
)
|
||||
tauri_status=$?
|
||||
set -e
|
||||
|
||||
shopt -s nullglob
|
||||
gui_appimages=("$repo_root"/client-gui2/src-tauri/target/release/bundle/appimage/*.AppImage)
|
||||
gui_bundle=""
|
||||
if [[ $tauri_status -eq 0 && ${#gui_appimages[@]} -gt 0 ]]; then
|
||||
gui_bundle="${gui_appimages[0]}"
|
||||
for candidate in "${gui_appimages[@]:1}"; do
|
||||
if [[ "$candidate" -nt "$gui_bundle" ]]; then
|
||||
gui_bundle="$candidate"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z "$gui_bundle" ]]; then
|
||||
gui_appdir="$repo_root/client-gui2/src-tauri/target/release/bundle/appimage/komp_ac.AppDir"
|
||||
if [[ -d "$gui_appdir" ]] && \
|
||||
cmp -s \
|
||||
"$repo_root/client-gui2/src-tauri/target/release/client-gui2" \
|
||||
"$gui_appdir/usr/bin/client-gui2"; then
|
||||
gui_bundle="$gui_appdir"
|
||||
echo "Tauri did not emit a current GUI AppImage; using its completed AppDir"
|
||||
else
|
||||
echo "The Tauri build did not produce a current GUI AppImage or AppDir" >&2
|
||||
exit "${tauri_status:-1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $tauri_status -ne 0 ]]; then
|
||||
echo "Continuing because the release GUI and its AppDir were completed before linuxdeploy failed"
|
||||
fi
|
||||
|
||||
"$script_dir/assemble.sh" \
|
||||
"$gui_bundle" \
|
||||
"$work_dir/portable-server/bin/server" \
|
||||
embedded \
|
||||
"$output"
|
||||
Reference in New Issue
Block a user