jan/src-tauri/build-utils/buildAppImage.sh
2025-07-10 21:14:20 +07:00

32 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
APPIMAGETOOL="./.cache/build-tools/appimagetool"
RELEASE_CHANNEL=${RELEASE_CHANNEL:-"stable"}
# pull in AppImageTool if it's not pre cached
mkdir -p ./.cache/build-tools
if [ ! -f "${APPIMAGETOOL}" ]; then
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O "${APPIMAGETOOL}"
chmod +x "${APPIMAGETOOL}"
fi
if [ "${RELEASE_CHANNEL}" != "stable" ]; then
APP_DIR=./src-tauri/target/release/bundle/appimage/Jan-${RELEASE_CHANNEL}.AppDir
LIB_DIR=$APP_DIR/usr/lib/Jan-${RELEASE_CHANNEL}/binaries
else
APP_DIR=./src-tauri/target/release/bundle/appimage/Jan.AppDir
LIB_DIR=$APP_DIR/usr/lib/Jan/binaries
fi
# bundle additional resources in the AppDir without pulling in their dependencies
cp ./src-tauri/resources/bin/bun $APP_DIR/usr/bin/bun
mkdir -p $LIB_DIR/engines
cp -f ./src-tauri/binaries/deps/*.so* $LIB_DIR/
cp -f ./src-tauri/binaries/*.so* $LIB_DIR/
# remove appimage generated by tauri build
APP_IMAGE=./src-tauri/target/release/bundle/appimage/$(ls ./src-tauri/target/release/bundle/appimage/ | grep AppImage | head -1)
echo $APP_IMAGE
rm -f $APP_IMAGE
# repackage appimage with additional resources
"${APPIMAGETOOL}" $APP_DIR $APP_IMAGE