#! /bin/bash set -e set -x # modprobe fuse arch=$1 [ -z $arch ] && arch=amd64 tag=$2 [ -z $tag ] && tag=latest # download the appimagetools echo "Downloading the appimage tools" archname=x86_64 case $arch in amd64|x86_64) archname=x86_64 ;; aarch64|arm64) archname=aarch64 ;; armv7l|arm) archname=armhf ;; *) echo "Unkown architecture" exit 1 ;; esac [ -f appimagetool.AppImage ] || wget --no-check-certificate -O appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage chmod +x appimagetool.AppImage wget --no-check-certificate https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-$archname W="$WORKSPACE/antos/" [ -d antos.AppDir ] && rm -rf antos.AppDir echo "Building app image for $arch" mkdir antos.AppDir # AppRun cat << "EOF" >> antos.AppDir/AppRun #!/bin/sh set -e echo "Runing AntOS" W=$(realpath $1) B=$(dirname $0) cd $B [ ! -d "$W" ] && echo "$W is not a directory" && exit 1 # start antd-tunnel service if [ ! -f "$W/antd-config.ini" ]; then cp ./opt/www/antd-config.ini $W/antd-config.ini fi [ ! -f "$W/runner.ini" ] && cp ./opt/www/runner.ini $W/runner.ini export LD_LIBRARY_PATH="$B/usr/lib/" echo "Runing Antd in $B with configuration $W/antd-config.ini" ./usr/bin/antd $W/antd-config.ini >/dev/null 2>&1 | ( sleep 2 && ./opt/www/bin/runner $W/runner.ini >/dev/null 2>&1 &) EOF chmod +x antos.AppDir/AppRun # desktop file cat << "EOF" >> antos.AppDir/antos.desktop [Desktop Entry] Name=AntOS Exec=antd Icon=antos Type=Application Categories=Utility; Terminal=true EOF # copy all neccessary file cp antos.png antos.AppDir cp -rf $W/backend/build/$arch/* antos.AppDir/ cp -rf $W/frontend/$tag/build/* antos.AppDir/ cp antd-config.ini antos.AppDir/opt/www/ cp runner.ini antos.AppDir/opt/www/ tree antos.AppDir ./appimagetool.AppImage --runtime-file runtime-$archname antos.AppDir build/AntOS_$archname-$tag.AppImage cd build case $arch in armv7l|arm) mv AntOS_$archname-$tag.AppImage AntOS_armv7l-$tag.AppImage ;; *) ;; esac