#! /bin/bash set -e set -x modprobe fuse arch=$1 # 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 wget -O appimagetool.AppImage https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-$archname.AppImage chmod +x appimagetool.AppImage W="/var/jenkins_home/workspace/nightly-antosaio/build/" [ -d antos.AppDir ] && rm -rf antos.AppDir [ -z $arch ] && arch=amd64 tag=$2 [ -z $tag ] && tag=latest 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 [ ! -f "$W/antd-config.ini" ] && cp ./opt/www/antd-config.ini $W/antd-config.ini [ ! -f "$W/runner.ini" ] && cp ./opt/www/runner.ini $W/runner.ini export LD_LIBRARY_PATH="$B/usr/lib/" echo "Runing Antd in $B" touch /tmp/.antos_pkgcache ./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/$arch/* antos.AppDir/ cp -rf $W/frontend/$tag/* antos.AppDir/ cp antd-config.ini antos.AppDir/opt/www/ cp runner.ini antos.AppDir/opt/www/ ln -sf /tmp/.antos_pkgcache antos.AppDir/opt/www/htdocs/os/packages/packages.json tree antos.AppDir ./appimagetool.AppImage antos.AppDir build/AntOS_$archname-$tag.AppImage