Skip to content

Commit

Permalink
fixed AppRun and build script for AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
manfred-kaiser committed Apr 6, 2024
1 parent 78ec634 commit 20214b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 4 additions & 2 deletions appimage/AppRun
Expand Up @@ -22,6 +22,8 @@
# Check if APPDIR is already set, if not, determine and set it to the AppImage's mount directory.
# APPDIR needs to be set as it specifies the directory where the AppImage content is located.

set -e

if [ -z $APPDIR ]; then
export APPDIR=$(dirname $(readlink -f "$0"))
fi
Expand All @@ -42,9 +44,9 @@ fi
# If the command includes a '/', it's either a relative path or an absolute path.
# Otherwise, the command must be searched for in $PATH.
# a bash subshell for which is only started when no path part is found
CMD_PATH=${ARGV0} && [[ "$ARGV0" != */* ]] && CMD_PATH=$(which "$ARGV0")
CMD_PATH=${ARGV0} && [[ "$ARGV0" != */* ]] && CMD_PATH=$(which "$ARGV0" 2>/dev/null || echo "AppRun")

if [ -z $ENV_LOADED ] && [ -L $CMD_PATH ]; then
if [ -z $ENV_LOADED ] && [ -L "$CMD_PATH" ]; then

SYMLINK_PATH=$(realpath -s "$CMD_PATH")
while [ -L $SYMLINK_PATH ]; do
Expand Down
16 changes: 13 additions & 3 deletions appimage/build.sh
@@ -1,16 +1,28 @@
set -e

# detect machine's architecture
export ARCH=$(uname -m)

# define download urls
python_download_url="https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-x86_64_v2-unknown-linux-gnu-pgo+lto-full.tar.zst"
appimagetool_download_url="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$ARCH.AppImage"


# cleanup old build process
if [ -d build/appimage/AppDir ]; then
rm -r build/appimage/AppDir
fi
if [ -f dist/SSH-MITM-x86_64.AppImage ]; then
rm dist/SSH-MITM-x86_64.AppImage;
fi


# create new AppImage

mkdir -p build/appimage/AppDir

if [ ! -f build/python.tar.zst ]; then
curl -L -o build/python.tar.zst https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-x86_64_v2-unknown-linux-gnu-pgo+lto-full.tar.zst
curl -L -o build/python.tar.zst "$python_download_url"
fi
tar --use-compress-program=unzstd -xvf build/python.tar.zst -C build/appimage/AppDir --transform 's/python\/install/python/' python/install

Expand All @@ -20,8 +32,6 @@ build/appimage/AppDir/python/bin/python3 -m pip install -r requirements-dev.txt
cp appimage/AppRun build/appimage/AppDir/
cp appimage/ssh-mitm* build/appimage/AppDir/

# detect machine's architecture
export ARCH=$(uname -m)
# get the missing tools if necessary
if [ ! -x build/appimagetool-$ARCH.AppImage ]; then
curl -L -o build/appimagetool-$ARCH.AppImage https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$ARCH.AppImage
Expand Down

0 comments on commit 20214b1

Please sign in to comment.